System Management code
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Libs/LatchMonitor/LatchMonitor.h@36:0afc0fc8f86b, 2015-01-22 (annotated)
- Committer:
- pspatel321
- Date:
- Thu Jan 22 07:58:51 2015 +0000
- Revision:
- 36:0afc0fc8f86b
- Parent:
- 30:91af74a299e1
- Child:
- 38:8efacce315ae
Tested in car with other systems. Most features are good to go. Except xbees need work. The DC-DC protection features were giving problems due to spurious current measurements. They have been edited to reduce glitchy errors.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pspatel321 | 30:91af74a299e1 | 1 | #ifndef __LATCH_MONITOR_H |
pspatel321 | 30:91af74a299e1 | 2 | #define __LATCH_MONITOR_H |
pspatel321 | 30:91af74a299e1 | 3 | |
pspatel321 | 30:91af74a299e1 | 4 | #include "mbed.h" |
pspatel321 | 30:91af74a299e1 | 5 | |
pspatel321 | 30:91af74a299e1 | 6 | enum LatchMon_Status_Bits { |
pspatel321 | 30:91af74a299e1 | 7 | okPinF=1, |
pspatel321 | 30:91af74a299e1 | 8 | faultPinF=2, |
pspatel321 | 30:91af74a299e1 | 9 | softwareF=4, |
pspatel321 | 30:91af74a299e1 | 10 | hardwareF=8, |
pspatel321 | 30:91af74a299e1 | 11 | }; |
pspatel321 | 30:91af74a299e1 | 12 | |
pspatel321 | 30:91af74a299e1 | 13 | class LatchMonitor { |
pspatel321 | 30:91af74a299e1 | 14 | |
pspatel321 | 30:91af74a299e1 | 15 | public: |
pspatel321 | 30:91af74a299e1 | 16 | // Make this startup delay longer than the actual hardware circuit delay so that it can catch errors in the circuit |
pspatel321 | 36:0afc0fc8f86b | 17 | LatchMonitor(PinName _ok, PinName _fault, unsigned int startupDelay_ms); |
pspatel321 | 30:91af74a299e1 | 18 | /* |
pspatel321 | 30:91af74a299e1 | 19 | char update() returns status encoded in a char |
pspatel321 | 30:91af74a299e1 | 20 | bit0 = okPinFault - equals 1 when the OK pin from the monitored device is LOW indicating device fault |
pspatel321 | 30:91af74a299e1 | 21 | bit1 = faultPinFault - equals 1 when the sys. mgmt. latch circuit is faulted with startup timer in hardware |
pspatel321 | 30:91af74a299e1 | 22 | bit2 = softwareFault - equals 1 when the LatchMonitor fault occurs with startup timer in software |
pspatel321 | 30:91af74a299e1 | 23 | bit3 = hardwareFault - the circuit is supposed to signal fault on the hardware pin but its not doing so! |
pspatel321 | 30:91af74a299e1 | 24 | */ |
pspatel321 | 30:91af74a299e1 | 25 | char update(); |
pspatel321 | 30:91af74a299e1 | 26 | private: |
pspatel321 | 30:91af74a299e1 | 27 | Timeout startup; |
pspatel321 | 30:91af74a299e1 | 28 | void startupDelay(); |
pspatel321 | 30:91af74a299e1 | 29 | bool started; |
pspatel321 | 36:0afc0fc8f86b | 30 | DigitalIn okPin; |
pspatel321 | 36:0afc0fc8f86b | 31 | DigitalIn faultPin; |
pspatel321 | 30:91af74a299e1 | 32 | }; |
pspatel321 | 30:91af74a299e1 | 33 | |
pspatel321 | 30:91af74a299e1 | 34 | #endif |