ESPHome
2026.5.0b1
Loading...
Searching...
No Matches
esphome
components
rp2040
hal.cpp
Go to the documentation of this file.
1
#ifdef USE_RP2040
2
3
#include "
core.h
"
4
#include "
esphome/core/defines.h
"
5
#include "
esphome/core/hal.h
"
6
#ifdef USE_RP2040_CRASH_HANDLER
7
#include "
crash_handler.h
"
8
#endif
9
10
#include "hardware/watchdog.h"
11
12
// Empty rp2040 namespace block to satisfy ci-custom's lint_namespace check.
13
// HAL functions live in namespace esphome (root) — they are not part of the
14
// rp2040 component's API.
15
namespace
esphome::rp2040
{}
// namespace esphome::rp2040
16
17
namespace
esphome
{
18
19
// yield(), delay(), micros(), millis(), millis_64(), delayMicroseconds(),
20
// arch_feed_wdt(), arch_get_cpu_cycle_count() inlined in components/rp2040/hal.h.
21
void
arch_restart
() {
22
watchdog_reboot(0, 0, 10);
23
while
(1) {
24
continue
;
25
}
26
}
27
28
void
arch_init
() {
29
#ifdef USE_RP2040_CRASH_HANDLER
30
rp2040::crash_handler_read_and_clear
();
31
#endif
32
#if USE_RP2040_WATCHDOG_TIMEOUT > 0
33
watchdog_enable(USE_RP2040_WATCHDOG_TIMEOUT,
false
);
34
#endif
35
}
36
37
uint32_t
arch_get_cpu_freq_hz
() {
return
RP2040::f_cpu(); }
38
39
}
// namespace esphome
40
41
#endif
// USE_RP2040
hal.h
defines.h
esphome::rp2040
Definition
core.h:10
esphome::rp2040::crash_handler_read_and_clear
void crash_handler_read_and_clear()
Read crash data from watchdog scratch registers and clear them.
Definition
crash_handler.cpp:71
esphome
Definition
a01nyub.cpp:7
esphome::arch_init
void arch_init()
Definition
hal.cpp:47
esphome::arch_get_cpu_freq_hz
uint32_t arch_get_cpu_freq_hz()
Definition
hal.cpp:63
esphome::arch_restart
void arch_restart()
Definition
hal.cpp:39
core.h
uint32_t
static void uint32_t
Definition
crash_handler.cpp:141
crash_handler.h
Generated by
1.12.0