![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
void Led_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable GPIOB, GPIOC and AFIO clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_AFIO , ENABLE); //RCC_APB2Periph_AFIO /* LEDs pins configuration */ GPIO_InitStructure.GPIO_Pin = GPIO_LED_ALL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOD, &GPIO_InitStructure); }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#define GPIO_LED1 GPIO_Pin_2 #define GPIO_LED2 GPIO_Pin_3 #define GPIO_LED3 GPIO_Pin_4 #define GPIO_LED4 GPIO_Pin_7 #define GPIO_LED_ALL GPIO_LED1 |GPIO_LED2 |GPIO_LED3 |GPIO_LED4
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
void Led_Turn_off_all(void) { /* Turn Off All LEDs */ GPIO_SetBits(GPIOD, GPIO_LED_ALL); }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
void Led_Turn_on_all(void) { /* Turn On All LEDs */ GPIO_ResetBits(GPIOD, GPIO_LED_ALL); }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
while(1) { Led_Turn_off_all(); Delay_ARMJISHU(3000000); Led_Turn_on_all(); Delay_ARMJISHU(3000000); }