esp32: Add initial support for ESP32S2 SoCs.

Builds against IDF v4.3-beta2.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-02-18 21:24:34 +11:00
parent 8459f538eb
commit 66a86a0615
18 changed files with 125 additions and 20 deletions

View File

@@ -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();
}