Skip to content

Commit 05a33c3

Browse files
committed
Another attempt at fixing the timer
1 parent 0e31de1 commit 05a33c3

File tree

2 files changed

+3
-41
lines changed

2 files changed

+3
-41
lines changed

ext_mod/lcd_bus/esp32_include/rgb_bus.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
#include "py/obj.h"
3434
#include "py/objarray.h"
3535

36-
37-
#if CONFIG_IDF_TARGET_ESP32S3
38-
#define RGB_LCD_BUS_NEEDS_SEPARATE_RESTART_LINK 1
39-
#endif
40-
4136
typedef struct {
4237
esp_lcd_panel_t base; // Base class of generic lcd panel
4338
int panel_id; // LCD panel ID
@@ -52,9 +47,9 @@
5247
esp_pm_lock_handle_t pm_lock; // Power management lock
5348
size_t num_dma_nodes; // Number of DMA descriptors that used to carry the frame buffer
5449
gdma_channel_handle_t dma_chan; // DMA channel handle
55-
gdma_link_list_handle_t dma_fb_links[RGB_LCD_PANEL_MAX_FB_NUM]; // DMA link lists for multiple frame buffers
50+
gdma_link_list_handle_t dma_fb_links[3]; // DMA link lists for multiple frame buffers
5651
gdma_link_list_handle_t dma_bb_link; // DMA link list for bounce buffer
57-
#if RGB_LCD_BUS_NEEDS_SEPARATE_RESTART_LINK
52+
#if CONFIG_IDF_TARGET_ESP32S3
5853
gdma_link_list_handle_t dma_restart_link; // DMA link list for restarting the DMA
5954
#endif
6055
uint8_t *fbs[3]; // Frame buffers

micropy_updates/esp32/machine_timer.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -131,40 +131,7 @@ static void machine_timer_isr(void *self_in)
131131
{
132132
machine_timer_obj_t *self = self_in;
133133

134-
volatile uint32_t sp = (uint32_t)esp_cpu_get_sp();
135-
136-
void *old_state = mp_thread_get_state();
137-
138-
mp_state_thread_t ts;
139-
mp_thread_set_state(&ts);
140-
mp_stack_set_top((void*)sp);
141-
mp_stack_set_limit(CONFIG_FREERTOS_IDLE_TASK_STACKSIZE - 1024);
142-
mp_locals_set(mp_state_ctx.thread.dict_locals);
143-
mp_globals_set(mp_state_ctx.thread.dict_globals);
144-
145-
mp_sched_lock();
146-
gc_lock();
147-
148-
nlr_buf_t nlr;
149-
if (nlr_push(&nlr) == 0) {
150-
mp_obj_t args[1];
151-
args[0] = MP_OBJ_FROM_PTR(self);
152-
153-
mp_call_function_n_kw(self->callback, 1, 0, args);
154-
nlr_pop();
155-
} else {
156-
ets_printf("Uncaught exception in IRQ callback handler!\n");
157-
mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
158-
}
159-
160-
if (self->repeat) {
161-
self->period_time = esp_timer_get_time();
162-
}
163-
164-
gc_unlock();
165-
mp_sched_unlock();
166-
167-
mp_thread_set_state(old_state);
134+
mp_sched_schedule(self->callback, self);
168135
mp_hal_wake_main_task_from_isr();
169136
}
170137

0 commit comments

Comments
 (0)