diff options
| author | Dan Halbert <halbert@adafruit.com> | 2019-06-11 17:43:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-11 17:43:22 -0400 |
| commit | 541c2a70acab02c419f1ddd4a0ffc38c23a054a0 (patch) | |
| tree | 7829990c07bbd80c490bc03508d6e0d1c25e166b /shared-module/displayio | |
| parent | c85e111675ccfb0c03aa06bd3461f5a3c026ec87 (diff) | |
| parent | 4fc189b60c800f097db55c16768fa8c73eb72ccf (diff) | |
Merge pull request #1938 from dhalbert/4.0.x-merge-to-master-2019-06-11
Merge latest 4.0.x changes to master
Diffstat (limited to 'shared-module/displayio')
| -rw-r--r-- | shared-module/displayio/__init__.c | 16 | ||||
| -rw-r--r-- | shared-module/displayio/__init__.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 0f2e727dc..35bdad8fe 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -3,6 +3,7 @@ #include "shared-module/displayio/__init__.h" #include "lib/utils/interrupt_char.h" +#include "py/gc.h" #include "py/reload.h" #include "py/runtime.h" #include "shared-bindings/board/__init__.h" @@ -192,7 +193,6 @@ void common_hal_displayio_release_displays(void) { } void reset_displays(void) { - #if CIRCUITPY_DISPLAYIO // The SPI buses used by FourWires may be allocated on the heap so we need to move them inline. for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].fourwire_bus.base.type != &displayio_fourwire_type) { @@ -229,7 +229,19 @@ void reset_displays(void) { display->auto_brightness = true; common_hal_displayio_display_show(display, &circuitpython_splash); } - #endif +} + +void displayio_gc_collect(void) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + if (displays[i].display.base.type == NULL) { + continue; + } + + // Alternatively, we could use gc_collect_root over the whole object, + // but this is more precise, and is the only field that needs marking. + gc_collect_ptr(displays[i].display.current_group); + + } } void displayio_area_shift(displayio_area_t* area, int16_t dx, int16_t dy) { diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index 7ffc8eab2..18c1a4f4a 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -46,5 +46,6 @@ extern displayio_group_t circuitpython_splash; void displayio_refresh_displays(void); void reset_displays(void); +void displayio_gc_collect(void); #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO___INIT___H |
