/* * Atm_led_mcp.cpp * * Created on: 09.12.2017 * Author: ian */ #include #include Atm_led_TLC::Atm_led_TLC(Adafruit_TLC59711& _tlc): Atm_led(), // base class ctor would also be called implicitly, but better style to mention this explicitly :) tlc(_tlc) { // nothing to see here } void Atm_led_TLC::initLED() { tlc.setPWM(pin, 0); //Serial.printf("LED init on pin %x\n", pin); } void Atm_led_TLC::switchOn() { tlc.setPWM(pin, current_level); } void Atm_led_TLC::switchOff() { tlc.setPWM(pin, mapLevel(toLow)); } void Atm_led_TLC::setBrightness(int value) { tlc.setPWM(pin, mapLevel(value)); } int Atm_led_TLC::mapLevel(int level) { current_level = map( level, toLow, toHigh, 0, 65535 ); return current_level; }