![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fault management added
Fork of BAE_FRDM by
fault.cpp@6:e346d720c451, 2014-12-05 (annotated)
- Committer:
- sakthipriya
- Date:
- Fri Dec 05 10:08:28 2014 +0000
- Revision:
- 6:e346d720c451
- Parent:
- 5:255b43e8e21a
added fault and power
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakthipriya | 2:80b8a2e999f7 | 1 | #include "fault.h" |
sakthipriya | 3:02b45de29c0f | 2 | #include "HK.h" |
sakthipriya | 2:80b8a2e999f7 | 3 | |
sakthipriya | 2:80b8a2e999f7 | 4 | |
sakthipriya | 2:80b8a2e999f7 | 5 | DigitalIn fault1(FAULT1); |
sakthipriya | 2:80b8a2e999f7 | 6 | DigitalIn fault2(FAULT2); |
sakthipriya | 2:80b8a2e999f7 | 7 | DigitalIn fault3(FAULT3); |
sakthipriya | 2:80b8a2e999f7 | 8 | DigitalIn fault4(FAULT4); |
sakthipriya | 2:80b8a2e999f7 | 9 | DigitalIn fault5(FAULT5); |
sakthipriya | 2:80b8a2e999f7 | 10 | DigitalIn fault6(FAULT6); |
sakthipriya | 2:80b8a2e999f7 | 11 | DigitalIn fault7(FAULT7); |
sakthipriya | 2:80b8a2e999f7 | 12 | DigitalIn fault8(FAULT8); |
sakthipriya | 2:80b8a2e999f7 | 13 | |
sakthipriya | 2:80b8a2e999f7 | 14 | |
sakthipriya | 2:80b8a2e999f7 | 15 | DigitalOut clear1(FAULT_CLEAR1); |
sakthipriya | 2:80b8a2e999f7 | 16 | DigitalOut clear2(FAULT_CLEAR2); |
sakthipriya | 2:80b8a2e999f7 | 17 | DigitalOut clear3(FAULT_CLEAR3); |
sakthipriya | 2:80b8a2e999f7 | 18 | DigitalOut clear4(FAULT_CLEAR4); |
sakthipriya | 2:80b8a2e999f7 | 19 | DigitalOut clear5(FAULT_CLEAR5); |
sakthipriya | 2:80b8a2e999f7 | 20 | DigitalOut clear6(FAULT_CLEAR6); |
sakthipriya | 2:80b8a2e999f7 | 21 | DigitalOut clear7(FAULT_CLEAR7); |
sakthipriya | 2:80b8a2e999f7 | 22 | DigitalOut clear8(FAULT_CLEAR8); |
sakthipriya | 2:80b8a2e999f7 | 23 | |
sakthipriya | 6:e346d720c451 | 24 | DigitalOut acs_active(ACS,1); |
sakthipriya | 6:e346d720c451 | 25 | |
sakthipriya | 6:e346d720c451 | 26 | |
sakthipriya | 2:80b8a2e999f7 | 27 | |
sakthipriya | 5:255b43e8e21a | 28 | 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 |
sakthipriya | 5:255b43e8e21a | 29 | |
sakthipriya | 3:02b45de29c0f | 30 | extern SensorData Sensor; |
sakthipriya | 5:255b43e8e21a | 31 | extern int beacon_sc; //to switch beacon between low and high power mode |
sakthipriya | 5:255b43e8e21a | 32 | extern int acs_pflag; //to activate/deactivate control algo |
sakthipriya | 4:8f6c24eca109 | 33 | |
sakthipriya | 2:80b8a2e999f7 | 34 | |
sakthipriya | 2:80b8a2e999f7 | 35 | void FAULTS() |
sakthipriya | 2:80b8a2e999f7 | 36 | { |
sakthipriya | 2:80b8a2e999f7 | 37 | |
sakthipriya | 2:80b8a2e999f7 | 38 | printf("Entered Fault management \n"); |
sakthipriya | 2:80b8a2e999f7 | 39 | clear1 = !fault1; |
sakthipriya | 2:80b8a2e999f7 | 40 | clear2 = !fault2; |
sakthipriya | 2:80b8a2e999f7 | 41 | clear3 = !fault3; |
sakthipriya | 2:80b8a2e999f7 | 42 | clear4 = !fault4; |
sakthipriya | 2:80b8a2e999f7 | 43 | clear5 = !fault5; |
sakthipriya | 2:80b8a2e999f7 | 44 | clear6 = !fault6; |
sakthipriya | 2:80b8a2e999f7 | 45 | clear7 = !fault7; |
sakthipriya | 2:80b8a2e999f7 | 46 | clear8 = !fault8; |
sakthipriya | 3:02b45de29c0f | 47 | Sensor.fault = clear; |
sakthipriya | 3:02b45de29c0f | 48 | printf(" %d \n",Sensor.fault); |
sakthipriya | 2:80b8a2e999f7 | 49 | |
sakthipriya | 4:8f6c24eca109 | 50 | } |
sakthipriya | 4:8f6c24eca109 | 51 | |
sakthipriya | 5:255b43e8e21a | 52 | void POWER(char flag) //flag corresponds to the power mode |
sakthipriya | 4:8f6c24eca109 | 53 | { |
sakthipriya | 4:8f6c24eca109 | 54 | printf("Entered Power Management \n"); |
sakthipriya | 4:8f6c24eca109 | 55 | printf("Entering mode %c \n", flag); |
sakthipriya | 4:8f6c24eca109 | 56 | switch (flag) |
sakthipriya | 4:8f6c24eca109 | 57 | { |
sakthipriya | 5:255b43e8e21a | 58 | case '0': beacon_sc = 6; //least power mode |
sakthipriya | 5:255b43e8e21a | 59 | acs_pflag = 0; |
sakthipriya | 5:255b43e8e21a | 60 | acs_active = 0; //switching off a component of acs |
sakthipriya | 4:8f6c24eca109 | 61 | break; |
sakthipriya | 5:255b43e8e21a | 62 | case '1': beacon_sc = 3; |
sakthipriya | 5:255b43e8e21a | 63 | acs_pflag = 0; |
sakthipriya | 5:255b43e8e21a | 64 | acs_active = 0; |
sakthipriya | 4:8f6c24eca109 | 65 | break; |
sakthipriya | 5:255b43e8e21a | 66 | case '2': beacon_sc = 3; |
sakthipriya | 5:255b43e8e21a | 67 | acs_pflag = 0; |
sakthipriya | 5:255b43e8e21a | 68 | acs_active = 0; |
sakthipriya | 4:8f6c24eca109 | 69 | break; |
sakthipriya | 5:255b43e8e21a | 70 | case '3': beacon_sc = 3; //normal mode |
sakthipriya | 5:255b43e8e21a | 71 | acs_pflag = 1; |
sakthipriya | 5:255b43e8e21a | 72 | acs_active = 1; |
sakthipriya | 5:255b43e8e21a | 73 | break; |
sakthipriya | 4:8f6c24eca109 | 74 | } |
sakthipriya | 5:255b43e8e21a | 75 | /* if (flag == '0') |
sakthipriya | 4:8f6c24eca109 | 76 | beacon_sc = 30; |
sakthipriya | 4:8f6c24eca109 | 77 | else |
sakthipriya | 4:8f6c24eca109 | 78 | beacon_sc = 3; |
sakthipriya | 5:255b43e8e21a | 79 | if (flag == '3') |
sakthipriya | 5:255b43e8e21a | 80 | acs_pflag = 1; |
sakthipriya | 5:255b43e8e21a | 81 | else |
sakthipriya | 5:255b43e8e21a | 82 | acs_pflag = 0; */ |
sakthipriya | 4:8f6c24eca109 | 83 | } |