File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939#include "shared-module/displayio/__init__.h"
4040#endif
4141
42+ #if CIRCUITPY_SHARPDISPLAY
43+ #include "shared-bindings/sharpdisplay/SharpMemoryFramebuffer.h"
44+ #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h"
45+ #endif
46+
4247#if BOARD_I2C
4348// Statically allocate the I2C object so it can live past the end of the heap and into the next VM.
4449// That way it can be used by built-in I2CDisplay displays and be accessible through board.I2C().
@@ -148,10 +153,17 @@ void reset_board_busses(void) {
148153 bool display_using_spi = false;
149154 #if CIRCUITPY_DISPLAYIO
150155 for (uint8_t i = 0 ; i < CIRCUITPY_DISPLAY_LIMIT ; i ++ ) {
151- if (displays [i ].fourwire_bus .bus == spi_singleton ) {
156+ mp_const_obj_t bus_type = displays [i ].bus_base .type ;
157+ if (bus_type == & displayio_fourwire_type && displays [i ].fourwire_bus .bus == spi_singleton ) {
158+ display_using_spi = true;
159+ break ;
160+ }
161+ #if CIRCUITPY_SHARPDISPLAY
162+ if (displays [i ].bus_base .type == & sharpdisplay_framebuffer_type && displays [i ].sharpdisplay .bus == spi_singleton ) {
152163 display_using_spi = true;
153164 break ;
154165 }
166+ #endif
155167 }
156168 #endif
157169 if (!display_using_spi ) {
Original file line number Diff line number Diff line change 2626
2727primary_display_t displays [CIRCUITPY_DISPLAY_LIMIT ];
2828
29- #if CIRCUITPY_RGBMATRIX || CIRCUITPY_SHARPDISPLAY
29+ #if CIRCUITPY_RGBMATRIX
3030STATIC bool any_display_uses_this_framebuffer (mp_obj_base_t * obj ) {
3131 for (uint8_t i = 0 ; i < CIRCUITPY_DISPLAY_LIMIT ; i ++ ) {
3232 if (displays [i ].display_base .type == & framebufferio_framebufferdisplay_type ) {
@@ -186,11 +186,7 @@ void reset_displays(void) {
186186#if CIRCUITPY_SHARPDISPLAY
187187 } else if (displays [i ].bus_base .type == & sharpdisplay_framebuffer_type ) {
188188 sharpdisplay_framebuffer_obj_t * sharp = & displays [i ].sharpdisplay ;
189- if (any_display_uses_this_framebuffer (& sharp -> base )) {
190- common_hal_sharpdisplay_framebuffer_reset (sharp );
191- } else {
192- common_hal_sharpdisplay_framebuffer_deinit (sharp );
193- }
189+ common_hal_sharpdisplay_framebuffer_reset (sharp );
194190#endif
195191 } else {
196192 // Not an active display bus.
You can’t perform that action at this time.
0 commit comments