![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
after pin config implementation
Fork of BAE_FRDM by
Diff: fault.cpp
- Revision:
- 8:69475d16d23d
- Parent:
- 7:f06840d848e3
--- a/fault.cpp Wed Dec 10 06:34:17 2014 +0000 +++ b/fault.cpp Thu Dec 11 07:34:17 2014 +0000 @@ -2,7 +2,7 @@ #include "HK.h" - +DigitalIn fault0(FAULT0,PullUp); DigitalIn fault1(FAULT1,PullUp); DigitalIn fault2(FAULT2,PullUp); DigitalIn fault3(FAULT3,PullUp); @@ -25,39 +25,78 @@ DigitalOut clear2(FAULT_CLEAR2,0); DigitalOut clear3(FAULT_CLEAR3,0); DigitalOut clear4(FAULT_CLEAR4,0); -DigitalOut clear5(FAULT_CLEAR5,0); -DigitalOut clear6(FAULT_CLEAR6,0); -DigitalOut clear7(FAULT_CLEAR7,0); -DigitalOut clear8(FAULT_CLEAR8,0); -DigitalOut clear9(FAULT_CLEAR9,0); +DigitalOut clear5(FAULT_CLEAR5); +DigitalOut clear6(FAULT_CLEAR6); +DigitalOut clear7(FAULT_CLEAR7); +DigitalOut clear8(FAULT_CLEAR8); +DigitalOut clear9(FAULT_CLEAR9); DigitalOut acs_active(ACS); +BusIn fault_poll(FAULT0,FAULT1,FAULT2,FAULT3,FAULT4); +BusIn fault_ir(FAULT5,FAULT6,FAULT7,FAULT8,FAULT9); + BusOut clear_poll(FAULT_CLEAR1,FAULT_CLEAR2,FAULT_CLEAR3,FAULT_CLEAR4);//to send fault data along with hk -BusOut clear_interrupt(FAULT_CLEAR5,FAULT_CLEAR6,FAULT_CLEAR7,FAULT_CLEAR8,FAULT_CLEAR9); +BusOut clear_ir(FAULT_CLEAR5,FAULT_CLEAR6,FAULT_CLEAR7,FAULT_CLEAR8,FAULT_CLEAR9); + extern SensorData Sensor; extern int beacon_sc; //to switch beacon between low and high power mode extern int acs_pflag; //to activate/deactivate control algo - +char out_poll; +char out_ir; void FAULTS() { printf("Entered Fault management \n"); - clear1 = !fault1; - clear2 = !fault2; - clear3 = !fault3; - clear4 = !fault4; + if(fault0==0)printf("CHARGER IS CHARGING THE BATTERY "); + if(fault0==1)printf("CHRGER GONE OFFLINE, BATTERY DRAINING"); + + if(fault1==0) + { clear1=1;printf("");} + else + { clear1=0;} + + if(fault2==0) + { clear2=1;printf("");} + else + { clear2=0;} + + if(fault3==0) + { clear3=1;printf("");} + else + { clear3=0;} + + if(fault4==0) + { clear4=1;printf("");} + else + { clear4=0;} + + + + + + + + + //clear1 = !fault1; + //clear2 = !fault2; + //clear3 = !fault3; + //clear4 = !fault4; //clear5 = !fault5; //clear6 = !fault6; //clear7 = !fault7; //clear8 = !fault8; - Sensor.faultpoll = clear_poll; - Sensor.faultir=clear_interrupt; - printf(" %d , %d \n",Sensor.faultpoll, Sensor.faultir ) ; + + + out_poll = clear_poll; + out_ir = clear_ir; + Sensor.faultpoll = fault_poll ; + Sensor.faultir=fault_ir ; + printf(" %d , %d \n %d , %d\n",Sensor.faultpoll, Sensor.faultir , out_poll , out_ir) ; } @@ -85,11 +124,11 @@ void interrupt_fault() { - /*fault_IR1.rise(&Clear_IR1); + fault_IR1.rise(&Clear_IR1); fault_IR2.rise(&Clear_IR2); fault_IR3.rise(&Clear_IR3); fault_IR4.rise(&Clear_IR4); - fault_IR5.rise(&Clear_IR5);*/ + fault_IR5.rise(&Clear_IR5); fault_IR1.fall(&Clear_IR1); fault_IR2.fall(&Clear_IR2); fault_IR3.fall(&Clear_IR3);