#include "include.h" u8 hv_motor1_data[8]; u8 hv_motor2_data[8]; u8 hv_motor3_data[8]; int cntBLight=0, cntSLight=0, cntUSBL=0, cntCamera1=0, cntCamera2=0, cntCamera3=0, cntCamera4=0, cntMotor1=0, cntMotor2=0; void SysTick_Handler(void) { sysTickUptime++; static u32 countbiglight = 0; static u32 countbiglightshut = 0; //两线大灯 if(Read_BIG_LIGHT) { if(++cntBLight>3) { CUT_BIG_LIGHT; LightOvercurrent = 1; } } else { cntBLight = 0; if(LightOvercurrent == 0){ BIG_LIGHT_ON; } } //三线小灯 if(Read_SMG_LIGHT) { if(++cntSLight>3) CUT_SMG_LIGHT; } else { cntSLight = 0; if(light_pwm) { SMG_LIGHT_ON; } else { SMG_LIGHT_OFF; } } //USBL if(Read_USBL) { if(++cntUSBL>3) CUT_USBL; } else { cntUSBL = 0; if(usbl_opendown) { USBL_ON; } else { USBL_OFF; } } //camera1 if(Read_CAMERA1) { if(++cntCamera1>3) CUT_CAMERA1; } else cntCamera1 = 0; //camera2 if(Read_CAMERA2) { if(++cntCamera2>3) CUT_CAMERA2; } else cntCamera2 = 0; //camera3 if(Read_CAMERA3) { if(++cntCamera3>3) CUT_CAMERA3; } else cntCamera3 = 0; //camera4 if(Read_CAMERA4) { if(++cntCamera4>3) CUT_CAMERA4; } else cntCamera4 = 0; //motor1 if(Read_MOTOR1) { if(++cntMotor1>3) CUT_Motor1; } else cntMotor1 = 0; //motor2 if(Read_MOTOR2) { if(++cntMotor2>3) CUT_Motor2; } else cntMotor2 = 0; } void TIM1_UP_TIM10_IRQHandler(void) { if(TIM_GetITStatus(TIM1, TIM_IT_Update)) //判断发生update事件中断 { TIM_ClearITPendingBit(TIM1, TIM_IT_Update); //清除update事件中断标志 } } int u1Rx = 0; void USART1_IRQHandler(void) { if(USART_GetITStatus(USART1,USART_IT_RXNE)!=RESET) { //GetMotorData(USART1, &left_track_motor); u1Rx = USART_ReceiveData(USART1); USART_ClearITPendingBit(USART1, USART_IT_RXNE); } else if(USART_GetITStatus(USART1,USART_IT_IDLE)!=RESET) { USART1->SR; USART1->DR; //AnaMotorData(&left_track_motor); } } int u4Rx = 0; void UART4_IRQHandler(void) { if(USART_GetITStatus(UART4,USART_IT_RXNE)!=RESET) { //GetMotorData(UART4, &left_track_motor); u4Rx = USART_ReceiveData(UART4); USART_ClearITPendingBit(UART4, USART_IT_RXNE); } else if(USART_GetITStatus(UART4,USART_IT_IDLE)!=RESET) { UART4->SR; UART4->DR; //AnaMotorData(&left_track_motor); } } void CAN1_RX0_IRQHandler(void) { u8 RecData[8]; u8 RecNum; u32 id = 0; IWDG_Feed(); RecNum = CAN1_Receive_Msg(RecData,&id); if(id == 0X014E550A && RecNum == 7) { light_pwm = (RecData[1]<<8)|RecData[0];//灯 PWM light_step = (RecData[3]<<8)|RecData[2];//灯 PWM usbl_opendown = (RecData[5]<<8)|RecData[4];//usbl } } void ADC_IRQHandler(void) { if(ADC_GetFlagStatus(ADC1,ADC_FLAG_EOC)!=RESET) { Rntc = ADC_GetConversionValue(ADC1); } ADC_ClearITPendingBit(ADC1,ADC_FLAG_EOC); } void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } }