Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Committer:
ansond
Date:
Wed Apr 02 05:14:56 2014 +0000
Revision:
149:7fde829ed672
Parent:
130:630d05daed77
Child:
160:24337c83dd1d
updates

Who changed what in which revision?

UserRevisionLine numberNew 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 #include "ErrorHandler.h"
ansond 114:bd38ad417d6a 20 #include "MBEDEndpoint.h"
ansond 0:4c9bfcb3e759 21
ansond 130:630d05daed77 22 #ifdef _ENDPOINT_UBLOX_PLATFORM
ansond 130:630d05daed77 23 // Annunciations
ansond 130:630d05daed77 24 DigitalOut led1(P3_25);
ansond 130:630d05daed77 25 DigitalOut led2(P3_25);
ansond 130:630d05daed77 26 DigitalOut led3(P3_25);
ansond 130:630d05daed77 27 DigitalOut led4(P3_25);
ansond 130:630d05daed77 28
ansond 130:630d05daed77 29 // Multi-color LED support
ansond 130:630d05daed77 30 PwmOut r(D5);
ansond 130:630d05daed77 31 PwmOut g(D9);
ansond 130:630d05daed77 32 PwmOut b(D8);
ansond 130:630d05daed77 33 #endif
ansond 0:4c9bfcb3e759 34
ansond 130:630d05daed77 35 #ifdef _ENDPOINT_NXP_PLATFORM
ansond 130:630d05daed77 36 // Annunciations
ansond 130:630d05daed77 37 DigitalOut led1(LED1);
ansond 130:630d05daed77 38 DigitalOut led2(LED2);
ansond 130:630d05daed77 39 DigitalOut led3(LED3);
ansond 130:630d05daed77 40 DigitalOut led4(LED4);
ansond 130:630d05daed77 41
ansond 130:630d05daed77 42 // Multi-color LED support
ansond 130:630d05daed77 43 PwmOut r(p23);
ansond 130:630d05daed77 44 PwmOut g(p24);
ansond 130:630d05daed77 45 PwmOut b(p25);
ansond 130:630d05daed77 46 #endif
ansond 130:630d05daed77 47
ansond 130:630d05daed77 48 #ifdef _ENDPOINT_FREEDOM_PLATFORM
ansond 130:630d05daed77 49 // Annunciations
ansond 130:630d05daed77 50 DigitalOut led1(LED1);
ansond 130:630d05daed77 51 DigitalOut led2(LED2);
ansond 130:630d05daed77 52 DigitalOut led3(LED3);
ansond 130:630d05daed77 53 DigitalOut led4(LED4);
ansond 130:630d05daed77 54
ansond 130:630d05daed77 55 // Multi-color LED support
ansond 130:630d05daed77 56 PwmOut r(p23);
ansond 130:630d05daed77 57 PwmOut g(p24);
ansond 130:630d05daed77 58 PwmOut b(p25);
ansond 130:630d05daed77 59 #endif
ansond 0:4c9bfcb3e759 60
ansond 71:90bf61bc3727 61 // Memory statistics macro
ansond 114:bd38ad417d6a 62 #define ERROR_HANDLER_MEM_STATS(x) \
ansond 71:90bf61bc3727 63 int s##x=0;\
ansond 71:90bf61bc3727 64 int *h##x = new int [1];\
ansond 149:7fde829ed672 65 if (this->m_pc != NULL) this->m_pc->printf("\r\nMEMORY: stack: 0x%08x heap: 0x%08x avail: %d bytes\r\n", &s##x, h##x, &s##x-h##x);\
ansond 71:90bf61bc3727 66 if (h##x > &s##x)\
ansond 71:90bf61bc3727 67 error("collision\n");\
ansond 71:90bf61bc3727 68 delete [] h##x;\
ansond 71:90bf61bc3727 69 __nop();
ansond 71:90bf61bc3727 70
ansond 71:90bf61bc3727 71 // close down connections
ansond 20:f2dbbd852e08 72 extern void closedown(int code);
ansond 0:4c9bfcb3e759 73
ansond 0:4c9bfcb3e759 74 // default constructor
ansond 130:630d05daed77 75 ErrorHandler::ErrorHandler(Serial *pc,LCDCLASS *lcd) {
ansond 0:4c9bfcb3e759 76 this->m_pc = pc;
ansond 0:4c9bfcb3e759 77 this->m_lcd = lcd;
ansond 114:bd38ad417d6a 78 this->m_status_lcd = false;
ansond 26:791d22d43cb4 79 memset(this->m_message,0,MAX_LOG_MESSAGE+1);
ansond 70:055ebf51f6ad 80 this->m_mutex = NULL;
ansond 70:055ebf51f6ad 81 this->m_close_mutex = NULL;
ansond 70:055ebf51f6ad 82 this->m_led_mutex = NULL;
ansond 83:2f49051d6acf 83 this->m_rgb_mutex = NULL;
ansond 70:055ebf51f6ad 84 #ifdef EH_USE_MUTEXES
ansond 61:6012d61573ea 85 this->m_mutex = new Mutex();
ansond 70:055ebf51f6ad 86 this->m_close_mutex = new Mutex();
ansond 61:6012d61573ea 87 this->m_led_mutex = new Mutex();
ansond 83:2f49051d6acf 88 this->m_rgb_mutex = new Mutex();
ansond 70:055ebf51f6ad 89 #endif
ansond 70:055ebf51f6ad 90 this->releaseMutexes();
ansond 84:4a993dd7c38b 91 this->resetLEDs();
ansond 0:4c9bfcb3e759 92 }
ansond 0:4c9bfcb3e759 93
ansond 0:4c9bfcb3e759 94 // default destructor
ansond 0:4c9bfcb3e759 95 ErrorHandler::~ErrorHandler() {
ansond 70:055ebf51f6ad 96 this->releaseMutexes();
ansond 70:055ebf51f6ad 97 if (this->m_mutex != NULL) delete this->m_mutex;
ansond 70:055ebf51f6ad 98 if (this->m_close_mutex != NULL) delete this->m_close_mutex;
ansond 70:055ebf51f6ad 99 if (this->m_led_mutex != NULL) delete this->m_led_mutex;
ansond 83:2f49051d6acf 100 if (this->m_rgb_mutex != NULL) delete this->m_rgb_mutex;
ansond 70:055ebf51f6ad 101 }
ansond 70:055ebf51f6ad 102
ansond 114:bd38ad417d6a 103 // enable LCD to only show summary status
ansond 114:bd38ad417d6a 104 void ErrorHandler::lcdStatusOnly(bool status_lcd) { this->m_status_lcd = status_lcd; }
ansond 114:bd38ad417d6a 105
ansond 70:055ebf51f6ad 106 // release all mutexes
ansond 70:055ebf51f6ad 107 void ErrorHandler::releaseMutexes() {
ansond 70:055ebf51f6ad 108 if (this->m_mutex != NULL) this->m_mutex->unlock();
ansond 70:055ebf51f6ad 109 if (this->m_close_mutex != NULL) this->m_close_mutex->unlock();
ansond 70:055ebf51f6ad 110 if (this->m_led_mutex != NULL) this->m_led_mutex->unlock();
ansond 83:2f49051d6acf 111 if (this->m_rgb_mutex != NULL) this->m_rgb_mutex->unlock();
ansond 0:4c9bfcb3e759 112 }
ansond 0:4c9bfcb3e759 113
ansond 0:4c9bfcb3e759 114 // log information
ansond 0:4c9bfcb3e759 115 void ErrorHandler::log(const char *format, ...) {
ansond 82:24af66daaf17 116 #ifndef HUSH_LOG
ansond 26:791d22d43cb4 117 memset(this->m_message,0,MAX_LOG_MESSAGE+1);
ansond 0:4c9bfcb3e759 118 va_list args;
ansond 0:4c9bfcb3e759 119 va_start(args, format);
ansond 0:4c9bfcb3e759 120 vsprintf(this->m_message, format, args);
ansond 0:4c9bfcb3e759 121 va_end(args);
ansond 84:4a993dd7c38b 122 if (this->m_mutex != NULL) this->m_mutex->lock();
ansond 149:7fde829ed672 123 if (this->m_pc != NULL) this->m_pc->printf(this->m_message);
ansond 64:7e494186e2ec 124 #ifdef ENABLE_MEMORY_DEBUG
ansond 114:bd38ad417d6a 125 ERROR_HANDLER_MEM_STATS(0);
ansond 64:7e494186e2ec 126 #endif
ansond 149:7fde829ed672 127 if (this->m_pc != NULL) this->m_pc->printf("\r\n");
ansond 114:bd38ad417d6a 128 if (this->m_status_lcd) {
ansond 114:bd38ad417d6a 129 MBEDEndpoint *endpoint = (MBEDEndpoint *)this->m_endpoint;
ansond 114:bd38ad417d6a 130 if (endpoint != NULL) {
ansond 114:bd38ad417d6a 131 this->m_lcd->cls();
ansond 114:bd38ad417d6a 132 this->m_lcd->locate(0,0);
ansond 114:bd38ad417d6a 133 this->m_lcd->printf(endpoint->getLCDStatus());
ansond 114:bd38ad417d6a 134 }
ansond 114:bd38ad417d6a 135 }
ansond 114:bd38ad417d6a 136 else {
ansond 114:bd38ad417d6a 137 this->m_lcd->cls();
ansond 114:bd38ad417d6a 138 this->m_lcd->locate(0,0);
ansond 114:bd38ad417d6a 139 this->m_lcd->printf(this->m_message);
ansond 114:bd38ad417d6a 140 }
ansond 114:bd38ad417d6a 141 if (this->m_mutex != NULL) this->m_mutex->unlock();
ansond 114:bd38ad417d6a 142 #else
ansond 114:bd38ad417d6a 143 if (this->m_mutex != NULL) this->m_mutex->lock();
ansond 114:bd38ad417d6a 144 if (this->m_status_lcd) {
ansond 114:bd38ad417d6a 145 MBEDEndpoint *endpoint = (MBEDEndpoint *)this->m_endpoint;
ansond 114:bd38ad417d6a 146 if (endpoint != NULL) {
ansond 114:bd38ad417d6a 147 this->m_lcd->cls();
ansond 114:bd38ad417d6a 148 this->m_lcd->locate(0,0);
ansond 114:bd38ad417d6a 149 this->m_lcd->printf(endpoint->getLCDStatus());
ansond 114:bd38ad417d6a 150 }
ansond 114:bd38ad417d6a 151 }
ansond 70:055ebf51f6ad 152 if (this->m_mutex != NULL) this->m_mutex->unlock();
ansond 82:24af66daaf17 153 #endif
ansond 0:4c9bfcb3e759 154 }
ansond 0:4c9bfcb3e759 155
ansond 74:b60149dd669e 156 // log information
ansond 74:b60149dd669e 157 void ErrorHandler::log_memory(const char *format, ...) {
ansond 82:24af66daaf17 158 #ifndef HUSH_LOG
ansond 74:b60149dd669e 159 #ifdef MEMORY_LOGGING
ansond 74:b60149dd669e 160 memset(this->m_message,0,MAX_LOG_MESSAGE+1);
ansond 74:b60149dd669e 161 va_list args;
ansond 74:b60149dd669e 162 va_start(args, format);
ansond 74:b60149dd669e 163 vsprintf(this->m_message, format, args);
ansond 74:b60149dd669e 164 va_end(args);
ansond 84:4a993dd7c38b 165 if (this->m_mutex != NULL) this->m_mutex->lock();
ansond 149:7fde829ed672 166 if (this->m_pc != NULL) this->m_pc->printf(this->m_message);
ansond 114:bd38ad417d6a 167 ERROR_HANDLER_MEM_STATS(0);
ansond 74:b60149dd669e 168 if (this->m_mutex != NULL) this->m_mutex->unlock();
ansond 74:b60149dd669e 169 #endif
ansond 82:24af66daaf17 170 #endif
ansond 74:b60149dd669e 171 }
ansond 74:b60149dd669e 172
ansond 15:386dccd0000a 173 // pause
ansond 15:386dccd0000a 174 void ErrorHandler::pause(const char *format, ...) {
ansond 82:24af66daaf17 175 #ifndef HUSH_LOG
ansond 26:791d22d43cb4 176 memset(this->m_message,0,MAX_LOG_MESSAGE+1);
ansond 15:386dccd0000a 177 va_list args;
ansond 15:386dccd0000a 178 va_start(args, format);
ansond 15:386dccd0000a 179 vsprintf(this->m_message, format, args);
ansond 15:386dccd0000a 180 va_end(args);
ansond 84:4a993dd7c38b 181 if (this->m_mutex != NULL) this->m_mutex->lock();
ansond 149:7fde829ed672 182 if (this->m_pc != NULL) this->m_pc->printf(this->m_message);
ansond 149:7fde829ed672 183 if (this->m_pc != NULL) this->m_pc->printf("\r\n");
ansond 15:386dccd0000a 184 this->m_lcd->cls();
ansond 15:386dccd0000a 185 this->m_lcd->locate(0,0);
ansond 15:386dccd0000a 186 this->m_lcd->printf(this->m_message);
ansond 149:7fde829ed672 187 if (this->m_pc != NULL) {
ansond 149:7fde829ed672 188 this->m_pc->printf("Press any key to continue...ctrl-c to stop\r\n");
ansond 149:7fde829ed672 189 char c = this->m_pc->getc();
ansond 149:7fde829ed672 190 if (c == 0x03) { // CTRL-C ASCII
ansond 16:fda7dbb8b47a 191 this->m_pc->printf("ctrl-c: closing down...\r\n");
ansond 84:4a993dd7c38b 192 if (this->m_mutex != NULL) this->m_mutex->unlock();
ansond 149:7fde829ed672 193 closedown(1);
ansond 149:7fde829ed672 194 }
ansond 16:fda7dbb8b47a 195 }
ansond 70:055ebf51f6ad 196 if (this->m_mutex != NULL) this->m_mutex->unlock();
ansond 82:24af66daaf17 197 #endif
ansond 15:386dccd0000a 198 }
ansond 15:386dccd0000a 199
ansond 0:4c9bfcb3e759 200 // check for exit
ansond 15:386dccd0000a 201 void ErrorHandler::checkForExit() {
ansond 70:055ebf51f6ad 202 if (this->m_close_mutex != NULL) this->m_close_mutex->lock();
ansond 149:7fde829ed672 203 if (this->m_pc != NULL && this->m_pc->readable()) {
ansond 0:4c9bfcb3e759 204 char c = this->m_pc->getc();
ansond 0:4c9bfcb3e759 205 if (c == 0x03) { // CTRL-C ASCII
ansond 0:4c9bfcb3e759 206 this->m_pc->printf("ctrl-c: closing down...\r\n");
ansond 20:f2dbbd852e08 207 closedown(1);
ansond 0:4c9bfcb3e759 208 }
ansond 0:4c9bfcb3e759 209 }
ansond 70:055ebf51f6ad 210 if (this->m_close_mutex != NULL) this->m_close_mutex->unlock();
ansond 0:4c9bfcb3e759 211 }
ansond 0:4c9bfcb3e759 212
ansond 0:4c9bfcb3e759 213 // set the color LED
ansond 0:4c9bfcb3e759 214 void ErrorHandler::setRGBLED(float H, float S, float V) {
ansond 82:24af66daaf17 215 #ifndef HUSH_LEDS
ansond 83:2f49051d6acf 216 if (this->m_rgb_mutex != NULL) this->m_rgb_mutex->lock();
ansond 0:4c9bfcb3e759 217 float f,h,p,q,t;
ansond 0:4c9bfcb3e759 218 int i;
ansond 0:4c9bfcb3e759 219 if( S == 0.0) {
ansond 0:4c9bfcb3e759 220 r = 1.0 - V; // invert pwm !
ansond 0:4c9bfcb3e759 221 g = 1.0 - V;
ansond 0:4c9bfcb3e759 222 b = 1.0 - V;
ansond 0:4c9bfcb3e759 223 return;
ansond 0:4c9bfcb3e759 224 }
ansond 0:4c9bfcb3e759 225 if(H > 360.0) H = 0.0; // check values
ansond 0:4c9bfcb3e759 226 if(S > 1.0) S = 1.0;
ansond 0:4c9bfcb3e759 227 if(S < 0.0) S = 0.0;
ansond 0:4c9bfcb3e759 228 if(V > 1.0) V = 1.0;
ansond 0:4c9bfcb3e759 229 if(V < 0.0) V = 0.0;
ansond 0:4c9bfcb3e759 230 h = H / 60.0;
ansond 0:4c9bfcb3e759 231 i = (int) h;
ansond 0:4c9bfcb3e759 232 f = h - i;
ansond 0:4c9bfcb3e759 233 p = V * (1.0 - S);
ansond 0:4c9bfcb3e759 234 q = V * (1.0 - (S * f));
ansond 0:4c9bfcb3e759 235 t = V * (1.0 - (S * (1.0 - f)));
ansond 0:4c9bfcb3e759 236
ansond 0:4c9bfcb3e759 237 switch(i) {
ansond 0:4c9bfcb3e759 238 case 0:
ansond 0:4c9bfcb3e759 239 r = 1.0 - V; // invert pwm !
ansond 0:4c9bfcb3e759 240 g = 1.0 - t;
ansond 0:4c9bfcb3e759 241 b = 1.0 - p;
ansond 0:4c9bfcb3e759 242 break;
ansond 0:4c9bfcb3e759 243 case 1:
ansond 0:4c9bfcb3e759 244 r = 1.0 - q;
ansond 0:4c9bfcb3e759 245 g = 1.0 - V;
ansond 0:4c9bfcb3e759 246 b = 1.0 - p;
ansond 0:4c9bfcb3e759 247 break;
ansond 0:4c9bfcb3e759 248 case 2:
ansond 0:4c9bfcb3e759 249 r = 1.0 - p;
ansond 0:4c9bfcb3e759 250 g = 1.0 - V;
ansond 0:4c9bfcb3e759 251 b = 1.0 - t;
ansond 0:4c9bfcb3e759 252 break;
ansond 0:4c9bfcb3e759 253 case 3:
ansond 0:4c9bfcb3e759 254 r = 1.0 - p;
ansond 0:4c9bfcb3e759 255 g = 1.0 - q;
ansond 0:4c9bfcb3e759 256 b = 1.0 - V;
ansond 0:4c9bfcb3e759 257 break;
ansond 0:4c9bfcb3e759 258 case 4:
ansond 0:4c9bfcb3e759 259 r = 1.0 - t;
ansond 0:4c9bfcb3e759 260 g = 1.0 - p;
ansond 0:4c9bfcb3e759 261 b = 1.0 - V;
ansond 0:4c9bfcb3e759 262 break;
ansond 0:4c9bfcb3e759 263 case 5:
ansond 0:4c9bfcb3e759 264 default:
ansond 0:4c9bfcb3e759 265 r = 1.0 - V;
ansond 0:4c9bfcb3e759 266 g = 1.0 - p;
ansond 0:4c9bfcb3e759 267 b = 1.0 - q;
ansond 0:4c9bfcb3e759 268 break;
ansond 0:4c9bfcb3e759 269 }
ansond 83:2f49051d6acf 270 if (this->m_rgb_mutex != NULL) this->m_rgb_mutex->unlock();
ansond 82:24af66daaf17 271 #endif
ansond 0:4c9bfcb3e759 272 }
ansond 0:4c9bfcb3e759 273
ansond 0:4c9bfcb3e759 274 // turn the RGB LED specific colors
ansond 0:4c9bfcb3e759 275 void ErrorHandler::turnLEDRed() { this->setRGBLED(0.0,1.0,0.2); }
ansond 0:4c9bfcb3e759 276 void ErrorHandler::turnLEDGreen() { this->setRGBLED(120.0,1.0,0.2); }
ansond 0:4c9bfcb3e759 277 void ErrorHandler::turnLEDBlue() { this->setRGBLED(200.0,1.0,0.2); }
ansond 114:bd38ad417d6a 278 void ErrorHandler::turnLEDPurple() { this->setRGBLED(261.9,1.0,0.2); }
ansond 114:bd38ad417d6a 279 void ErrorHandler::turnLEDOrange() { this->setRGBLED(51.0,1.0,0.2); }
ansond 0:4c9bfcb3e759 280 void ErrorHandler::turnLEDBlack() { this->setRGBLED(0,0,0); }
ansond 0:4c9bfcb3e759 281 void ErrorHandler::turnLEDYellow() { this->setRGBLED(60.0,1.0,0.133); }
ansond 0:4c9bfcb3e759 282
ansond 0:4c9bfcb3e759 283 // reset LEDs
ansond 0:4c9bfcb3e759 284 void ErrorHandler::resetLEDs() {
ansond 82:24af66daaf17 285 #ifndef HUSH_LEDS
ansond 0:4c9bfcb3e759 286 // turn off all LEDs
ansond 0:4c9bfcb3e759 287 led1 = 0; led2 = 0; led3 = 0; led4 = 0;
ansond 82:24af66daaf17 288 #endif
ansond 0:4c9bfcb3e759 289 }
ansond 0:4c9bfcb3e759 290
ansond 0:4c9bfcb3e759 291 // blink an LED
ansond 0:4c9bfcb3e759 292 void ErrorHandler::blinkLED(DigitalOut led) {
ansond 82:24af66daaf17 293 #ifndef HUSH_LEDS
ansond 84:4a993dd7c38b 294 if (this->m_led_mutex != NULL) this->m_led_mutex->lock();
ansond 0:4c9bfcb3e759 295 led = 1;
ansond 84:4a993dd7c38b 296 if (this->m_led_mutex != NULL) this->m_led_mutex->unlock();
ansond 0:4c9bfcb3e759 297 wait_ms(BLINK_TIME);
ansond 84:4a993dd7c38b 298 if (this->m_led_mutex != NULL) this->m_led_mutex->lock();
ansond 0:4c9bfcb3e759 299 led = 0;
ansond 84:4a993dd7c38b 300 if (this->m_led_mutex != NULL) this->m_led_mutex->unlock();
ansond 82:24af66daaf17 301 #endif
ansond 0:4c9bfcb3e759 302 }
ansond 0:4c9bfcb3e759 303
ansond 84:4a993dd7c38b 304 void ErrorHandler::changeLED(DigitalOut led,bool onoff) {
ansond 84:4a993dd7c38b 305 if (this->m_led_mutex != NULL) this->m_led_mutex->lock();
ansond 84:4a993dd7c38b 306 if (onoff) led = 1;
ansond 84:4a993dd7c38b 307 else led = 0;
ansond 84:4a993dd7c38b 308 if (this->m_led_mutex != NULL) this->m_led_mutex->unlock();
ansond 84:4a993dd7c38b 309 }
ansond 84:4a993dd7c38b 310
ansond 84:4a993dd7c38b 311 void ErrorHandler::led2On() { this->changeLED(led2,true); }
ansond 84:4a993dd7c38b 312 void ErrorHandler::led2Off() { this->changeLED(led2,false); }
ansond 84:4a993dd7c38b 313 void ErrorHandler::led3On() { this->changeLED(led3,true); }
ansond 84:4a993dd7c38b 314 void ErrorHandler::led3Off() { this->changeLED(led3,false); }
ansond 84:4a993dd7c38b 315
ansond 112:1fb53d4729af 316 void ErrorHandler::setEndpoint(void *endpoint) { this->m_endpoint = endpoint; }
ansond 112:1fb53d4729af 317 void *ErrorHandler::getEndpoint() { return this->m_endpoint; }
ansond 112:1fb53d4729af 318
ansond 36:73e343ddca7f 319 // blink the Transport TX LED
ansond 36:73e343ddca7f 320 void ErrorHandler::blinkTransportTxLED() { this->blinkLED(led4); }
ansond 0:4c9bfcb3e759 321
ansond 36:73e343ddca7f 322 // blink the Transport RX LED
ansond 36:73e343ddca7f 323 void ErrorHandler::blinkTransportRxLED() { this->blinkLED(led1); }