File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
ports/stm/common-hal/busio Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,15 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
293
293
self -> handle .Init .CLKPolarity = (polarity ) ? SPI_POLARITY_HIGH : SPI_POLARITY_LOW ;
294
294
self -> handle .Init .CLKPhase = (phase ) ? SPI_PHASE_2EDGE : SPI_PHASE_1EDGE ;
295
295
296
+ // Set SCK pull up or down based on SPI CLK Polarity
297
+ GPIO_InitTypeDef GPIO_InitStruct = {0 };
298
+ GPIO_InitStruct .Pin = pin_mask (self -> sck -> pin -> number );
299
+ GPIO_InitStruct .Mode = GPIO_MODE_AF_PP ;
300
+ GPIO_InitStruct .Pull = (polarity ) ? GPIO_PULLUP : GPIO_PULLDOWN ;
301
+ GPIO_InitStruct .Speed = GPIO_SPEED_FREQ_VERY_HIGH ;
302
+ GPIO_InitStruct .Alternate = self -> sck -> altfn_index ;
303
+ HAL_GPIO_Init (pin_port (self -> sck -> pin -> port ), & GPIO_InitStruct );
304
+
296
305
self -> handle .Init .BaudRatePrescaler = stm32_baud_to_spi_div (baudrate , & self -> prescaler ,
297
306
get_busclock (self -> handle .Instance ));
298
307
You can’t perform that action at this time.
0 commit comments