diff options
| author | Damien George <damien@micropython.org> | 2021-02-18 21:24:34 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-04-15 10:31:06 +1000 |
| commit | 66a86a061530eeee51191c3c667e9bc3cfcfda40 (patch) | |
| tree | e2e0e6d63f4dc16d47a7f0a855dd2b43f07ebc5b /ports/esp32/machine_timer.c | |
| parent | 8459f538eb45fd8e1e4d614298449cf18de84d75 (diff) | |
esp32: Add initial support for ESP32S2 SoCs.
Builds against IDF v4.3-beta2.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/esp32/machine_timer.c')
| -rw-r--r-- | ports/esp32/machine_timer.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ports/esp32/machine_timer.c b/ports/esp32/machine_timer.c index 6e5824094..696127af7 100644 --- a/ports/esp32/machine_timer.c +++ b/ports/esp32/machine_timer.c @@ -30,12 +30,17 @@ #include <stdint.h> #include <stdio.h> -#include "driver/timer.h" #include "py/obj.h" #include "py/runtime.h" #include "modmachine.h" #include "mphalport.h" +#include "driver/timer.h" +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 1) +#include "hal/timer_ll.h" +#define HAVE_TIMER_LL (1) +#endif + #define TIMER_INTR_SEL TIMER_INTR_LEVEL #define TIMER_DIVIDER 8 @@ -127,6 +132,18 @@ STATIC void machine_timer_isr(void *self_in) { machine_timer_obj_t *self = self_in; timg_dev_t *device = self->group ? &(TIMERG1) : &(TIMERG0); + #if HAVE_TIMER_LL + + #if CONFIG_IDF_TARGET_ESP32 + device->hw_timer[self->index].update = 1; + #else + device->hw_timer[self->index].update.update = 1; + #endif + timer_ll_clear_intr_status(device, self->index); + timer_ll_set_alarm_enable(device, self->index, self->repeat); + + #else + device->hw_timer[self->index].update = 1; if (self->index) { device->int_clr_timers.t1 = 1; @@ -135,6 +152,8 @@ STATIC void machine_timer_isr(void *self_in) { } device->hw_timer[self->index].config.alarm_en = self->repeat; + #endif + mp_sched_schedule(self->callback, self); mp_hal_wake_main_task_from_isr(); } |
