Skip to content

Commit b542c14

Browse files
committed
reset_board_buses: need to check if sharpdisplay uses SPI bus
1 parent a28d0f6 commit b542c14

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

shared-module/board/__init__.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
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,12 +153,19 @@ 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) {
152158
display_using_spi = true;
153159
break;
154160
}
155-
}
161+
#if CIRCUITPY_SHARPDISPLAY
162+
if (displays[i].bus_base.type == &sharpdisplay_framebuffer_type && displays[i].sharpdisplay.bus == spi_singleton) {
163+
display_using_spi = true;
164+
break;
165+
}
166+
#endif
156167
#endif
168+
}
157169
if (!display_using_spi) {
158170
spi_singleton = NULL;
159171
}

0 commit comments

Comments
 (0)