/** * @brief Main program. * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f0xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file */ /* Initialize LEDs mounted on EVAL board */ STM_EVAL_LEDInit(LED1); STM_EVAL_LEDInit(LED2); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); /* Configure PA0 in interrupt mode */ EXTI0_Config(); /* Configure PE3, PE2 in interrupt mode only for STM32072B devices*/ #ifdef USE_STM32072B_EVAL EXTI2_3_Config(); #endif /* Configure PC13 in interrupt mode */ EXTI4_15_Config(); /* Generate software interrupt: simulate a falling edge applied on EXTI8 line */ EXTI_GenerateSWInterrupt(EXTI_Line8); /* Infinite loop */ while (1) { } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32l1xx_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32l1xx.c file */ /* Initialize LEDs mounted on STM32L1XX-EVAL board */ STM_EVAL_LEDInit(LED1); STM_EVAL_LEDInit(LED2); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); /* Configure PA0 in interrupt mode */ EXTI0_Config(); /* Configure (PE8 and PE9) or PG8 in interrupt mode */ EXTI9_5_Config(); /* Configure PE10 or (PG13 and PG11) in interrupt mode */ EXTI15_10_Config(); /* Generate software interrupt: simulate a falling edge applied on EXTI0 line */ EXTI_GenerateSWInterrupt(EXTI_Line0); while (1) { } }
/* Private function ----------------------------------------------------------*/ int main(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB , ENABLE); /* LED0 -> PB0 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); USART1_Init(); USART1_Print("\r\n"); USART1_Print("*************************************************************\r\n"); USART1_Print("* *\r\n"); USART1_Print("* Thank you for using MatchboxARM Development Board ! ^_^ *\r\n"); USART1_Print("* *\r\n"); USART1_Print("*************************************************************\r\n"); /* Configure PA0 in interrupt mode */ EXTI0_Config(); /* Generate software interrupt on EXTI0 line */ EXTI_GenerateSWInterrupt(EXTI_Line0); /* Infinite loop */ while(1) { } }