add function that gets called before homie initialization

This commit is contained in:
Ronald Schaten 2016-05-21 19:19:24 +02:00
parent 6d0cf8f786
commit bfd74e61a1
5 changed files with 21 additions and 0 deletions

View File

@ -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}");
}

View File

@ -28,3 +28,5 @@ Device* devices[] = {
&deviceLdr,
&deviceButton,
};
void hardwareSetup() {};

View File

@ -35,3 +35,5 @@ Device* devices[] = {
&deviceButton,
&deviceDht,
};
void hardwareSetup() {};

View File

@ -46,3 +46,5 @@ Device* devices[] = {
&deviceIrRx,
&deviceIrTx,
};
void hardwareSetup() {};

View File

@ -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();