ESPHome 2026.5.3
Loading...
Searching...
No Matches
core.cpp
Go to the documentation of this file.
1#ifdef USE_ESP8266
2
3#include "core.h"
5#include "esphome/core/hal.h"
6#include <Arduino.h>
7
8namespace esphome {
9
10// HAL functions live in hal.cpp. This file keeps only the ESP8266-specific
11// firmware bootstrap (Tasmota OTA magic bytes, optional GPIO pre-init).
12
14 // Tasmota uses magic bytes in the binary to check if an OTA firmware is compatible
15 // with their settings - ESPHome uses a different settings system (that can also survive
16 // erases). So set magic bytes indicating all tasmota versions are supported.
17 // This only adds 12 bytes of binary size, which is an acceptable price to pay for easier support
18 // for Tasmota.
19 // https://github.com/arendst/Tasmota/blob/b05301b1497942167a015a6113b7f424e42942cd/tasmota/settings.ino#L346-L380
20 // https://github.com/arendst/Tasmota/blob/b05301b1497942167a015a6113b7f424e42942cd/tasmota/i18n.h#L652-L654
21 const static uint32_t TASMOTA_MAGIC_BYTES[] PROGMEM = {0x5AA55AA5, 0xFFFFFFFF, 0xA55AA55A};
22 // Force link symbol by using a volatile integer (GCC attribute used does not work because of LTO)
23 volatile int x = 0;
24 x = TASMOTA_MAGIC_BYTES[x];
25}
26
27extern "C" void resetPins() { // NOLINT
28 // Added in framework 2.7.0
29 // usually this sets up all pins to be in INPUT mode
30 // however, not strictly needed as we set up the pins properly
31 // ourselves and this causes pins to toggle during reboot.
33
34#ifdef USE_ESP8266_EARLY_PIN_INIT
35 for (int i = 0; i < 16; i++) {
38 if (mode != 255)
39 pinMode(i, mode); // NOLINT
40 if (level != 255)
41 digitalWrite(i, level); // NOLINT
42 }
43#endif
44}
45
46} // namespace esphome
47
48#endif // USE_ESP8266
BedjetMode mode
BedJet operating mode.
const uint8_t ESPHOME_ESP8266_GPIO_INITIAL_LEVEL[16]
const uint8_t ESPHOME_ESP8266_GPIO_INITIAL_MODE[16]
void resetPins()
Definition core.cpp:27
void force_link_symbols()
Definition core.cpp:13
uint8_t progmem_read_byte(const uint8_t *addr)
Definition hal.h:42
static void uint32_t
uint16_t x
Definition tt21100.cpp:5
const uint8_t ESPHOME_WEBSERVER_INDEX_HTML[] PROGMEM
Definition web_server.h:28