Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
ErrorHandler.h@61:6012d61573ea, 2014-03-03 (annotated)
- Committer:
- ansond
- Date:
- Mon Mar 03 05:07:19 2014 +0000
- Revision:
- 61:6012d61573ea
- Parent:
- 36:73e343ddca7f
- Child:
- 68:e6431dfe2f30
updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:4c9bfcb3e759 | 1 | /* Copyright C2013 Doug Anson, MIT License |
ansond | 0:4c9bfcb3e759 | 2 | * |
ansond | 0:4c9bfcb3e759 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 0:4c9bfcb3e759 | 4 | * and associated documentation files the "Software", to deal in the Software without restriction, |
ansond | 0:4c9bfcb3e759 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 0:4c9bfcb3e759 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 0:4c9bfcb3e759 | 7 | * furnished to do so, subject to the following conditions: |
ansond | 0:4c9bfcb3e759 | 8 | * |
ansond | 0:4c9bfcb3e759 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 0:4c9bfcb3e759 | 10 | * substantial portions of the Software. |
ansond | 0:4c9bfcb3e759 | 11 | * |
ansond | 0:4c9bfcb3e759 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 0:4c9bfcb3e759 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 0:4c9bfcb3e759 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 0:4c9bfcb3e759 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 0:4c9bfcb3e759 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 0:4c9bfcb3e759 | 17 | */ |
ansond | 0:4c9bfcb3e759 | 18 | |
ansond | 0:4c9bfcb3e759 | 19 | #ifndef _ERROR_HANDLER_H_ |
ansond | 0:4c9bfcb3e759 | 20 | #define _ERROR_HANDLER_H_ |
ansond | 0:4c9bfcb3e759 | 21 | |
ansond | 0:4c9bfcb3e759 | 22 | // Tunables |
ansond | 0:4c9bfcb3e759 | 23 | #include "Definitions.h" |
ansond | 0:4c9bfcb3e759 | 24 | |
ansond | 0:4c9bfcb3e759 | 25 | // Support for std args |
ansond | 0:4c9bfcb3e759 | 26 | #include <stdarg.h> |
ansond | 0:4c9bfcb3e759 | 27 | |
ansond | 0:4c9bfcb3e759 | 28 | // PC Console Support |
ansond | 0:4c9bfcb3e759 | 29 | #include "MODSERIAL.h" |
ansond | 0:4c9bfcb3e759 | 30 | |
ansond | 0:4c9bfcb3e759 | 31 | // LCD Support |
ansond | 61:6012d61573ea | 32 | #include "C12832_lcd.h" |
ansond | 61:6012d61573ea | 33 | |
ansond | 61:6012d61573ea | 34 | // Mutex support |
ansond | 61:6012d61573ea | 35 | #include "rtos.h" |
ansond | 0:4c9bfcb3e759 | 36 | |
ansond | 0:4c9bfcb3e759 | 37 | class ErrorHandler { |
ansond | 0:4c9bfcb3e759 | 38 | private: |
ansond | 0:4c9bfcb3e759 | 39 | MODSERIAL *m_pc; |
ansond | 0:4c9bfcb3e759 | 40 | C12832_LCD *m_lcd; |
ansond | 0:4c9bfcb3e759 | 41 | char m_message[MAX_LOG_MESSAGE+1]; |
ansond | 61:6012d61573ea | 42 | Mutex *m_mutex; |
ansond | 61:6012d61573ea | 43 | Mutex *m_led_mutex; |
ansond | 0:4c9bfcb3e759 | 44 | |
ansond | 0:4c9bfcb3e759 | 45 | public: |
ansond | 0:4c9bfcb3e759 | 46 | ErrorHandler(MODSERIAL *pc,C12832_LCD *lcd); |
ansond | 0:4c9bfcb3e759 | 47 | ~ErrorHandler(); |
ansond | 0:4c9bfcb3e759 | 48 | |
ansond | 0:4c9bfcb3e759 | 49 | void log(const char *format, ...); |
ansond | 0:4c9bfcb3e759 | 50 | void checkForExit(); |
ansond | 0:4c9bfcb3e759 | 51 | |
ansond | 15:386dccd0000a | 52 | void pause(const char *format, ...); |
ansond | 15:386dccd0000a | 53 | |
ansond | 0:4c9bfcb3e759 | 54 | void turnLEDRed(); |
ansond | 0:4c9bfcb3e759 | 55 | void turnLEDGreen(); |
ansond | 0:4c9bfcb3e759 | 56 | void turnLEDBlue(); |
ansond | 0:4c9bfcb3e759 | 57 | void turnLEDBlack(); |
ansond | 0:4c9bfcb3e759 | 58 | void turnLEDYellow(); |
ansond | 0:4c9bfcb3e759 | 59 | |
ansond | 36:73e343ddca7f | 60 | void blinkTransportTxLED(); |
ansond | 36:73e343ddca7f | 61 | void blinkTransportRxLED(); |
ansond | 36:73e343ddca7f | 62 | |
ansond | 0:4c9bfcb3e759 | 63 | private: |
ansond | 0:4c9bfcb3e759 | 64 | void setRGBLED(float H, float S, float V); |
ansond | 0:4c9bfcb3e759 | 65 | void blinkLED(DigitalOut led); |
ansond | 0:4c9bfcb3e759 | 66 | void resetLEDs(); |
ansond | 0:4c9bfcb3e759 | 67 | }; |
ansond | 0:4c9bfcb3e759 | 68 | |
ansond | 0:4c9bfcb3e759 | 69 | #endif // _ERROR_HANDLER_H_ |