File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
ports/stm/common-hal/busio Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,13 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
136136 const mcu_pin_obj_t * sck , const mcu_pin_obj_t * mosi ,
137137 const mcu_pin_obj_t * miso , bool half_duplex ) {
138138
139+ // Ensure the object starts in its deinit state before check_pins sets
140+ // self->sck, self->mosi, and self->miso.
141+ common_hal_busio_spi_mark_deinit (self );
142+
139143 int periph_index = check_pins (self , sck , mosi , miso );
140144 SPI_TypeDef * SPIx = mcu_spi_banks [periph_index - 1 ];
141145
142- // Ensure the object starts in its deinit state.
143- common_hal_busio_spi_mark_deinit (self );
144-
145146 // Start GPIO for each pin
146147 GPIO_InitTypeDef GPIO_InitStruct = {0 };
147148 GPIO_InitStruct .Pin = pin_mask (sck -> number );
You can’t perform that action at this time.
0 commit comments