SHENG-HEN HSIEH
/
VDU_2021
Just a regular publish
Diff: main.cpp
- Revision:
- 13:ac024885d0bf
- Parent:
- 9:c99eeafa6fa3
- Child:
- 14:bcf5cb4d08a5
--- a/main.cpp Mon Nov 18 17:55:37 2019 +0000 +++ b/main.cpp Tue Nov 19 11:54:12 2019 +0000 @@ -9,10 +9,11 @@ DigitalOut Fault_Ind(PC_12,0); //Indicate fault bt flashing, 1 active DigitalOut LED(D13, 0); //Internal LED output, general purpose AnalogIn AUX_1(PC_0); //Auxilaru analog sensor -AnalogIn AUX_2(PC_4); +AnalogIn AUX_2(PC_3); AnalogIn AUX_3(PC_2); AnalogIn AUX_4(PC_1); AnalogIn SDn_sense(PB_0); //Shutdown circuit driving end detection +AnalogIn Brk_sense(PA_4); //Brake sensor readings CAN can1(PB_8, PB_9, 1000000); //1Mbps, contain critical torque command message SPI spi2(PB_15, PB_14, PB_13); //1Mbps default, MOSI MISO SCLK, forIMU ImuDriver <spi2, PA_13, PA_14, PA_15> imu; //SPI instance, reset, data ready, slave select @@ -86,7 +87,7 @@ (VDU_FLT != 0)) { VDU_STAT = VDU_Fault; FLT_print = 1; - } else { + } else if ((FL_online*FR_online*RL_online*RR_online*PSU_online)!=0) { //All module online & POST pass VDU_STAT = VDU_Idle; printf("All module online, VDU now Idle\n"); @@ -110,7 +111,7 @@ */ //Forced RTD_HMI for debug purpose 2019/11/14 - RTD_HMI = 1; //Should be set if can bus received data +// RTD_HMI = 1; //Should be set if can bus received data //Forced RTD_HMI for debug purpose 2019/11/14 RUNT(); //Run test @@ -275,11 +276,12 @@ void Aux_read(void) { //Capture analog in at once - AUX_1_u16 = AUX_1.read_u16(); - AUX_2_u16 = AUX_2.read_u16(); - AUX_3_u16 = AUX_3.read_u16(); - AUX_4_u16 = AUX_4.read_u16(); + AUX_1_u16 = AUX_1.read_u16() >> 4U; + AUX_2_u16 = AUX_2.read_u16() >> 4U; + AUX_3_u16 = AUX_3.read_u16() >> 4U; + AUX_4_u16 = AUX_4.read_u16() >> 4U; SDn_voltage = 18.81f*SDn_sense.read(); //Read in Shutdown circuit voltage in output end + Brk_voltage = 5.5f*Brk_sense.read(); } void IMU_read(void)