File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,15 @@ void mp_hal_delay_us(uint32_t us) {
93
93
vTaskDelay (us / 1000 / portTICK_PERIOD_MS );
94
94
}
95
95
96
+ // this function could do with improvements
97
+ void mp_hal_delay_us_fast (uint32_t us ) {
98
+ uint32_t delay = ets_get_cpu_frequency () / 19 ;
99
+ while (-- us ) {
100
+ for (volatile uint32_t i = delay ; i ; -- i ) {
101
+ }
102
+ }
103
+ }
104
+
96
105
/*
97
106
extern int mp_stream_errno;
98
107
int *__errno() {
Original file line number Diff line number Diff line change @@ -42,10 +42,10 @@ __attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) {
42
42
}
43
43
44
44
void mp_hal_delay_us (uint32_t );
45
+ void mp_hal_delay_us_fast (uint32_t );
45
46
void mp_hal_set_interrupt_char (int c );
46
47
uint32_t mp_hal_get_cpu_freq (void );
47
48
48
- #define mp_hal_delay_us_fast (us ) mp_hal_delay_us(us) // TODO
49
49
#define mp_hal_quiet_timing_enter () disable_irq()
50
50
#define mp_hal_quiet_timing_exit (irq_state ) enable_irq(irq_state)
51
51
You can’t perform that action at this time.
0 commit comments