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

ESP8266 early init for pins (#3144)

This commit is contained in:
Otto Winter
2022-02-17 04:59:46 +01:00
committed by GitHub
parent ffa19426d7
commit 5a0b8328d8
5 changed files with 89 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
#ifdef USE_ESP8266
#include "core.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "preferences.h"
@@ -53,6 +54,15 @@ extern "C" void resetPins() { // NOLINT
// however, not strictly needed as we set up the pins properly
// ourselves and this causes pins to toggle during reboot.
force_link_symbols();
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];
if (mode != 255)
pinMode(i, mode); // NOLINT
if (level != 255)
digitalWrite(i, level); // NOLINT
}
}
} // namespace esphome