sakthi priya amirtharaj
/
BAE_FRDM_i2c
slave integrated
Fork of BAE_FRDMTESIN2 by
fault.cpp@4:8f6c24eca109, 2014-12-03 (annotated)
- Committer:
- sakthipriya
- Date:
- Wed Dec 03 11:23:37 2014 +0000
- Revision:
- 4:8f6c24eca109
- Parent:
- 3:02b45de29c0f
- Child:
- 5:255b43e8e21a
fault and power added
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 | 2:80b8a2e999f7 | 24 | |
sakthipriya | 2:80b8a2e999f7 | 25 | BusOut clear(FAULT_CLEAR1,FAULT_CLEAR2,FAULT_CLEAR3,FAULT_CLEAR4,FAULT_CLEAR5,FAULT_CLEAR6,FAULT_CLEAR7,FAULT_CLEAR8); |
sakthipriya | 4:8f6c24eca109 | 26 | BusOut MODE(ACS,TX,PAYLOAD); |
sakthipriya | 3:02b45de29c0f | 27 | extern SensorData Sensor; |
sakthipriya | 4:8f6c24eca109 | 28 | //char flag; |
sakthipriya | 4:8f6c24eca109 | 29 | extern beacon_sc; |
sakthipriya | 4:8f6c24eca109 | 30 | |
sakthipriya | 2:80b8a2e999f7 | 31 | |
sakthipriya | 2:80b8a2e999f7 | 32 | void FAULTS() |
sakthipriya | 2:80b8a2e999f7 | 33 | { |
sakthipriya | 2:80b8a2e999f7 | 34 | |
sakthipriya | 2:80b8a2e999f7 | 35 | printf("Entered Fault management \n"); |
sakthipriya | 2:80b8a2e999f7 | 36 | clear1 = !fault1; |
sakthipriya | 2:80b8a2e999f7 | 37 | clear2 = !fault2; |
sakthipriya | 2:80b8a2e999f7 | 38 | clear3 = !fault3; |
sakthipriya | 2:80b8a2e999f7 | 39 | clear4 = !fault4; |
sakthipriya | 2:80b8a2e999f7 | 40 | clear5 = !fault5; |
sakthipriya | 2:80b8a2e999f7 | 41 | clear6 = !fault6; |
sakthipriya | 2:80b8a2e999f7 | 42 | clear7 = !fault7; |
sakthipriya | 2:80b8a2e999f7 | 43 | clear8 = !fault8; |
sakthipriya | 3:02b45de29c0f | 44 | Sensor.fault = clear; |
sakthipriya | 3:02b45de29c0f | 45 | printf(" %d \n",Sensor.fault); |
sakthipriya | 2:80b8a2e999f7 | 46 | |
sakthipriya | 4:8f6c24eca109 | 47 | } |
sakthipriya | 4:8f6c24eca109 | 48 | |
sakthipriya | 4:8f6c24eca109 | 49 | void POWER(char flag) |
sakthipriya | 4:8f6c24eca109 | 50 | { |
sakthipriya | 4:8f6c24eca109 | 51 | printf("Entered Power Management \n"); |
sakthipriya | 4:8f6c24eca109 | 52 | printf("Entering mode %c \n", flag); |
sakthipriya | 4:8f6c24eca109 | 53 | switch (flag) |
sakthipriya | 4:8f6c24eca109 | 54 | { |
sakthipriya | 4:8f6c24eca109 | 55 | case '1': ACTIVE = 7; |
sakthipriya | 4:8f6c24eca109 | 56 | break; |
sakthipriya | 4:8f6c24eca109 | 57 | case '2': ACTIVE = 6; |
sakthipriya | 4:8f6c24eca109 | 58 | break; |
sakthipriya | 4:8f6c24eca109 | 59 | case '3': ACTIVE = 5; |
sakthipriya | 4:8f6c24eca109 | 60 | break; |
sakthipriya | 4:8f6c24eca109 | 61 | case '4': ACTIVE = 4; |
sakthipriya | 4:8f6c24eca109 | 62 | break; |
sakthipriya | 4:8f6c24eca109 | 63 | case '5': ACTIVE = 2; |
sakthipriya | 4:8f6c24eca109 | 64 | break; |
sakthipriya | 4:8f6c24eca109 | 65 | case '6': ACTIVE = 0; |
sakthipriya | 4:8f6c24eca109 | 66 | break; |
sakthipriya | 4:8f6c24eca109 | 67 | case '7': ACTIVE = 0; |
sakthipriya | 4:8f6c24eca109 | 68 | break; |
sakthipriya | 4:8f6c24eca109 | 69 | } |
sakthipriya | 4:8f6c24eca109 | 70 | if (flag == 7) |
sakthipriya | 4:8f6c24eca109 | 71 | beacon_sc = 30; |
sakthipriya | 4:8f6c24eca109 | 72 | else |
sakthipriya | 4:8f6c24eca109 | 73 | beacon_sc = 3; |
sakthipriya | 4:8f6c24eca109 | 74 | } |