34
34
#include "shared-bindings/displayio/Palette.h"
35
35
#include "shared-bindings/displayio/TileGrid.h"
36
36
#include "supervisor/memory.h"
37
+ #include "supervisor/shared/title_bar.h"
37
38
38
39
#if CIRCUITPY_RGBMATRIX
39
40
#include "shared-module/displayio/__init__.h"
@@ -65,7 +66,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
65
66
displayio_tilegrid_t * title_bar = & supervisor_terminal_title_bar_text_grid ;
66
67
bool reset_tiles = false;
67
68
uint16_t width_in_tiles = width_px / scroll_area -> tile_width ;
68
- // determine scale based on h
69
+ // determine scale based on width
69
70
if (width_in_tiles < 80 ) {
70
71
scale = 1 ;
71
72
}
@@ -103,9 +104,9 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
103
104
uint8_t * tiles = (uint8_t * )tilegrid_tiles -> ptr ;
104
105
105
106
#if CIRCUITPY_REPL_LOGO
106
- title_bar -> x = blinka_bitmap . width ;
107
+ title_bar -> x = supervisor_blinka_sprite . pixel_width + 1 ;
107
108
// Align the title bar to the bottom of the logo.
108
- title_bar -> y = blinka_bitmap . height - title_bar -> tile_height ;
109
+ title_bar -> y = supervisor_blinka_sprite . pixel_height - title_bar -> tile_height ;
109
110
#else
110
111
title_bar -> x = 0 ;
111
112
title_bar -> y = 0 ;
@@ -120,22 +121,28 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
120
121
title_bar -> full_change = true;
121
122
122
123
scroll_area -> x = 0 ;
123
- #if CIRCUITPY_REPL_LOGO
124
- scroll_area -> y = blinka_bitmap .height ;
125
- #else
126
- scroll_area -> y = scroll_area -> tile_height ;
127
- #endif
128
124
scroll_area -> top_left_y = 0 ;
129
125
scroll_area -> width_in_tiles = width_in_tiles ;
130
126
scroll_area -> height_in_tiles = height_in_tiles - 1 ;
131
127
assert (width_in_tiles > 0 );
132
128
assert (height_in_tiles > 1 );
133
129
scroll_area -> pixel_width = width_in_tiles * scroll_area -> tile_width ;
134
130
scroll_area -> pixel_height = (height_in_tiles - 1 ) * scroll_area -> tile_height ;
131
+ #if CIRCUITPY_REPL_LOGO
132
+ scroll_area -> y = blinka_bitmap .height ;
133
+ #else
134
+ scroll_area -> y = title_bar -> tile_height ;
135
+ #endif
136
+ int16_t extra_height = (scroll_area -> pixel_height + scroll_area -> y ) - height_px ;
137
+ // Subtract extra height so that the bottom line fully shows. The top line will be under the
138
+ // title bar and Blinka logo.
139
+ scroll_area -> y -= extra_height ;
135
140
scroll_area -> tiles = tiles + width_in_tiles ;
136
141
scroll_area -> full_change = true;
137
142
138
143
common_hal_terminalio_terminal_construct (& supervisor_terminal , scroll_area , & supervisor_terminal_font , title_bar );
144
+ // Update the title bar since we just cleared the terminal.
145
+ supervisor_title_bar_update ();
139
146
}
140
147
#endif
141
148
@@ -186,134 +193,17 @@ void supervisor_display_move_memory(void) {
186
193
#endif
187
194
}
188
195
189
- #if CIRCUITPY_REPL_LOGO
190
- uint32_t blinka_bitmap_data [32 ] = {
191
- 0x00000011 , 0x11000000 ,
192
- 0x00000111 , 0x53100000 ,
193
- 0x00000111 , 0x56110000 ,
194
- 0x00000111 , 0x11140000 ,
195
- 0x00000111 , 0x20002000 ,
196
- 0x00000011 , 0x13000000 ,
197
- 0x00000001 , 0x11200000 ,
198
- 0x00000000 , 0x11330000 ,
199
- 0x00000000 , 0x01122000 ,
200
- 0x00001111 , 0x44133000 ,
201
- 0x00032323 , 0x24112200 ,
202
- 0x00111114 , 0x44113300 ,
203
- 0x00323232 , 0x34112200 ,
204
- 0x11111144 , 0x44443300 ,
205
- 0x11111111 , 0x11144401 ,
206
- 0x23232323 , 0x21111110
207
- };
208
-
209
- displayio_bitmap_t blinka_bitmap = {
210
- .base = {.type = & displayio_bitmap_type },
211
- .width = 16 ,
212
- .height = 16 ,
213
- .data = blinka_bitmap_data ,
214
- .stride = 2 ,
215
- .bits_per_value = 4 ,
216
- .x_shift = 3 ,
217
- .x_mask = 0x7 ,
218
- .bitmask = 0xf ,
219
- .read_only = true
220
- };
221
-
222
- _displayio_color_t blinka_colors [7 ] = {
223
- {
224
- .rgb888 = 0x000000 ,
225
- .rgb565 = 0x0000 ,
226
- .luma = 0x00 ,
227
- .chroma = 0 ,
228
- .transparent = true
229
- },
230
- {
231
- .rgb888 = 0x8428bc ,
232
- .rgb565 = 0x8978 ,
233
- .luma = 0xff , // We cheat the luma here. It is actually 0x60
234
- .hue = 184 ,
235
- .chroma = 148
236
- },
237
- {
238
- .rgb888 = 0xff89bc ,
239
- .rgb565 = 0xFCB8 ,
240
- .luma = 0xb5 ,
241
- .hue = 222 ,
242
- .chroma = 118
243
- },
244
- {
245
- .rgb888 = 0x7beffe ,
246
- .rgb565 = 0x869F ,
247
- .luma = 0xe0 ,
248
- .hue = 124 ,
249
- .chroma = 131
250
- },
251
- {
252
- .rgb888 = 0x51395f ,
253
- .rgb565 = 0x5A0D ,
254
- .luma = 0x47 ,
255
- .hue = 185 ,
256
- .chroma = 38
257
- },
258
- {
259
- .rgb888 = 0xffffff ,
260
- .rgb565 = 0xffff ,
261
- .luma = 0xff ,
262
- .chroma = 0
263
- },
264
- {
265
- .rgb888 = 0x0736a0 ,
266
- .rgb565 = 0x01f5 ,
267
- .luma = 0x44 ,
268
- .hue = 147 ,
269
- .chroma = 153
270
- },
271
- };
272
-
273
- displayio_palette_t blinka_palette = {
274
- .base = {.type = & displayio_palette_type },
275
- .colors = blinka_colors ,
276
- .color_count = 7 ,
277
- .needs_refresh = false
278
- };
279
-
280
- displayio_tilegrid_t blinka_sprite = {
281
- .base = {.type = & displayio_tilegrid_type },
282
- .bitmap = & blinka_bitmap ,
283
- .pixel_shader = & blinka_palette ,
284
- .x = 0 ,
285
- .y = 0 ,
286
- .pixel_width = 16 ,
287
- .pixel_height = 16 ,
288
- .bitmap_width_in_tiles = 1 ,
289
- .width_in_tiles = 1 ,
290
- .height_in_tiles = 1 ,
291
- .tile_width = 16 ,
292
- .tile_height = 16 ,
293
- .top_left_x = 16 ,
294
- .top_left_y = 16 ,
295
- .tiles = 0 ,
296
- .partial_change = false,
297
- .full_change = false,
298
- .hidden = false,
299
- .hidden_by_parent = false,
300
- .moved = false,
301
- .inline_tiles = true,
302
- .in_group = true
303
- };
304
- #endif
305
-
306
196
#if CIRCUITPY_TERMINALIO
307
197
#if CIRCUITPY_REPL_LOGO
308
- mp_obj_t members [] = { & blinka_sprite , & supervisor_terminal_title_bar_text_grid , & supervisor_terminal_scroll_area_text_grid , };
198
+ mp_obj_t members [] = { & supervisor_terminal_scroll_area_text_grid , & supervisor_blinka_sprite , & supervisor_terminal_title_bar_text_grid , };
309
199
mp_obj_list_t splash_children = {
310
200
.base = {.type = & mp_type_list },
311
201
.alloc = 3 ,
312
202
.len = 3 ,
313
203
.items = members ,
314
204
};
315
205
#else
316
- mp_obj_t members [] = { & supervisor_terminal_title_bar_text_grid , & supervisor_terminal_scroll_area_text_grid , };
206
+ mp_obj_t members [] = { & supervisor_terminal_scroll_area_text_grid , & supervisor_terminal_title_bar_text_grid , };
317
207
mp_obj_list_t splash_children = {
318
208
.base = {.type = & mp_type_list },
319
209
.alloc = 2 ,
@@ -323,7 +213,7 @@ mp_obj_list_t splash_children = {
323
213
#endif
324
214
#else
325
215
#if CIRCUITPY_REPL_LOGO
326
- mp_obj_t members [] = { & blinka_sprite };
216
+ mp_obj_t members [] = { & supervisor_blinka_sprite };
327
217
mp_obj_list_t splash_children = {
328
218
.base = {.type = & mp_type_list },
329
219
.alloc = 1 ,
0 commit comments