Skip to content

Commit 93ea1bd

Browse files
committed
Add a flag for removing the Blinka logo from the REPL
There may be several reasons why we might want to remove the logo form the REPL: a fork of CircuitPython that doesn't have the right to use the logo, an especially small display that needs all the room it has to be useful, displays that are especially vulnerable to burn-in, maybe even the smaller chips where we want to save as much flash memory as possible.
1 parent 08b44ea commit 93ea1bd

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
#define IGNORE_PIN_PB11 1
3737

3838
#define SAMD5x_E5x_BOD33_LEVEL (100)
39+
#define CIRCUITPY_REPL_LOGO 0

py/circuitpy_mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,11 @@ void supervisor_run_background_tasks_if_tick(void);
480480
#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (1)
481481
#endif
482482

483+
// Display the Blinka logo in the REPL on displayio displays.
484+
#ifndef CIRCUITPY_REPL_LOGO
485+
#define CIRCUITPY_REPL_LOGO (1)
486+
#endif
487+
483488
// USB settings
484489

485490
// If the port requires certain USB endpoint numbers, define these in mpconfigport.h.

supervisor/shared/display.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@
4545
#include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h"
4646
#endif
4747

48+
#if CIRCUITPY_REPL_LOGO
4849
extern uint32_t blinka_bitmap_data[];
4950
extern displayio_bitmap_t blinka_bitmap;
51+
#endif
5052
extern displayio_group_t circuitpython_splash;
5153

5254
#if CIRCUITPY_TERMINALIO
@@ -62,8 +64,13 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
6264
displayio_tilegrid_t *grid = &supervisor_terminal_text_grid;
6365
bool tall = height_px > width_px;
6466
bool reset_tiles = false;
67+
#if CIRCUITPY_REPL_LOGO
6568
uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width;
6669
uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px;
70+
#else
71+
uint16_t terminal_width_px = width_px;
72+
uint16_t terminal_height_px = height_px;
73+
#endif
6774
uint16_t width_in_tiles = terminal_width_px / grid->tile_width;
6875
// determine scale based on h
6976
if (width_in_tiles < 80) {
@@ -106,8 +113,13 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
106113
if (reset_tiles) {
107114
uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr;
108115

116+
#if CIRCUITPY_REPL_LOGO
109117
grid->y = tall ? blinka_bitmap.height : 0;
110118
grid->x = tall ? 0 : blinka_bitmap.width;
119+
#else
120+
grid->y = 0;
121+
grid->x = 0;
122+
#endif
111123
grid->top_left_y = 0;
112124
if (remaining_pixels > 0) {
113125
grid->y -= (grid->tile_height - remaining_pixels);
@@ -167,6 +179,7 @@ void supervisor_display_move_memory(void) {
167179
#endif
168180
}
169181

182+
#if CIRCUITPY_REPL_LOGO
170183
uint32_t blinka_bitmap_data[32] = {
171184
0x00000011, 0x11000000,
172185
0x00000111, 0x53100000,
@@ -281,8 +294,10 @@ displayio_tilegrid_t blinka_sprite = {
281294
.inline_tiles = true,
282295
.in_group = true
283296
};
297+
#endif
284298

285299
#if CIRCUITPY_TERMINALIO
300+
#if CIRCUITPY_REPL_LOGO
286301
mp_obj_t members[] = { &blinka_sprite, &supervisor_terminal_text_grid, };
287302
mp_obj_list_t splash_children = {
288303
.base = {.type = &mp_type_list },
@@ -291,13 +306,32 @@ mp_obj_list_t splash_children = {
291306
.items = members,
292307
};
293308
#else
309+
mp_obj_t members[] = { &supervisor_terminal_text_grid, };
310+
mp_obj_list_t splash_children = {
311+
.base = {.type = &mp_type_list },
312+
.alloc = 1,
313+
.len = 1,
314+
.items = members,
315+
};
316+
#endif
317+
#else
318+
#if CIRCUITPY_REPL_LOGO
294319
mp_obj_t members[] = { &blinka_sprite };
295320
mp_obj_list_t splash_children = {
296321
.base = {.type = &mp_type_list },
297322
.alloc = 1,
298323
.len = 1,
299324
.items = members,
300325
};
326+
#else
327+
mp_obj_t members[] = {};
328+
mp_obj_list_t splash_children = {
329+
.base = {.type = &mp_type_list },
330+
.alloc = 0,
331+
.len = 0,
332+
.items = members,
333+
};
334+
#endif
301335
#endif
302336

303337
displayio_group_t circuitpython_splash = {

0 commit comments

Comments
 (0)