Expose splash group, add function to resize REPL terminal

This commit is contained in:
Kevin Matocha 2022-01-31 15:02:00 -06:00
parent ed4e8bb9a6
commit db0140f586
2 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include "shared/runtime/interrupt_char.h"
#include "supervisor/shared/autoreload.h"
#include "supervisor/shared/bluetooth/bluetooth.h"
#include "supervisor/shared/display.h"
#include "supervisor/shared/status_leds.h"
#include "supervisor/shared/stack.h"
#include "supervisor/shared/traceback.h"
@ -299,6 +300,17 @@ STATIC mp_obj_t supervisor_disable_ble_workflow(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow);
//| def reset_terminal(x_pixels: int, y_pixels: int) -> None:
//| """Adjust the pixel dimensions of the REPL console."""
//| ...
//|
STATIC mp_obj_t supervisor_reset_terminal(mp_obj_t x_pixels, mp_obj_t y_pixels) {
supervisor_stop_terminal();
supervisor_start_terminal(mp_obj_get_int(x_pixels), mp_obj_get_int(y_pixels));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(supervisor_reset_terminal_obj, supervisor_reset_terminal);
STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) },
{ 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[] = {
{ MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&supervisor_ticks_ms_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_previous_traceback), MP_ROM_PTR(&supervisor_get_previous_traceback_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable_ble_workflow), MP_ROM_PTR(&supervisor_disable_ble_workflow_obj) },
{ MP_ROM_QSTR(MP_QSTR_splash), MP_ROM_PTR(&circuitpython_splash) },
{ MP_ROM_QSTR(MP_QSTR_reset_terminal), MP_ROM_PTR(&supervisor_reset_terminal_obj) },
};
STATIC MP_DEFINE_CONST_DICT(supervisor_module_globals, supervisor_module_globals_table);

View File

@ -32,6 +32,7 @@
#if CIRCUITPY_TERMINALIO
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/displayio/TileGrid.h"
#include "shared-bindings/fontio/BuiltinFont.h"
#include "shared-bindings/terminalio/Terminal.h"
@ -45,6 +46,7 @@ extern const fontio_builtinfont_t supervisor_terminal_font;
extern displayio_bitmap_t supervisor_terminal_font_bitmap;
extern displayio_tilegrid_t supervisor_terminal_text_grid;
extern terminalio_terminal_obj_t supervisor_terminal;
extern displayio_group_t circuitpython_splash;
#endif