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
APMDemoLight.h@167:2529c18d0eb1, 2014-07-16 (annotated)
- Committer:
- ansond
- Date:
- Wed Jul 16 17:29:00 2014 +0000
- Revision:
- 167:2529c18d0eb1
- Child:
- 169:5ba15f5f7f87
added APMDemoLight
Who changed what in which revision?
User | Revision | Line number | New 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 | 167:2529c18d0eb1 | 26 | class APMDemoLight : BaseClass { |
ansond | 167:2529c18d0eb1 | 27 | private: |
ansond | 167:2529c18d0eb1 | 28 | volatile float m_dim; |
ansond | 167:2529c18d0eb1 | 29 | bool m_dimming; |
ansond | 167:2529c18d0eb1 | 30 | |
ansond | 167:2529c18d0eb1 | 31 | protected: |
ansond | 167:2529c18d0eb1 | 32 | PwmOut *m_led; |
ansond | 167:2529c18d0eb1 | 33 | int m_state; |
ansond | 167:2529c18d0eb1 | 34 | |
ansond | 167:2529c18d0eb1 | 35 | public: |
ansond | 167:2529c18d0eb1 | 36 | APMDemoLight(ErrorHandler *error_handler); |
ansond | 167:2529c18d0eb1 | 37 | virtual ~APMDemoLight(); |
ansond | 167:2529c18d0eb1 | 38 | |
ansond | 167:2529c18d0eb1 | 39 | virtual void on(); |
ansond | 167:2529c18d0eb1 | 40 | virtual void off(); |
ansond | 167:2529c18d0eb1 | 41 | virtual void dim(int dim); // range: 0 - 100 |
ansond | 167:2529c18d0eb1 | 42 | |
ansond | 167:2529c18d0eb1 | 43 | float getDimValue(); |
ansond | 167:2529c18d0eb1 | 44 | |
ansond | 167:2529c18d0eb1 | 45 | protected: |
ansond | 167:2529c18d0eb1 | 46 | virtual void update(); |
ansond | 167:2529c18d0eb1 | 47 | }; |
ansond | 167:2529c18d0eb1 | 48 | |
ansond | 167:2529c18d0eb1 | 49 | #endif // _APM_DEMO_LIGHT_H_ |