ESPHome
2026.8.1
Loading...
Searching...
No Matches
esphome
components
rp2
hal.cpp
Go to the documentation of this file.
1
#ifdef USE_RP2
2
3
#include "
core.h
"
4
#include "
esphome/core/defines.h
"
5
#include "
esphome/core/hal.h
"
6
#ifdef USE_RP2_CRASH_HANDLER
7
#include "
crash_handler.h
"
8
#endif
9
10
#include "hardware/clocks.h"
11
#include "hardware/watchdog.h"
12
13
// Empty rp2 namespace block to satisfy ci-custom's lint_namespace check.
14
// HAL functions live in namespace esphome (root) — they are not part of the
15
// rp2 component's API.
16
namespace
esphome::rp2
{}
// namespace esphome::rp2
17
18
namespace
esphome
{
19
20
// yield(), delay(), micros(), millis(), millis_64(), delayMicroseconds(),
21
// arch_feed_wdt(), arch_get_cpu_cycle_count() inlined in components/rp2/hal.h.
22
void
arch_restart
() {
23
watchdog_reboot(0, 0, 10);
24
while
(
true
) {
25
}
26
}
27
28
void
arch_init
() {
29
#ifdef USE_RP2_CRASH_HANDLER
30
rp2::crash_handler_read_and_clear
();
31
#endif
32
#if USE_RP2_WATCHDOG_TIMEOUT > 0
33
watchdog_enable(USE_RP2_WATCHDOG_TIMEOUT,
false
);
34
#endif
35
}
36
37
// clock_get_hz(clk_sys) is the SDK query for the current system clock frequency in Hz.
38
uint32_t
arch_get_cpu_freq_hz
() {
return
clock_get_hz(clk_sys); }
39
40
}
// namespace esphome
41
42
#endif
// USE_RP2
hal.h
defines.h
esphome::rp2
Definition
core.h:11
esphome::rp2::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