esp32/mphalport: Use ets_delay_us for mp_hal_delay_us_fast.
The system provided one is in ROM and is more accurate.
This commit is contained in:
parent
fcace26d87
commit
297092a76a
@ -148,15 +148,6 @@ void mp_hal_delay_us(uint32_t us) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function could do with improvements (eg use ets_delay_us)
|
|
||||||
void mp_hal_delay_us_fast(uint32_t us) {
|
|
||||||
uint32_t delay = ets_get_cpu_frequency() / 19;
|
|
||||||
while (--us) {
|
|
||||||
for (volatile uint32_t i = delay; i; --i) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extern int mp_stream_errno;
|
extern int mp_stream_errno;
|
||||||
int *__errno() {
|
int *__errno() {
|
||||||
|
@ -47,7 +47,7 @@ __attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mp_hal_delay_us(uint32_t);
|
void mp_hal_delay_us(uint32_t);
|
||||||
void mp_hal_delay_us_fast(uint32_t);
|
#define mp_hal_delay_us_fast(us) ets_delay_us(us)
|
||||||
void mp_hal_set_interrupt_char(int c);
|
void mp_hal_set_interrupt_char(int c);
|
||||||
uint32_t mp_hal_get_cpu_freq(void);
|
uint32_t mp_hal_get_cpu_freq(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user