33
33
#include "shared/runtime/interrupt_char.h"
34
34
#include "supervisor/shared/autoreload.h"
35
35
#include "supervisor/shared/bluetooth/bluetooth.h"
36
+ #include "supervisor/shared/display.h"
36
37
#include "supervisor/shared/status_leds.h"
37
38
#include "supervisor/shared/stack.h"
38
39
#include "supervisor/shared/traceback.h"
@@ -299,6 +300,21 @@ STATIC mp_obj_t supervisor_disable_ble_workflow(void) {
299
300
}
300
301
MP_DEFINE_CONST_FUN_OBJ_0 (supervisor_disable_ble_workflow_obj , supervisor_disable_ble_workflow );
301
302
303
+ //| def reset_terminal(x_pixels: int, y_pixels: int) -> None:
304
+ //| """Reset the CircuitPython serial terminal with new dimensions."""
305
+ //| ...
306
+ //|
307
+ STATIC mp_obj_t supervisor_reset_terminal (mp_obj_t x_pixels , mp_obj_t y_pixels ) {
308
+ #if CIRCUITPY_DISPLAYIO
309
+ supervisor_stop_terminal ();
310
+ supervisor_start_terminal (mp_obj_get_int (x_pixels ), mp_obj_get_int (y_pixels ));
311
+ #else
312
+ mp_raise_NotImplementedError (NULL );
313
+ #endif
314
+ return mp_const_none ;
315
+ }
316
+ MP_DEFINE_CONST_FUN_OBJ_2 (supervisor_reset_terminal_obj , supervisor_reset_terminal );
317
+
302
318
STATIC const mp_rom_map_elem_t supervisor_module_globals_table [] = {
303
319
{ MP_ROM_QSTR (MP_QSTR___name__ ), MP_ROM_QSTR (MP_QSTR_supervisor ) },
304
320
{ MP_ROM_QSTR (MP_QSTR_enable_autoreload ), MP_ROM_PTR (& supervisor_enable_autoreload_obj ) },
@@ -312,6 +328,7 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
312
328
{ MP_ROM_QSTR (MP_QSTR_ticks_ms ), MP_ROM_PTR (& supervisor_ticks_ms_obj ) },
313
329
{ MP_ROM_QSTR (MP_QSTR_get_previous_traceback ), MP_ROM_PTR (& supervisor_get_previous_traceback_obj ) },
314
330
{ MP_ROM_QSTR (MP_QSTR_disable_ble_workflow ), MP_ROM_PTR (& supervisor_disable_ble_workflow_obj ) },
331
+ { MP_ROM_QSTR (MP_QSTR_reset_terminal ), MP_ROM_PTR (& supervisor_reset_terminal_obj ) },
315
332
};
316
333
317
334
STATIC MP_DEFINE_CONST_DICT (supervisor_module_globals , supervisor_module_globals_table );
0 commit comments