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
Diff: ErrorHandler.cpp
- Revision:
- 83:2f49051d6acf
- Parent:
- 82:24af66daaf17
- Child:
- 84:4a993dd7c38b
diff -r 24af66daaf17 -r 2f49051d6acf ErrorHandler.cpp --- a/ErrorHandler.cpp Tue Mar 11 20:31:35 2014 +0000 +++ b/ErrorHandler.cpp Tue Mar 11 20:42:29 2014 +0000 @@ -51,10 +51,12 @@ this->m_mutex = NULL; this->m_close_mutex = NULL; this->m_led_mutex = NULL; + this->m_rgb_mutex = NULL; #ifdef EH_USE_MUTEXES this->m_mutex = new Mutex(); this->m_close_mutex = new Mutex(); this->m_led_mutex = new Mutex(); + this->m_rgb_mutex = new Mutex(); #endif this->releaseMutexes(); } @@ -65,6 +67,7 @@ if (this->m_mutex != NULL) delete this->m_mutex; if (this->m_close_mutex != NULL) delete this->m_close_mutex; if (this->m_led_mutex != NULL) delete this->m_led_mutex; + if (this->m_rgb_mutex != NULL) delete this->m_rgb_mutex; } // release all mutexes @@ -72,6 +75,7 @@ if (this->m_mutex != NULL) this->m_mutex->unlock(); if (this->m_close_mutex != NULL) this->m_close_mutex->unlock(); if (this->m_led_mutex != NULL) this->m_led_mutex->unlock(); + if (this->m_rgb_mutex != NULL) this->m_rgb_mutex->unlock(); } // log information @@ -153,6 +157,7 @@ // set the color LED void ErrorHandler::setRGBLED(float H, float S, float V) { #ifndef HUSH_LEDS + if (this->m_rgb_mutex != NULL) this->m_rgb_mutex->lock(); float f,h,p,q,t; int i; if( S == 0.0) { @@ -206,6 +211,7 @@ b = 1.0 - q; break; } + if (this->m_rgb_mutex != NULL) this->m_rgb_mutex->unlock(); #endif } @@ -228,8 +234,10 @@ // reset LEDs void ErrorHandler::resetLEDs() { #ifndef HUSH_LEDS + if (this->m_led_mutex != NULL) this->m_led_mutex->lock(); // turn off all LEDs led1 = 0; led2 = 0; led3 = 0; led4 = 0; + if (this->m_led_mutex != NULL) this->m_led_mutex->unlock(); #endif }