|
9 | 9 | #include "shared-bindings/displayio/Palette.h" |
10 | 10 | #include "shared-bindings/displayio/Sprite.h" |
11 | 11 | #include "supervisor/shared/display.h" |
| 12 | +#include "supervisor/memory.h" |
12 | 13 | #include "supervisor/usb.h" |
13 | 14 |
|
14 | 15 | primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; |
@@ -68,76 +69,24 @@ void displayio_refresh_displays(void) { |
68 | 69 | } |
69 | 70 | } |
70 | 71 |
|
71 | | -uint32_t blinka_bitmap_data[32] = { |
72 | | - 0x00000011, 0x11000000, |
73 | | - 0x00000111, 0x53100000, |
74 | | - 0x00000111, 0x56110000, |
75 | | - 0x00000111, 0x11140000, |
76 | | - 0x00000111, 0x20002000, |
77 | | - 0x00000011, 0x13000000, |
78 | | - 0x00000001, 0x11200000, |
79 | | - 0x00000000, 0x11330000, |
80 | | - 0x00000000, 0x01122000, |
81 | | - 0x00001111, 0x44133000, |
82 | | - 0x00032323, 0x24112200, |
83 | | - 0x00111114, 0x44113300, |
84 | | - 0x00323232, 0x34112200, |
85 | | - 0x11111144, 0x44443300, |
86 | | - 0x11111111, 0x11144401, |
87 | | - 0x23232323, 0x21111110 |
88 | | -}; |
89 | | - |
90 | | -displayio_bitmap_t blinka_bitmap = { |
91 | | - .base = {.type = &displayio_bitmap_type }, |
92 | | - .width = 16, |
93 | | - .height = 16, |
94 | | - .data = blinka_bitmap_data, |
95 | | - .stride = 2, |
96 | | - .bits_per_value = 4, |
97 | | - .x_shift = 3, |
98 | | - .x_mask = 0x7, |
99 | | - .bitmask = 0xf |
100 | | -}; |
101 | | - |
102 | | -uint32_t blinka_transparency[1] = {0x80000000}; |
103 | | - |
104 | | -// These colors are RGB 565 with the bytes swapped. |
105 | | -uint32_t blinka_colors[8] = {0x78890000, 0x9F86B8FC, 0xffff0D5A, 0x0000f501, |
106 | | - 0x00000000, 0x00000000, 0x00000000, 0x00000000}; |
107 | | - |
108 | | -displayio_palette_t blinka_palette = { |
109 | | - .base = {.type = &displayio_palette_type }, |
110 | | - .opaque = blinka_transparency, |
111 | | - .colors = blinka_colors, |
112 | | - .color_count = 16, |
113 | | - .needs_refresh = false |
114 | | -}; |
115 | | - |
116 | | -displayio_sprite_t blinka_sprite = { |
117 | | - .base = {.type = &displayio_sprite_type }, |
118 | | - .bitmap = &blinka_bitmap, |
119 | | - .pixel_shader = &blinka_palette, |
120 | | - .x = 0, |
121 | | - .y = 0, |
122 | | - .width = 16, |
123 | | - .height = 16, |
124 | | - .needs_refresh = false |
125 | | -}; |
126 | | - |
127 | | -mp_obj_t splash_children[1] = { |
128 | | - &blinka_sprite, |
129 | | -}; |
| 72 | +void common_hal_displayio_release_displays(void) { |
| 73 | + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { |
| 74 | + mp_const_obj_t bus_type = displays[i].fourwire_bus.base.type; |
| 75 | + if (bus_type == NULL) { |
| 76 | + continue; |
| 77 | + } else if (bus_type == &displayio_fourwire_type) { |
| 78 | + common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus); |
| 79 | + } else if (bus_type == &displayio_parallelbus_type) { |
| 80 | + common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus); |
| 81 | + } |
| 82 | + displays[i].fourwire_bus.base.type = &mp_type_NoneType; |
| 83 | + } |
| 84 | + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { |
| 85 | + displays[i].display.base.type = &mp_type_NoneType; |
| 86 | + } |
130 | 87 |
|
131 | | -displayio_group_t splash = { |
132 | | - .base = {.type = &displayio_group_type }, |
133 | | - .x = 0, |
134 | | - .y = 0, |
135 | | - .scale = 2, |
136 | | - .size = 1, |
137 | | - .max_size = 1, |
138 | | - .children = splash_children, |
139 | | - .needs_refresh = true |
140 | | -}; |
| 88 | + supervisor_stop_terminal(); |
| 89 | +} |
141 | 90 |
|
142 | 91 | void reset_displays(void) { |
143 | 92 | // The SPI buses used by FourWires may be allocated on the heap so we need to move them inline. |
@@ -168,23 +117,6 @@ void reset_displays(void) { |
168 | 117 | continue; |
169 | 118 | } |
170 | 119 | displayio_display_obj_t* display = &displays[i].display; |
171 | | - common_hal_displayio_display_show(display, &splash); |
172 | | - } |
173 | | -} |
174 | | - |
175 | | -void common_hal_displayio_release_displays(void) { |
176 | | - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { |
177 | | - mp_const_obj_t bus_type = displays[i].fourwire_bus.base.type; |
178 | | - if (bus_type == NULL) { |
179 | | - continue; |
180 | | - } else if (bus_type == &displayio_fourwire_type) { |
181 | | - common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus); |
182 | | - } else if (bus_type == &displayio_parallelbus_type) { |
183 | | - common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus); |
184 | | - } |
185 | | - displays[i].fourwire_bus.base.type = &mp_type_NoneType; |
186 | | - } |
187 | | - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { |
188 | | - displays[i].display.base.type = &mp_type_NoneType; |
| 120 | + common_hal_displayio_display_show(display, &circuitpython_splash); |
189 | 121 | } |
190 | 122 | } |
0 commit comments