8 #if ! defined(ARDUINO_AVR_MICRO) & ! defined(ARDUINO_AVR_NANO) 
   14 #include <avr/pgmspace.h> 
   20 unsigned int LedLcdManager::row = 0U;
 
   21 unsigned int LedLcdManager::column = 0U;
 
   23 milliseconds_t LedLcdManager::blinkTime = defaultBlinkTime;
 
   24 unsigned long LedLcdManager::turnOffTime;
 
   25 unsigned int LedLcdManager::lcdRows = 0;
 
   26 unsigned int LedLcdManager::lcdColumns = 0;
 
   28 pin_t LedLcdManager::physicalLeds[maxLeds];
 
   29 led_t LedLcdManager::logicalLeds[maxLeds];
 
   30 bool LedLcdManager::shouldTimeOut[maxLeds];
 
   33         const pin_t physicalLeds_[], 
const led_t logicalLeds_[], 
const bool shouldTimeOut_[]) {
 
   34     setupLcdI2c(i2cAddress, columns, rows);
 
   35     setupPhysicalLeds(physicalLeds_);
 
   37     setupShouldTimeOut(shouldTimeOut_);
 
   42     pin_t pin = physicalLeds[physicalLed-1];
 
   43     if (pin == invalidPin)
 
   46     digitalWrite(pin, state == 
off ? LOW : HIGH);
 
   54                 : strcmp(value, 
"on") == 0 ? 
on 
   55                 : strcmp(value, 
"off") == 0 ? 
off 
   56                 : strcmp(value, 
"blink") == 0 ? 
blink 
   67     led_t physicalLed = logicalLeds[logicLed - 1];
 
   78     logicalLeds[logicLed-1] = physicalLed;
 
   83     for (
int i = 0; i < 
maxLeds; i++)
 
   84         logicalLeds[i] = logicalLeds_ == NULL ? i+1 : logicalLeds_[i];
 
   88 void LedLcdManager::setupPhysicalLeds(
const pin_t physicalLeds_[maxLeds]) {
 
   89     for (
int i = 0; i < 
maxLeds; i++) {
 
   90         physicalLeds[i] = physicalLeds_ == NULL ? invalidPin : physicalLeds_[i];
 
   91         if (physicalLeds[i] != invalidPin)
 
   92             pinMode(physicalLeds[i], OUTPUT);
 
   96 void LedLcdManager::setupShouldTimeOut(
const bool shouldTimeOut_[maxLeds]) {
 
   97     for (
int i = 0; i < 
maxLeds; i++)
 
   98         shouldTimeOut[i] = shouldTimeOut_ == NULL ? 
true : shouldTimeOut_[i];
 
  103         shouldTimeOut[logicLed-1] = state;
 
  106 void LedLcdManager::setupLcdI2c(int8_t i2cAddress __attribute__((unused)),
 
  107         uint8_t columns __attribute__((unused)),
 
  108         uint8_t rows __attribute__((unused))) {
 
  110     lcd = i2cAddress >= 0 ? 
new LiquidCrystal_I2C(
static_cast<uint8_t
>(i2cAddress), columns, rows) : nullptr;
 
  113         lcdColumns = columns;
 
  120     turnOffTime = millis() + blinkTime;
 
  148     if (millis() > turnOffTime)
 
  160         if (force || shouldTimeOut[i - 1])
 
  163     disableTurnOffTime();
 
  166 void LedLcdManager::disableTurnOffTime() {
 
  167     turnOffTime = (
unsigned long) -1;
 
  170 void LedLcdManager::lcdPrint(
const __FlashStringHelper *pstr __attribute__ ((unused)), 
bool clear __attribute__ ((unused)), 
int x __attribute__ ((unused)), 
int y __attribute__ ((unused))) {
 
  174     prepare(clear, x, y);
 
  175     PGM_P p = 
reinterpret_cast<PGM_P
>(pstr);
 
  178         c = pgm_read_byte(p++);
 
  200         int x __attribute ((unused)), 
int y __attribute__ ((unused))) {
 
  204     prepare(clear, x, y);
 
  205     size_t len = strlen(
string);
 
  206     for (
size_t i = 0; i < len; i++) {
 
  226 void LedLcdManager::prepare(
bool clear __attribute__((unused)), 
int x __attribute__((unused)), 
int y __attribute__((unused))) {
 
  228     if (x >= 0 && y >= 0) {
 
  231         if (row > (
unsigned int) lcdRows - 1 || column > (
unsigned int) lcdColumns - 1) 
 
static void lcdPrint(const char *str, bool clear=true, int x=invalidLine, int y=invalidLine)
 
static constexpr int maxLeds
 
static void setupShouldTimeout(led_t logicLed, bool state)
 
static constexpr int selftestTimeWithLCD
 
static void allOff(bool force)
 
static constexpr led_t invalidLed
 
static bool setLogicLed(led_t logicLed, LedState state)
 
static LedState onOffBlinkParse(const char *value)
 
static constexpr int selftestTimeWithoutLCD
 
static bool setupLogicLed(led_t loginLed, led_t physicalLed)
 
static void setup(int8_t i2cAddress, uint8_t columns=defaultLcdColumns, uint8_t rows=defaultLcdRows, const pin_t physicalLeds[maxLeds]=NULL, const led_t logicalLeds[maxLeds]=NULL, const bool shouldTimeOut[maxLeds]=NULL)
Sets up the instance, to be called before using the instance.
 
static bool setupLogicLeds(const led_t array[maxLeds])
 
static void selfTest(const char *text)
 
static bool setPhysicalLed(led_t physicalLed, LedState state)
 
static void updateTurnOffTime()
 
static void checkTurnoff()
Turn off if it is due.
 
void noBacklight()
Turn the (optional) backlight off/on.
 
void setCursor(uint8_t, uint8_t)
 
void noDisplay()
Turn the display on/off (quickly)