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:
Wed Apr 02 00:43:37 2014 +0000
Revision:
144:e4d24c2c8f18
Child:
146:8c05a119d9d4
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 144:e4d24c2c8f18 1 /* Copyright C2013 Doug Anson, MIT License
ansond 144:e4d24c2c8f18 2 *
ansond 144:e4d24c2c8f18 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ansond 144:e4d24c2c8f18 4 * and associated documentation files the "Software", to deal in the Software without restriction,
ansond 144:e4d24c2c8f18 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ansond 144:e4d24c2c8f18 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ansond 144:e4d24c2c8f18 7 * furnished to do so, subject to the following conditions:
ansond 144:e4d24c2c8f18 8 *
ansond 144:e4d24c2c8f18 9 * The above copyright notice and this permission notice shall be included in all copies or
ansond 144:e4d24c2c8f18 10 * substantial portions of the Software.
ansond 144:e4d24c2c8f18 11 *
ansond 144:e4d24c2c8f18 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ansond 144:e4d24c2c8f18 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ansond 144:e4d24c2c8f18 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ansond 144:e4d24c2c8f18 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ansond 144:e4d24c2c8f18 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ansond 144:e4d24c2c8f18 17 */
ansond 144:e4d24c2c8f18 18
ansond 144:e4d24c2c8f18 19 #include "CopCarLEDFlasher.h"
ansond 144:e4d24c2c8f18 20
ansond 144:e4d24c2c8f18 21 // default constructor
ansond 144:e4d24c2c8f18 22 CopCarLEDFlasher::CopCarLEDFlasher(PwmOut *led1,PwmOut *led2,ErrorHandler *error_handler) : ExternalLEDLight(led1,error_handler) {
ansond 144:e4d24c2c8f18 23 this->m_led2 = led2;
ansond 144:e4d24c2c8f18 24 }
ansond 144:e4d24c2c8f18 25
ansond 144:e4d24c2c8f18 26 // destructor
ansond 144:e4d24c2c8f18 27 CopCarLEDFlasher::~CopCarLEDFlasher() {
ansond 144:e4d24c2c8f18 28 if (this->m_led2 != NULL) delete this->m_led2;
ansond 144:e4d24c2c8f18 29 }
ansond 144:e4d24c2c8f18 30
ansond 144:e4d24c2c8f18 31 // set the light state
ansond 144:e4d24c2c8f18 32 void CopCarLEDFlasher::update() {
ansond 144:e4d24c2c8f18 33 ExternalLEDLight::update();
ansond 144:e4d24c2c8f18 34
ansond 144:e4d24c2c8f18 35 // turn the light on or off
ansond 144:e4d24c2c8f18 36 if (this->m_state == 0) {
ansond 144:e4d24c2c8f18 37 *(this->m_led2) = 0;
ansond 144:e4d24c2c8f18 38 }
ansond 144:e4d24c2c8f18 39 else {
ansond 144:e4d24c2c8f18 40 *(this->m_led2) = 1;
ansond 144:e4d24c2c8f18 41 }
ansond 144:e4d24c2c8f18 42 }