mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
No need for preprocessor undefinition of optimistic_yield, after all.
This commit is contained in:
parent
8d2eca5684
commit
50fab5162f
@ -205,18 +205,7 @@ void loop(void);
|
||||
|
||||
void yield(void);
|
||||
|
||||
#ifndef F_CPU
|
||||
// single function needed from SDK user_interface.h
|
||||
extern "C" uint8 system_get_cpu_freq(void);
|
||||
#endif
|
||||
|
||||
void __optimistic_yield(uint32_t intvl_cycles);
|
||||
|
||||
#if defined(F_CPU)
|
||||
#define optimistic_yield(interval_us) (__optimistic_yield(interval_us * clockCyclesPerMicrosecond()))
|
||||
#else
|
||||
#define optimistic_yield(interval_us) (__optimistic_yield(interval_us * getCpuFreqMHz()))
|
||||
#endif
|
||||
void optimistic_yield(uint32_t interval_us);
|
||||
|
||||
#define _PORT_GPIO16 1
|
||||
#define digitalPinToPort(pin) (((pin)==16)?(_PORT_GPIO16):(0))
|
||||
|
@ -124,7 +124,13 @@ extern "C" void __yield() {
|
||||
|
||||
extern "C" void yield(void) __attribute__ ((weak, alias("__yield")));
|
||||
|
||||
extern "C" void __optimistic_yield(uint32_t intvl_cycles) {
|
||||
extern "C" void optimistic_yield(uint32_t interval_us) {
|
||||
const uint32_t intvl_cycles = interval_us *
|
||||
#if defined(F_CPU)
|
||||
clockCyclesPerMicrosecond();
|
||||
#else
|
||||
getCpuFreqMHz();
|
||||
#endif
|
||||
if ((ESP.getCycleCount() - s_cycles_since_yield_start) > intvl_cycles &&
|
||||
can_yield())
|
||||
{
|
||||
@ -132,17 +138,6 @@ extern "C" void __optimistic_yield(uint32_t intvl_cycles) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef optimistic_yield
|
||||
extern "C" void optimistic_yield(uint32_t interval_us) {
|
||||
__optimistic_yield(interval_us *
|
||||
#if defined(F_CPU)
|
||||
clockCyclesPerMicrosecond()
|
||||
#else
|
||||
getCpuFreqMHz()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
// Replace ets_intr_(un)lock with nestable versions
|
||||
extern "C" void IRAM_ATTR ets_intr_lock() {
|
||||
if (ets_intr_lock_stack_ptr < ETS_INTR_LOCK_NEST_MAX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user