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:
170:9e72f2d0f2b2
Parent:
169:5ba15f5f7f87
Child:
172:ca0acfacc5c4
diff -r 5ba15f5f7f87 -r 9e72f2d0f2b2 APMDemoLight.cpp
--- a/APMDemoLight.cpp	Thu Jul 17 19:50:57 2014 +0000
+++ b/APMDemoLight.cpp	Fri Jul 18 21:05:07 2014 +0000
@@ -20,10 +20,7 @@
  
  // Configuration settings for the APM Demo Light...
  #ifdef APM_LIGHT_PERSONALITY
- 
- PwmOut apm_light_led(LED1);          // led 1 indicates dim value
- DigitalOut apm_light_led2(LED2);     // led 2 indicates delay time for interrupts
- 
+  
  // pin for ZeroCross tail input - NOTE: An external 1K pullup required
  InterruptIn apm_light_zerocross(p27);
  
@@ -43,7 +40,6 @@
  extern "C" void apm_light_triggerOn()
  {
     apm_light_SSR = 1;
-    apm_light_led2 = 0;
  }
  
  // this interrupt routine is activated by every AC line zero crossing
@@ -56,12 +52,10 @@
     // compute time delay using dim value and set timer interrupt
     // triggers SSR after a small post zero crossing time delay
     apm_light_SSRtriggerOn.attach(&apm_light_triggerOn,(1.001-_apm_light_instance->getDimValue())/(2*apm_light_powerlinefrequency));
-    apm_light_led2 = 1;
  }
    
  // default constructor
  APMDemoLight::APMDemoLight(ErrorHandler *error_handler) : BaseClass(error_handler,NULL) {
-     this->m_led = &apm_light_led;
      this->m_dimming = false;
      sscanf(LIGHT_DEFAULT_STATE,"%d",&this->m_state);
      sscanf(LIGHT_DIM_STATE,"%f",&this->m_dim);
@@ -92,29 +86,9 @@
  float APMDemoLight::getDimValue() { return this->m_dim; }
   
  // set the light state
- void APMDemoLight::update() {
-    if (this->m_dimming) {
-        // dim the light
-        *(this->m_led) = this->m_dim;
-    }
-    else {
-        // turn the light on or off
-        if (this->m_state == 0) {
-            // just turn the LED off
-            *(this->m_led) = 0;
-        }
-        else {
-            // turn the LED on - but re-adjust for the current dim setting:
-            //  - if the dimming is set to 0, then lets go ahead and make the light full bright...
-            //  - otherwise we wont see the transition change. 
-            if (this->m_dim == 0.0) {
-                *(this->m_led) = 1;
-            }
-            else {
-                *(this->m_led) = this->m_dim;
-            }
-        }
-    }
+ void APMDemoLight::update() { 
+    // handled automatically
+    ;
  }
  
  #endif
\ No newline at end of file