File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 55
55
56
56
uint32_t * heap ;
57
57
uint32_t heap_size ;
58
- extern TaskHandle_t xTaskToNotify ;
59
-
58
+ extern TaskHandle_t sleeping_circuitpython_task ;
60
59
STATIC esp_timer_handle_t _tick_timer ;
61
60
62
61
extern void esp_restart (void ) NORETURN ;
@@ -191,23 +190,23 @@ void port_disable_tick(void) {
191
190
}
192
191
193
192
TickType_t sleep_time_duration ;
194
- uint32_t NotifyValue = 0 ;
195
- BaseType_t notify_wait = 0 ;
196
193
197
194
void port_interrupt_after_ticks (uint32_t ticks ) {
198
195
sleep_time_duration = (ticks * 100 )/1024 ;
199
- xTaskToNotify = xTaskGetCurrentTaskHandle ();
196
+ sleeping_circuitpython_task = xTaskGetCurrentTaskHandle ();
200
197
}
201
198
202
199
void port_sleep_until_interrupt (void ) {
203
200
201
+ uint32_t NotifyValue = 0 ;
202
+
204
203
if (sleep_time_duration == 0 ) {
205
204
return ;
206
205
}
207
- notify_wait = xTaskNotifyWait (0x01 ,0x01 ,& NotifyValue ,
206
+ xTaskNotifyWait (0x01 ,0x01 ,& NotifyValue ,
208
207
sleep_time_duration );
209
208
if (NotifyValue == 1 ) {
210
- xTaskToNotify = NULL ;
209
+ sleeping_circuitpython_task = NULL ;
211
210
mp_handle_pending ();
212
211
}
213
212
}
Original file line number Diff line number Diff line change 52
52
StackType_t usb_device_stack [USBD_STACK_SIZE ];
53
53
StaticTask_t usb_device_taskdef ;
54
54
55
- TaskHandle_t xTaskToNotify = NULL ;
55
+ TaskHandle_t sleeping_circuitpython_task = NULL ;
56
56
57
57
// USB Device Driver task
58
58
// This top level thread process all usb events and invoke callbacks
@@ -129,8 +129,10 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char)
129
129
if (mp_interrupt_char == wanted_char ) {
130
130
tud_cdc_read_flush (); // flush read fifo
131
131
mp_keyboard_interrupt ();
132
- if (xTaskToNotify != NULL ) {
133
- xTaskNotifyGive (xTaskToNotify );
132
+ // CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB.
133
+ // So, we must notify the other task when a CTRL-C is received.
134
+ if (sleeping_circuitpython_task != NULL ) {
135
+ xTaskNotifyGive (sleeping_circuitpython_task );
134
136
}
135
137
}
136
138
}
You can’t perform that action at this time.
0 commit comments