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:
Thu Jul 17 19:50:57 2014 +0000
Revision:
169:5ba15f5f7f87
Parent:
167:2529c18d0eb1
Child:
170:9e72f2d0f2b2
more fixes for tuning APM light

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 167:2529c18d0eb1 1 /* Copyright C2013 Doug Anson, MIT License
ansond 167:2529c18d0eb1 2 *
ansond 167:2529c18d0eb1 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ansond 167:2529c18d0eb1 4 * and associated documentation files the "Software", to deal in the Software without restriction,
ansond 167:2529c18d0eb1 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ansond 167:2529c18d0eb1 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ansond 167:2529c18d0eb1 7 * furnished to do so, subject to the following conditions:
ansond 167:2529c18d0eb1 8 *
ansond 167:2529c18d0eb1 9 * The above copyright notice and this permission notice shall be included in all copies or
ansond 167:2529c18d0eb1 10 * substantial portions of the Software.
ansond 167:2529c18d0eb1 11 *
ansond 167:2529c18d0eb1 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ansond 167:2529c18d0eb1 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ansond 167:2529c18d0eb1 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ansond 167:2529c18d0eb1 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ansond 167:2529c18d0eb1 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ansond 167:2529c18d0eb1 17 */
ansond 167:2529c18d0eb1 18
ansond 167:2529c18d0eb1 19 #ifndef _APM_DEMO_LIGHT_H_
ansond 167:2529c18d0eb1 20 #define _APM_DEMO_LIGHT_H_
ansond 167:2529c18d0eb1 21
ansond 167:2529c18d0eb1 22 #include "mbed.h"
ansond 167:2529c18d0eb1 23 #include "Definitions.h"
ansond 167:2529c18d0eb1 24 #include "BaseClass.h"
ansond 167:2529c18d0eb1 25
ansond 169:5ba15f5f7f87 26 #ifdef APM_LIGHT_PERSONALITY
ansond 167:2529c18d0eb1 27 class APMDemoLight : BaseClass {
ansond 167:2529c18d0eb1 28 private:
ansond 167:2529c18d0eb1 29 volatile float m_dim;
ansond 167:2529c18d0eb1 30 bool m_dimming;
ansond 167:2529c18d0eb1 31
ansond 167:2529c18d0eb1 32 protected:
ansond 167:2529c18d0eb1 33 PwmOut *m_led;
ansond 167:2529c18d0eb1 34 int m_state;
ansond 167:2529c18d0eb1 35
ansond 167:2529c18d0eb1 36 public:
ansond 167:2529c18d0eb1 37 APMDemoLight(ErrorHandler *error_handler);
ansond 167:2529c18d0eb1 38 virtual ~APMDemoLight();
ansond 167:2529c18d0eb1 39
ansond 167:2529c18d0eb1 40 virtual void on();
ansond 167:2529c18d0eb1 41 virtual void off();
ansond 167:2529c18d0eb1 42 virtual void dim(int dim); // range: 0 - 100
ansond 167:2529c18d0eb1 43
ansond 167:2529c18d0eb1 44 float getDimValue();
ansond 167:2529c18d0eb1 45
ansond 167:2529c18d0eb1 46 protected:
ansond 167:2529c18d0eb1 47 virtual void update();
ansond 167:2529c18d0eb1 48 };
ansond 169:5ba15f5f7f87 49 #endif
ansond 167:2529c18d0eb1 50 #endif // _APM_DEMO_LIGHT_H_