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

Revision:
82:24af66daaf17
Parent:
74:b60149dd669e
Child:
83:2f49051d6acf
--- a/ErrorHandler.cpp	Tue Mar 11 15:47:41 2014 +0000
+++ b/ErrorHandler.cpp	Tue Mar 11 20:31:35 2014 +0000
@@ -76,6 +76,7 @@
  
  // log information
  void ErrorHandler::log(const char *format, ...) {
+#ifndef HUSH_LOG
     if (this->m_mutex != NULL) this->m_mutex->lock();
     memset(this->m_message,0,MAX_LOG_MESSAGE+1);
     va_list args;
@@ -91,10 +92,12 @@
     this->m_lcd->locate(0,0);
     this->m_lcd->printf(this->m_message);
     if (this->m_mutex != NULL) this->m_mutex->unlock();
+#endif
  }
  
  // log information
  void ErrorHandler::log_memory(const char *format, ...) {
+ #ifndef HUSH_LOG
  #ifdef MEMORY_LOGGING
     if (this->m_mutex != NULL) this->m_mutex->lock();
     memset(this->m_message,0,MAX_LOG_MESSAGE+1);
@@ -106,10 +109,12 @@
     MEM_STATS(0);
     if (this->m_mutex != NULL) this->m_mutex->unlock();
  #endif
+ #endif
  }
  
  // pause
  void ErrorHandler::pause(const char *format, ...) {
+ #ifndef HUSH_LOG
     if (this->m_mutex != NULL) this->m_mutex->lock();
     memset(this->m_message,0,MAX_LOG_MESSAGE+1);
     va_list args;
@@ -129,6 +134,7 @@
         closedown(1);
     }
     if (this->m_mutex != NULL) this->m_mutex->unlock();
+ #endif
  }
  
  // check for exit
@@ -146,6 +152,7 @@
 
 // set the color LED 
 void ErrorHandler::setRGBLED(float H, float S, float V) {
+#ifndef HUSH_LEDS
     float f,h,p,q,t;
     int i;
     if( S == 0.0) {
@@ -199,6 +206,7 @@
             b = 1.0 - q;
             break;
     }
+ #endif
 }
 
 // turn the RGB LED specific colors
@@ -208,26 +216,32 @@
 void ErrorHandler::turnLEDBlack() { this->setRGBLED(0,0,0); }
 void ErrorHandler::turnLEDYellow() { this->setRGBLED(60.0,1.0,0.133); }
 void ErrorHandler::dimRGB(float value) {
+#ifndef HUSH_LEDS
     float H, S, V;
     H = 120.0 - (120.0*(1.0 - value));
     S = 1.0 - (1.0*(1.0 - value));
     V = 0.2 - (0.2*(1.0 - value));
     this->setRGBLED(H,S,V);
+#endif
 }
 
 // reset LEDs
 void ErrorHandler::resetLEDs() {
+#ifndef HUSH_LEDS
     // turn off all LEDs
     led1 = 0; led2 = 0; led3 = 0; led4 = 0;
+#endif
 }
 
 // blink an LED
 void ErrorHandler::blinkLED(DigitalOut led) {
+#ifndef HUSH_LEDS
     if (this->m_mutex != NULL) this->m_led_mutex->lock();
     led = 1;
     wait_ms(BLINK_TIME);
     led = 0;
     if (this->m_mutex != NULL) this->m_led_mutex->unlock();
+#endif
 }
 
 // blink the Transport TX LED