File tree Expand file tree Collapse file tree 9 files changed +36
-8
lines changed Expand file tree Collapse file tree 9 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,11 @@ void gc_collect(void) {
455
455
// This collects root pointers from the VFS mount table. Some of them may
456
456
// have lost their references in the VM even though they are mounted.
457
457
gc_collect_root ((void * * )& MP_STATE_VM (vfs_mount_table ), sizeof (mp_vfs_mount_t ) / sizeof (mp_uint_t ));
458
+
459
+ #if CIRCUITPY_DISPLAYIO
460
+ displayio_gc_collect ();
461
+ #endif
462
+
458
463
// This naively collects all object references from an approximate stack
459
464
// range.
460
465
gc_collect_root ((void * * )sp , ((uint32_t )& _estack - sp ) / sizeof (uint32_t ));
Original file line number Diff line number Diff line change 29
29
#include "supervisor/usb.h"
30
30
#include "supervisor/shared/stack.h"
31
31
32
- #ifdef CIRCUITPY_DISPLAYIO
32
+ #if CIRCUITPY_DISPLAYIO
33
33
#include "shared-module/displayio/__init__.h"
34
34
#endif
35
35
@@ -48,7 +48,7 @@ void run_background_tasks(void) {
48
48
filesystem_background ();
49
49
usb_background ();
50
50
51
- #ifdef CIRCUITPY_DISPLAYIO
51
+ #if CIRCUITPY_DISPLAYIO
52
52
displayio_refresh_displays ();
53
53
#endif
54
54
running_background_tasks = false;
Original file line number Diff line number Diff line change @@ -93,16 +93,22 @@ void reset_port(void) {
93
93
i2c_reset ();
94
94
spi_reset ();
95
95
uart_reset ();
96
+
97
+ #if CIRCUITPY_PULSEIO
96
98
pwmout_reset ();
97
99
pulseout_reset ();
98
100
pulsein_reset ();
101
+ #endif
102
+
99
103
timers_reset ();
100
104
101
- #if CIRCUITPY_RTC
105
+ #if CIRCUITPY_RTC
102
106
rtc_reset ();
103
- #endif
107
+ #endif
104
108
109
+ #if CIRCUITPY_BLEIO
105
110
bleio_reset ();
111
+ #endif
106
112
107
113
reset_all_pins ();
108
114
}
Original file line number Diff line number Diff line change @@ -383,6 +383,10 @@ void gc_collect_start(void) {
383
383
#endif
384
384
}
385
385
386
+ void gc_collect_ptr (void * ptr ) {
387
+ gc_mark (ptr );
388
+ }
389
+
386
390
void gc_collect_root (void * * ptrs , size_t len ) {
387
391
for (size_t i = 0 ; i < len ; i ++ ) {
388
392
void * ptr = ptrs [i ];
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ bool gc_is_locked(void);
43
43
// A given port must implement gc_collect by using the other collect functions.
44
44
void gc_collect (void );
45
45
void gc_collect_start (void );
46
+ void gc_collect_ptr (void * ptr );
46
47
void gc_collect_root (void * * ptrs , size_t len );
47
48
void gc_collect_end (void );
48
49
Original file line number Diff line number Diff line change 34
34
//|
35
35
//| .. module:: board
36
36
//| :synopsis: Board specific pin names
37
- //| :platform: SAMD21
38
37
//|
39
38
//| Common container for board base pin names. These will vary from board to
40
39
//| board so don't expect portability when using this module.
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ void reset_board_busses(void) {
103
103
#endif
104
104
#if BOARD_SPI
105
105
bool display_using_spi = false;
106
- #ifdef CIRCUITPY_DISPLAYIO
106
+ #if CIRCUITPY_DISPLAYIO
107
107
for (uint8_t i = 0 ; i < CIRCUITPY_DISPLAY_LIMIT ; i ++ ) {
108
108
if (displays [i ].fourwire_bus .bus == spi_singleton ) {
109
109
display_using_spi = true;
Original file line number Diff line number Diff line change 3
3
#include "shared-module/displayio/__init__.h"
4
4
5
5
#include "lib/utils/interrupt_char.h"
6
+ #include "py/gc.h"
6
7
#include "py/reload.h"
7
8
#include "py/runtime.h"
8
9
#include "shared-bindings/board/__init__.h"
@@ -181,7 +182,6 @@ void common_hal_displayio_release_displays(void) {
181
182
}
182
183
183
184
void reset_displays (void ) {
184
- #if CIRCUITPY_DISPLAYIO
185
185
// The SPI buses used by FourWires may be allocated on the heap so we need to move them inline.
186
186
for (uint8_t i = 0 ; i < CIRCUITPY_DISPLAY_LIMIT ; i ++ ) {
187
187
if (displays [i ].fourwire_bus .base .type != & displayio_fourwire_type ) {
@@ -218,5 +218,17 @@ void reset_displays(void) {
218
218
display -> auto_brightness = true;
219
219
common_hal_displayio_display_show (display , & circuitpython_splash );
220
220
}
221
- #endif
221
+ }
222
+
223
+ void displayio_gc_collect (void ) {
224
+ for (uint8_t i = 0 ; i < CIRCUITPY_DISPLAY_LIMIT ; i ++ ) {
225
+ if (displays [i ].display .base .type == NULL ) {
226
+ continue ;
227
+ }
228
+
229
+ // Alternatively, we could use gc_collect_root over the whole object,
230
+ // but this is more precise, and is the only field that needs marking.
231
+ gc_collect_ptr (displays [i ].display .current_group );
232
+
233
+ }
222
234
}
Original file line number Diff line number Diff line change @@ -46,5 +46,6 @@ extern displayio_group_t circuitpython_splash;
46
46
47
47
void displayio_refresh_displays (void );
48
48
void reset_displays (void );
49
+ void displayio_gc_collect (void );
49
50
50
51
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H
You can’t perform that action at this time.
0 commit comments