mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
[libretiny] Inline delayMicroseconds() in hal_libretiny.h
The wrapper is a one-liner forwarding to Arduino's ::delayMicroseconds. Add the forward decl to the existing NOLINTBEGIN block (alongside yield, delay, micros, millis) and inline the body — same pattern as the other Arduino-flavored wrappers in this header. Drops the out-of-line copy from components/libretiny/hal.cpp.
This commit is contained in:
@@ -14,10 +14,9 @@ namespace esphome::libretiny {} // namespace esphome::libretiny
|
||||
|
||||
namespace esphome {
|
||||
|
||||
// yield(), delay(), micros(), millis(), millis_64(), arch_feed_wdt(),
|
||||
// arch_get_cpu_cycle_count(), arch_get_cpu_freq_hz() inlined in
|
||||
// core/hal/hal_libretiny.h.
|
||||
void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { ::delayMicroseconds(us); }
|
||||
// yield(), delay(), micros(), millis(), millis_64(), delayMicroseconds(),
|
||||
// arch_feed_wdt(), arch_get_cpu_cycle_count(), arch_get_cpu_freq_hz()
|
||||
// inlined in core/hal/hal_libretiny.h.
|
||||
|
||||
void arch_init() {
|
||||
libretiny::setup_preferences();
|
||||
|
||||
@@ -51,6 +51,7 @@ extern "C" void yield(void);
|
||||
extern "C" void delay(unsigned long ms);
|
||||
extern "C" unsigned long micros(void);
|
||||
extern "C" unsigned long millis(void);
|
||||
extern "C" void delayMicroseconds(unsigned int us);
|
||||
// NOLINTEND(google-runtime-int,readability-identifier-naming,readability-redundant-declaration)
|
||||
|
||||
// Forward decls from libretiny's <lt_api.h> family for the inline arch_*
|
||||
@@ -95,11 +96,12 @@ __attribute__((always_inline)) inline uint32_t millis() { return static_cast<uin
|
||||
#endif
|
||||
__attribute__((always_inline)) inline uint64_t millis_64() { return Millis64Impl::compute(millis()); }
|
||||
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
__attribute__((always_inline)) inline void delayMicroseconds(uint32_t us) { ::delayMicroseconds(us); }
|
||||
__attribute__((hot, always_inline)) inline void arch_feed_wdt() { lt_wdt_feed(); }
|
||||
__attribute__((always_inline)) inline uint32_t arch_get_cpu_cycle_count() { return lt_cpu_get_cycle_count(); }
|
||||
__attribute__((always_inline)) inline uint32_t arch_get_cpu_freq_hz() { return lt_cpu_get_freq(); }
|
||||
|
||||
void delayMicroseconds(uint32_t us); // NOLINT(readability-identifier-naming)
|
||||
void arch_init();
|
||||
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user