ESPHome  2024.11.3
core.cpp
Go to the documentation of this file.
1 #ifdef USE_RP2040
2 
3 #include "core.h"
4 #include "esphome/core/hal.h"
5 #include "esphome/core/helpers.h"
6 
7 #include "hardware/watchdog.h"
8 
9 namespace esphome {
10 
11 void IRAM_ATTR HOT yield() { ::yield(); }
12 uint32_t IRAM_ATTR HOT millis() { return ::millis(); }
13 void IRAM_ATTR HOT delay(uint32_t ms) { ::delay(ms); }
14 uint32_t IRAM_ATTR HOT micros() { return ::micros(); }
15 void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); }
16 void arch_restart() {
17  watchdog_reboot(0, 0, 10);
18  while (1) {
19  continue;
20  }
21 }
22 void arch_init() { watchdog_enable(0x7fffff, false); }
23 void IRAM_ATTR HOT arch_feed_wdt() { watchdog_update(); }
24 
25 uint8_t progmem_read_byte(const uint8_t *addr) {
26  return pgm_read_byte(addr); // NOLINT
27 }
28 uint32_t IRAM_ATTR HOT arch_get_cpu_cycle_count() { return ulMainGetRunTimeCounterValue(); }
29 uint32_t arch_get_cpu_freq_hz() { return RP2040::f_cpu(); }
30 
31 } // namespace esphome
32 
33 #endif // USE_RP2040
void IRAM_ATTR HOT arch_feed_wdt()
Definition: core.cpp:53
void delay_microseconds_safe(uint32_t us)
Delay for the given amount of microseconds, possibly yielding to other processes during the wait...
Definition: helpers.cpp:765
uint32_t IRAM_ATTR HOT micros()
Definition: core.cpp:27
uint32_t IRAM_ATTR HOT millis()
Definition: core.cpp:25
unsigned long ulMainGetRunTimeCounterValue()
uint32_t arch_get_cpu_freq_hz()
Definition: core.cpp:61
void arch_restart()
Definition: core.cpp:29
uint8_t progmem_read_byte(const uint8_t *addr)
Definition: core.cpp:55
void IRAM_ATTR HOT yield()
Definition: core.cpp:24
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
Definition: core.cpp:28
void arch_init()
Definition: core.cpp:37
uint32_t arch_get_cpu_cycle_count()
Definition: core.cpp:57
void IRAM_ATTR HOT delay(uint32_t ms)
Definition: core.cpp:26