Logging facility for endpoints

Fork of ErrorHandler by Doug Anson

Committer:
ansond
Date:
Fri Aug 29 03:39:04 2014 +0000
Revision:
1:8d42444464d3
Parent:
0:906788c5813d
Child:
2:e771ffdf5c1b
updates

Who changed what in which revision?

UserRevisionLine numberNew 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 0:906788c5813d 39 class ErrorHandler {
ansond 0:906788c5813d 40 private:
ansond 0:906788c5813d 41 Serial *m_pc;
ansond 0:906788c5813d 42 LCDCLASS *m_lcd;
ansond 0:906788c5813d 43 char m_message[MAX_LOG_MESSAGE+1];
ansond 0:906788c5813d 44
ansond 0:906788c5813d 45 public:
ansond 0:906788c5813d 46 ErrorHandler(Serial *pc,LCDCLASS *lcd);
ansond 0:906788c5813d 47 virtual ~ErrorHandler();
ansond 0:906788c5813d 48
ansond 0:906788c5813d 49 void log(const char *format, ...);
ansond 0:906788c5813d 50
ansond 0:906788c5813d 51 void turnLEDRed();
ansond 0:906788c5813d 52 void turnLEDGreen();
ansond 0:906788c5813d 53 void turnLEDBlue();
ansond 0:906788c5813d 54 void turnLEDPurple();
ansond 0:906788c5813d 55 void turnLEDBlack();
ansond 0:906788c5813d 56 void turnLEDYellow();
ansond 0:906788c5813d 57 void turnLEDOrange();
ansond 0:906788c5813d 58
ansond 1:8d42444464d3 59 void blinkTransportTxLED();
ansond 1:8d42444464d3 60 void blinkTransportRxLED();
ansond 1:8d42444464d3 61
ansond 0:906788c5813d 62 private:
ansond 0:906788c5813d 63 void setRGBLED(float H, float S, float V);
ansond 1:8d42444464d3 64 void blinkLED(DigitalOut led);
ansond 0:906788c5813d 65 };
ansond 0:906788c5813d 66
ansond 0:906788c5813d 67 #endif // _ERROR_HANDLER_H_