Skip to content

Commit db0140f

Browse files
Kevin MatochaKevin Matocha
Kevin Matocha
authored and
Kevin Matocha
committed
Expose splash group, add function to resize REPL terminal
1 parent ed4e8bb commit db0140f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

shared-bindings/supervisor/__init__.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "shared/runtime/interrupt_char.h"
3434
#include "supervisor/shared/autoreload.h"
3535
#include "supervisor/shared/bluetooth/bluetooth.h"
36+
#include "supervisor/shared/display.h"
3637
#include "supervisor/shared/status_leds.h"
3738
#include "supervisor/shared/stack.h"
3839
#include "supervisor/shared/traceback.h"
@@ -299,6 +300,17 @@ STATIC mp_obj_t supervisor_disable_ble_workflow(void) {
299300
}
300301
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow);
301302

303+
//| def reset_terminal(x_pixels: int, y_pixels: int) -> None:
304+
//| """Adjust the pixel dimensions of the REPL console."""
305+
//| ...
306+
//|
307+
STATIC mp_obj_t supervisor_reset_terminal(mp_obj_t x_pixels, mp_obj_t y_pixels) {
308+
supervisor_stop_terminal();
309+
supervisor_start_terminal(mp_obj_get_int(x_pixels), mp_obj_get_int(y_pixels));
310+
return mp_const_none;
311+
}
312+
MP_DEFINE_CONST_FUN_OBJ_2(supervisor_reset_terminal_obj, supervisor_reset_terminal);
313+
302314
STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
303315
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) },
304316
{ MP_ROM_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) },
@@ -312,6 +324,8 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
312324
{ MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&supervisor_ticks_ms_obj) },
313325
{ MP_ROM_QSTR(MP_QSTR_get_previous_traceback), MP_ROM_PTR(&supervisor_get_previous_traceback_obj) },
314326
{ MP_ROM_QSTR(MP_QSTR_disable_ble_workflow), MP_ROM_PTR(&supervisor_disable_ble_workflow_obj) },
327+
{ MP_ROM_QSTR(MP_QSTR_splash), MP_ROM_PTR(&circuitpython_splash) },
328+
{ MP_ROM_QSTR(MP_QSTR_reset_terminal), MP_ROM_PTR(&supervisor_reset_terminal_obj) },
315329
};
316330

317331
STATIC MP_DEFINE_CONST_DICT(supervisor_module_globals, supervisor_module_globals_table);

supervisor/shared/display.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#if CIRCUITPY_TERMINALIO
3333

3434
#include "shared-bindings/displayio/Bitmap.h"
35+
#include "shared-bindings/displayio/Group.h"
3536
#include "shared-bindings/displayio/TileGrid.h"
3637
#include "shared-bindings/fontio/BuiltinFont.h"
3738
#include "shared-bindings/terminalio/Terminal.h"
@@ -45,6 +46,7 @@ extern const fontio_builtinfont_t supervisor_terminal_font;
4546
extern displayio_bitmap_t supervisor_terminal_font_bitmap;
4647
extern displayio_tilegrid_t supervisor_terminal_text_grid;
4748
extern terminalio_terminal_obj_t supervisor_terminal;
49+
extern displayio_group_t circuitpython_splash;
4850

4951
#endif
5052

0 commit comments

Comments
 (0)