123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- #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)
- {
- }
- }
|