Logging facility for endpoints
Fork of ErrorHandler by
ErrorHandler.h@2:e771ffdf5c1b, 2014-08-29 (annotated)
- Committer:
- ansond
- Date:
- Fri Aug 29 19:23:45 2014 +0000
- Revision:
- 2:e771ffdf5c1b
- Parent:
- 1:8d42444464d3
- Child:
- 5:7b3bbd74c1b1
updates for K64F support
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:906788c5813d | 1 | /* Copyright C2014 ARM, MIT License |
ansond | 0:906788c5813d | 2 | * |
ansond | 0:906788c5813d | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 0:906788c5813d | 4 | * and associated documentation files the "Software", to deal in the Software without restriction, |
ansond | 0:906788c5813d | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 0:906788c5813d | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 0:906788c5813d | 7 | * furnished to do so, subject to the following conditions: |
ansond | 0:906788c5813d | 8 | * |
ansond | 0:906788c5813d | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 0:906788c5813d | 10 | * substantial portions of the Software. |
ansond | 0:906788c5813d | 11 | * |
ansond | 0:906788c5813d | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 0:906788c5813d | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 0:906788c5813d | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 0:906788c5813d | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 0:906788c5813d | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 0:906788c5813d | 17 | */ |
ansond | 0:906788c5813d | 18 | |
ansond | 0:906788c5813d | 19 | #ifndef _ERROR_HANDLER_H_ |
ansond | 0:906788c5813d | 20 | #define _ERROR_HANDLER_H_ |
ansond | 0:906788c5813d | 21 | |
ansond | 0:906788c5813d | 22 | // our definitions |
ansond | 0:906788c5813d | 23 | #include "Definitions.h" |
ansond | 0:906788c5813d | 24 | |
ansond | 0:906788c5813d | 25 | // Support for varargs |
ansond | 0:906788c5813d | 26 | #include <stdarg.h> |
ansond | 0:906788c5813d | 27 | |
ansond | 0:906788c5813d | 28 | // LCD Support |
ansond | 0:906788c5813d | 29 | #if _UBLOX_PLATFORM |
ansond | 0:906788c5813d | 30 | #include "C12832.h" |
ansond | 0:906788c5813d | 31 | #define LCDCLASS C12832 |
ansond | 0:906788c5813d | 32 | #endif |
ansond | 0:906788c5813d | 33 | |
ansond | 0:906788c5813d | 34 | #if _NXP_PLATFORM |
ansond | 0:906788c5813d | 35 | #include "C12832_lcd.h" |
ansond | 0:906788c5813d | 36 | #define LCDCLASS C12832_LCD |
ansond | 0:906788c5813d | 37 | #endif |
ansond | 1:8d42444464d3 | 38 | |
ansond | 2:e771ffdf5c1b | 39 | #if _K64F_PLATFORM |
ansond | 2:e771ffdf5c1b | 40 | #define LCDCLASS void // not used |
ansond | 2:e771ffdf5c1b | 41 | #endif |
ansond | 2:e771ffdf5c1b | 42 | |
ansond | 0:906788c5813d | 43 | class ErrorHandler { |
ansond | 0:906788c5813d | 44 | private: |
ansond | 0:906788c5813d | 45 | Serial *m_pc; |
ansond | 0:906788c5813d | 46 | LCDCLASS *m_lcd; |
ansond | 0:906788c5813d | 47 | char m_message[MAX_LOG_MESSAGE+1]; |
ansond | 0:906788c5813d | 48 | |
ansond | 0:906788c5813d | 49 | public: |
ansond | 0:906788c5813d | 50 | ErrorHandler(Serial *pc,LCDCLASS *lcd); |
ansond | 0:906788c5813d | 51 | virtual ~ErrorHandler(); |
ansond | 0:906788c5813d | 52 | |
ansond | 0:906788c5813d | 53 | void log(const char *format, ...); |
ansond | 0:906788c5813d | 54 | |
ansond | 0:906788c5813d | 55 | void turnLEDRed(); |
ansond | 0:906788c5813d | 56 | void turnLEDGreen(); |
ansond | 0:906788c5813d | 57 | void turnLEDBlue(); |
ansond | 0:906788c5813d | 58 | void turnLEDPurple(); |
ansond | 0:906788c5813d | 59 | void turnLEDBlack(); |
ansond | 0:906788c5813d | 60 | void turnLEDYellow(); |
ansond | 0:906788c5813d | 61 | void turnLEDOrange(); |
ansond | 0:906788c5813d | 62 | |
ansond | 1:8d42444464d3 | 63 | void blinkTransportTxLED(); |
ansond | 1:8d42444464d3 | 64 | void blinkTransportRxLED(); |
ansond | 1:8d42444464d3 | 65 | |
ansond | 0:906788c5813d | 66 | private: |
ansond | 0:906788c5813d | 67 | void setRGBLED(float H, float S, float V); |
ansond | 1:8d42444464d3 | 68 | void blinkLED(DigitalOut led); |
ansond | 0:906788c5813d | 69 | }; |
ansond | 0:906788c5813d | 70 | |
ansond | 0:906788c5813d | 71 | #endif // _ERROR_HANDLER_H_ |