STM32之中断与事件一个使用GPIO作为外部中断的示例
时间:11-20
来源:互联网
点击:
中断例程:
void EXTI15_10_IRQHandler(void){rt_interrupt_enter();/* °²È«ÆøÄÒÓ²Ïß¼ì²â´¦Àí*/vcm_airbag_exti_check();/* GPSÌìÏß¿ªÂ·¼ì²â´¦Àí*/gps_exti_check();rt_interrupt_leave();}
void vcm_airbag_exti_check(void){//¼ì²éµ±Ç°ÖжϵÄ״̬ÊÇ·ñºÏ·¨if(EXTI_GetITStatus(AIRBAG_EXTI_LINE) != RESET){ //¶ÁȹܽŵÄ״̬,ÕâÀï·µ»Ø0±íʾ°²È«ÆøÄÒ±¬¿ªif(0 ==GPIO_ReadInputDataBit(AIRBAG_GPIO_PORT,AIRBAG_GPIO_PIN)){ recv_frame.bus_type = BTYPE_HS_CAN;recv_frame.id = 0x545;recv_frame.data_buff[0] = 0x00;recv_frame.data_buff[1] = 0x01;recv_frame.data_buff[2] = 0x00;recv_frame.data_buff[3] = 0x00;recv_frame.data_buff[4] = 0x00;recv_frame.data_buff[5] = 0x00;recv_frame.data_buff[6] = 0x00;recv_frame.data_buff[7] = 0x00;VCM_DEBUG("[vcm] warning: airbag gpio interrupt rising.\r\n");}else{recv_frame.bus_type = BTYPE_HS_CAN;recv_frame.id = 0x545;recv_frame.data_buff[0] = 0x00;recv_frame.data_buff[1] = 0x00;recv_frame.data_buff[2] = 0x00;recv_frame.data_buff[3] = 0x00;recv_frame.data_buff[4] = 0x00;recv_frame.data_buff[5] = 0x00;recv_frame.data_buff[6] = 0x00;recv_frame.data_buff[7] = 0x00;VCM_DEBUG("[vcm] warning: airbag gpio interrupt falling.\r\n");}rt_mq_send(&recv_frame_mq,&recv_frame,sizeof(can_bus_frame));//ÇåÖжϱê־λEXTI_ClearITPendingBit(AIRBAG_EXTI_LINE); } }
STM32中断与事件GPIO外部中 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)