Requested review changes made
This commit is contained in:
parent
f5f2036881
commit
44425b8d94
|
@ -55,8 +55,7 @@
|
|||
|
||||
uint32_t* heap;
|
||||
uint32_t heap_size;
|
||||
extern TaskHandle_t xTaskToNotify;
|
||||
|
||||
extern TaskHandle_t sleeping_circuitpython_task;
|
||||
STATIC esp_timer_handle_t _tick_timer;
|
||||
|
||||
extern void esp_restart(void) NORETURN;
|
||||
|
@ -191,23 +190,23 @@ void port_disable_tick(void) {
|
|||
}
|
||||
|
||||
TickType_t sleep_time_duration;
|
||||
uint32_t NotifyValue = 0;
|
||||
BaseType_t notify_wait = 0;
|
||||
|
||||
void port_interrupt_after_ticks(uint32_t ticks) {
|
||||
sleep_time_duration = (ticks * 100)/1024;
|
||||
xTaskToNotify = xTaskGetCurrentTaskHandle();
|
||||
sleeping_circuitpython_task = xTaskGetCurrentTaskHandle();
|
||||
}
|
||||
|
||||
void port_sleep_until_interrupt(void) {
|
||||
|
||||
uint32_t NotifyValue = 0;
|
||||
|
||||
if (sleep_time_duration == 0) {
|
||||
return;
|
||||
}
|
||||
notify_wait = xTaskNotifyWait(0x01,0x01,&NotifyValue,
|
||||
xTaskNotifyWait(0x01,0x01,&NotifyValue,
|
||||
sleep_time_duration );
|
||||
if (NotifyValue == 1) {
|
||||
xTaskToNotify = NULL;
|
||||
sleeping_circuitpython_task = NULL;
|
||||
mp_handle_pending();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
StackType_t usb_device_stack[USBD_STACK_SIZE];
|
||||
StaticTask_t usb_device_taskdef;
|
||||
|
||||
TaskHandle_t xTaskToNotify = NULL;
|
||||
TaskHandle_t sleeping_circuitpython_task = NULL;
|
||||
|
||||
// USB Device Driver task
|
||||
// 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)
|
|||
if (mp_interrupt_char == wanted_char) {
|
||||
tud_cdc_read_flush(); // flush read fifo
|
||||
mp_keyboard_interrupt();
|
||||
if (xTaskToNotify != NULL) {
|
||||
xTaskNotifyGive(xTaskToNotify);
|
||||
// CircuitPython's VM is run in a separate FreeRTOS task from TinyUSB.
|
||||
// So, we must notify the other task when a CTRL-C is received.
|
||||
if (sleeping_circuitpython_task != NULL) {
|
||||
xTaskNotifyGive(sleeping_circuitpython_task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue