Skip to content

Commit 24a18c6

Browse files
committed
Moved SPI unlock to reset_board_busses()
1 parent 8d27533 commit 24a18c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shared-module/board/__init__.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ mp_obj_t common_hal_board_create_spi(void) {
8989
const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MOSI);
9090
const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MISO);
9191
common_hal_busio_spi_construct(self, clock, mosi, miso);
92-
// make sure lock is not held initially
93-
common_hal_busio_spi_unlock(self);
9492
spi_singleton = (mp_obj_t)self;
9593
return spi_singleton;
9694
}
@@ -153,6 +151,7 @@ void reset_board_busses(void) {
153151
#endif
154152
#if BOARD_SPI
155153
bool display_using_spi = false;
154+
busio_spi_obj_t *self = &spi_obj;
156155
#if CIRCUITPY_DISPLAYIO
157156
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
158157
mp_const_obj_t bus_type = displays[i].bus_base.type;
@@ -169,6 +168,8 @@ void reset_board_busses(void) {
169168
}
170169
#endif
171170
if (!display_using_spi) {
171+
// make sure lock is not held over a soft reset
172+
common_hal_busio_spi_unlock(self);
172173
spi_singleton = NULL;
173174
}
174175
#endif

0 commit comments

Comments
 (0)