1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 07:02:21 +01:00

Early pin init (#3439)

* Added early_pin_init configuration parameter for ESP8266 platform

* Added #include to core

* Updated test3.yaml to include early_pin_init parameter

Co-authored-by: Rainer Oellermann <ro@playplaycode.com>
This commit is contained in:
rainero84
2022-05-09 07:21:43 +02:00
committed by GitHub
parent 8e3af515c9
commit 2059283707
4 changed files with 13 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
#ifdef USE_ESP8266
#include "core.h"
#include "esphome/core/defines.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "preferences.h"
@@ -55,6 +56,7 @@ extern "C" void resetPins() { // NOLINT
// ourselves and this causes pins to toggle during reboot.
force_link_symbols();
#ifdef USE_ESP8266_EARLY_PIN_INIT
for (int i = 0; i < 16; i++) {
uint8_t mode = ESPHOME_ESP8266_GPIO_INITIAL_MODE[i];
uint8_t level = ESPHOME_ESP8266_GPIO_INITIAL_LEVEL[i];
@@ -63,6 +65,7 @@ extern "C" void resetPins() { // NOLINT
if (level != 255)
digitalWrite(i, level); // NOLINT
}
#endif
}
} // namespace esphome