1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-11-28 17:36:39 +03:00

Allow constexpr evalution to occur. optimistic_yield is always called with a literal parameter value.

This commit is contained in:
Dirk O. Kaar
2019-12-02 11:05:21 +01:00
parent 3d7423bdde
commit 3767791fbc
2 changed files with 22 additions and 6 deletions

View File

@@ -204,7 +204,24 @@ void setup(void);
void loop(void);
void yield(void);
void optimistic_yield(uint32_t interval_us);
#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);
void inline optimistic_yield(uint32_t interval_us) __attribute__((always_inline));
void inline optimistic_yield(uint32_t interval_us) {
__optimistic_yield(interval_us *
#if defined(F_CPU)
clockCyclesPerMicrosecond()
#else
getCpuFreqMHz()
#endif
);
}
#define _PORT_GPIO16 1
#define digitalPinToPort(pin) (((pin)==16)?(_PORT_GPIO16):(0))