mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
add delayMicroseconds (and other functions in esphome/core/hal.h
This commit is contained in:
parent
9d57c9897c
commit
487cf39101
1 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
#ifdef USE_ZEPHYR
|
#if 1
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/drivers/watchdog.h>
|
#include <zephyr/drivers/watchdog.h>
|
||||||
|
@ -11,8 +11,9 @@ const device *wdt = nullptr;
|
||||||
|
|
||||||
void yield() { ::k_yield(); }
|
void yield() { ::k_yield(); }
|
||||||
uint32_t millis() { return k_ticks_to_ms_floor32(k_uptime_ticks()); }
|
uint32_t millis() { return k_ticks_to_ms_floor32(k_uptime_ticks()); }
|
||||||
void delay(uint32_t ms) { ::k_msleep(ms); }
|
|
||||||
uint32_t micros() { return k_ticks_to_us_floor32(k_uptime_ticks()); }
|
uint32_t micros() { return k_ticks_to_us_floor32(k_uptime_ticks()); }
|
||||||
|
void delayMicroseconds(uint32_t us) { ::k_usleep(us); }
|
||||||
|
void delay(uint32_t ms) { ::k_msleep(ms); }
|
||||||
|
|
||||||
void arch_init() {
|
void arch_init() {
|
||||||
wdt = DEVICE_DT_GET(DT_ALIAS(watchdog0));
|
wdt = DEVICE_DT_GET(DT_ALIAS(watchdog0));
|
||||||
|
@ -35,6 +36,9 @@ void arch_feed_wdt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void arch_restart() { sys_reboot(SYS_REBOOT_COLD); }
|
void arch_restart() { sys_reboot(SYS_REBOOT_COLD); }
|
||||||
|
uint32_t arch_get_cpu_cycle_count() { return k_cycle_get_32(); }
|
||||||
|
uint32_t arch_get_cpu_freq_hz() { return sys_clock_hw_cycles_per_sec(); }
|
||||||
|
uint8_t progmem_read_byte(const uint8_t *addr) { return *addr; }
|
||||||
|
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue