![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
slave integrated
Fork of BAE_FRDMTESIN2 by
Diff: fault.cpp
- Revision:
- 7:f06840d848e3
- Parent:
- 6:e65b1ab79f36
- Child:
- 8:69475d16d23d
--- a/fault.cpp Tue Dec 09 07:59:56 2014 +0000 +++ b/fault.cpp Wed Dec 10 06:34:17 2014 +0000 @@ -2,14 +2,23 @@ #include "HK.h" -DigitalIn fault1(FAULT1); -DigitalIn fault2(FAULT2); -DigitalIn fault3(FAULT3); -DigitalIn fault4(FAULT4); -DigitalIn fault5(FAULT5); -DigitalIn fault6(FAULT6); -DigitalIn fault7(FAULT7); -DigitalIn fault8(FAULT8); + +DigitalIn fault1(FAULT1,PullUp); +DigitalIn fault2(FAULT2,PullUp); +DigitalIn fault3(FAULT3,PullUp); +DigitalIn fault4(FAULT4,PullUp); +//DigitalIn fault5(FAULT5,PullUp); +//DigitalIn fault6(FAULT6,PullUp); +//DigitalIn fault7(FAULT7,PullUp); +//DigitalIn fault8(FAULT8,PullUp); + + +InterruptIn fault_IR1(FAULT5); +InterruptIn fault_IR2(FAULT6); +InterruptIn fault_IR3(FAULT7); +InterruptIn fault_IR4(FAULT8); +InterruptIn fault_IR5(FAULT9); + DigitalOut clear1(FAULT_CLEAR1,0); @@ -20,11 +29,14 @@ DigitalOut clear6(FAULT_CLEAR6,0); DigitalOut clear7(FAULT_CLEAR7,0); DigitalOut clear8(FAULT_CLEAR8,0); +DigitalOut clear9(FAULT_CLEAR9,0); + DigitalOut acs_active(ACS); -BusOut clear(FAULT_CLEAR1,FAULT_CLEAR2,FAULT_CLEAR3,FAULT_CLEAR4,FAULT_CLEAR5,FAULT_CLEAR6,FAULT_CLEAR7,FAULT_CLEAR8);//to send fault data along with hk +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); extern SensorData Sensor; extern int beacon_sc; //to switch beacon between low and high power mode @@ -39,15 +51,53 @@ clear2 = !fault2; clear3 = !fault3; clear4 = !fault4; - clear5 = !fault5; - clear6 = !fault6; - clear7 = !fault7; - clear8 = !fault8; - Sensor.fault = clear; - printf(" %d \n",Sensor.fault); + //clear5 = !fault5; + //clear6 = !fault6; + //clear7 = !fault7; + //clear8 = !fault8; + Sensor.faultpoll = clear_poll; + Sensor.faultir=clear_interrupt; + printf(" %d , %d \n",Sensor.faultpoll, Sensor.faultir ) ; } + + +void Clear_IR1() +{clear5=!clear5; +} + +void Clear_IR2() +{clear6=!clear6; +} + +void Clear_IR3() +{clear7=!clear7; +} + +void Clear_IR4() +{clear8=!clear8; +} + +void Clear_IR5() +{clear9=!clear9; +} + +void interrupt_fault() +{ + /*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_IR1.fall(&Clear_IR1); + fault_IR2.fall(&Clear_IR2); + fault_IR3.fall(&Clear_IR3); + fault_IR4.fall(&Clear_IR4); + fault_IR5.fall(&Clear_IR5); +} + + void POWER(char flag) //flag corresponds to the power mode { printf("Entered Power Management \n");