微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > stm32_exti(含NVIC)配置及库函数讲解

stm32_exti(含NVIC)配置及库函数讲解

时间:11-11 来源:互联网 点击:

led
* Description : Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* Input : - file: pointer to the source file name
* - line: assert_param error line source number
* Return : None
*******************************************************************************/
void assert_failed(u8* file, u32 line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

/* Infinite loop */
while (1)
{
}
}
#endif


stm32f10x_it.c有关EXTI9代码如下

void EXTI9_5_IRQHandler(void)
{
if (EXTI_GetITStatus(EXTI_Line9) != RESET)
{
/* Toggle PC6 pin */
GPIO_WriteBit(GPIOC, GPIO_Pin_6, (BitAction)((1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_6))));

/* Clear the EXTI line 9 pending bit */
EXTI_ClearITPendingBit(EXTI_Line9);
}
}

最后,需要提示一下,添加工程文件时一定别忘了将stm32f10x_vector.c文件加到project中,否则中断进入FaultISR。具体方法见


Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top