ESPHome
2026.5.0b1
Loading...
Searching...
No Matches
esphome
core
hal.h
Go to the documentation of this file.
1
#pragma once
2
#include <string>
3
#include <cstdint>
4
#include "
gpio.h
"
5
#include "
esphome/core/defines.h
"
6
#include "
esphome/core/time_64.h
"
7
#include "
esphome/core/time_conversion.h
"
8
9
// Per-platform HAL bits (IRAM_ATTR / PROGMEM macros, in_isr_context(),
10
// inline yield/delay/micros/millis/millis_64 wrappers, ESP8266 progmem
11
// helpers) live next to each platform component as components/<platform>/hal.h
12
// and are dispatched here based on the active USE_* platform define. Each
13
// header guards its body with the matching #ifdef USE_<platform> and re-enters
14
// namespace esphome {} so it is safe to be re-included.
15
#if defined(USE_ESP32)
16
#include "
esphome/components/esp32/hal.h
"
17
#elif defined(USE_ESP8266)
18
#include "
esphome/components/esp8266/hal.h
"
19
#elif defined(USE_LIBRETINY)
20
#include "
esphome/components/libretiny/hal.h
"
21
#elif defined(USE_RP2040)
22
#include "
esphome/components/rp2040/hal.h
"
23
#elif defined(USE_HOST)
24
#include "
esphome/components/host/hal.h
"
25
#elif defined(USE_ZEPHYR)
26
#include "
esphome/components/zephyr/hal.h
"
27
#else
28
#error "hal.h: not implemented for this platform"
29
#endif
30
31
namespace
esphome
{
32
33
// Cross-platform declarations. delayMicroseconds(), arch_feed_wdt(),
34
// arch_get_cpu_cycle_count(), arch_init(), arch_get_cpu_freq_hz() vary
35
// per platform (some inline, some out-of-line) so they live in
36
// components/<platform>/hal.h.
37
void
__attribute__
((noreturn))
arch_restart
();
38
39
#ifndef USE_ESP8266
40
// All non-ESP8266 platforms: PROGMEM is a no-op, so these are direct dereferences.
41
// ESP8266's out-of-line declarations live in components/esp8266/hal.h.
42
inline
uint8_t
progmem_read_byte
(
const
uint8_t *addr) {
return
*addr; }
43
inline
const
char
*
progmem_read_ptr
(
const
char
*
const
*addr) {
return
*addr; }
44
inline
uint16_t
progmem_read_uint16
(
const
uint16_t *addr) {
return
*addr; }
45
#endif
46
47
}
// namespace esphome
__attribute__
struct @65::@66 __attribute__
Wake the main loop task from an ISR. ISR-safe.
Definition
main_task.h:32
hal.h
hal.h
hal.h
hal.h
hal.h
hal.h
gpio.h
defines.h
esphome
Definition
a01nyub.cpp:7
esphome::progmem_read_ptr
const char * progmem_read_ptr(const char *const *addr)
Definition
hal.h:43
esphome::progmem_read_uint16
uint16_t progmem_read_uint16(const uint16_t *addr)
Definition
hal.h:44
esphome::arch_restart
void arch_restart()
Definition
hal.cpp:39
esphome::progmem_read_byte
uint8_t progmem_read_byte(const uint8_t *addr)
Definition
hal.h:42
time_64.h
time_conversion.h
Generated by
1.12.0