File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
bsp/stm32/libraries/HAL_Drivers Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,10 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *
293293
294294 if (message -> cs_take && !(device -> config .mode & RT_SPI_NO_CS ))
295295 {
296- HAL_GPIO_WritePin (cs -> GPIOx , cs -> GPIO_Pin , GPIO_PIN_RESET );
296+ if (device -> config .mode & RT_SPI_CS_HIGH )
297+ HAL_GPIO_WritePin (cs -> GPIOx , cs -> GPIO_Pin , GPIO_PIN_SET );
298+ else
299+ HAL_GPIO_WritePin (cs -> GPIOx , cs -> GPIO_Pin , GPIO_PIN_RESET );
297300 }
298301
299302 LOG_D ("%s transfer prepare and start" , spi_drv -> config -> bus_name );
@@ -387,7 +390,10 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *
387390
388391 if (message -> cs_release && !(device -> config .mode & RT_SPI_NO_CS ))
389392 {
390- HAL_GPIO_WritePin (cs -> GPIOx , cs -> GPIO_Pin , GPIO_PIN_SET );
393+ if (device -> config .mode & RT_SPI_CS_HIGH )
394+ HAL_GPIO_WritePin (cs -> GPIOx , cs -> GPIO_Pin , GPIO_PIN_RESET );
395+ else
396+ HAL_GPIO_WritePin (cs -> GPIOx , cs -> GPIO_Pin , GPIO_PIN_SET );
391397 }
392398
393399 return message -> length ;
You can’t perform that action at this time.
0 commit comments