From bfd74e61a172fe5609cb1a3a0a207ef097f92c41 Mon Sep 17 00:00:00 2001 From: Ronald Schaten Date: Sat, 21 May 2016 19:19:24 +0200 Subject: [PATCH] add function that gets called before homie initialization --- things/HardwareH801wifi.h | 14 ++++++++++++++ things/HardwareWitty.h | 2 ++ things/HardwareWittyDht.h | 2 ++ things/HardwareWittyDhtIrRxTx.h | 2 ++ things/things.ino | 1 + 5 files changed, 21 insertions(+) diff --git a/things/HardwareH801wifi.h b/things/HardwareH801wifi.h index 76ccb41..4cee1ba 100644 --- a/things/HardwareH801wifi.h +++ b/things/HardwareH801wifi.h @@ -28,3 +28,17 @@ Device* devices[] = { &deviceLedW2, &deviceRgb, }; + +void hardwareSetup() { + pinMode(PIN_LED1, OUTPUT); + pinMode(PIN_LED2, OUTPUT); + pinMode(PIN_RGB_RED, OUTPUT); + pinMode(PIN_RGB_GREEN, OUTPUT); + pinMode(PIN_RGB_BLUE, OUTPUT); + analogWrite(PIN_LED1, 100); + analogWrite(PIN_LED2, 0); + analogWrite(PIN_RGB_RED, 0); + analogWrite(PIN_RGB_GREEN, 0); + analogWrite(PIN_RGB_BLUE, 0); + deviceLedW1.ledBrightnessHandler("{\"brightness\":100}"); +} diff --git a/things/HardwareWitty.h b/things/HardwareWitty.h index 44df92d..6230fdf 100644 --- a/things/HardwareWitty.h +++ b/things/HardwareWitty.h @@ -28,3 +28,5 @@ Device* devices[] = { &deviceLdr, &deviceButton, }; + +void hardwareSetup() {}; diff --git a/things/HardwareWittyDht.h b/things/HardwareWittyDht.h index 2394c0b..bc6a0f2 100644 --- a/things/HardwareWittyDht.h +++ b/things/HardwareWittyDht.h @@ -35,3 +35,5 @@ Device* devices[] = { &deviceButton, &deviceDht, }; + +void hardwareSetup() {}; diff --git a/things/HardwareWittyDhtIrRxTx.h b/things/HardwareWittyDhtIrRxTx.h index 032174c..7a4b3b2 100644 --- a/things/HardwareWittyDhtIrRxTx.h +++ b/things/HardwareWittyDhtIrRxTx.h @@ -46,3 +46,5 @@ Device* devices[] = { &deviceIrRx, &deviceIrTx, }; + +void hardwareSetup() {}; diff --git a/things/things.ino b/things/things.ino index aad9e5d..98acf58 100644 --- a/things/things.ino +++ b/things/things.ino @@ -20,6 +20,7 @@ void loopHandler() { } void setup() { + hardwareSetup(); Homie.setFirmware(FWNAME, FWVERSION); for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) { devices[i]->deviceRegister();