[drv_spi.c] 修复 stm32 drv_spi.c文件中的 spixfer 未实现片选为高电平的 spi 设备
This commit is contained in:
parent
24f2ce62ba
commit
3c32e0168d
|
@ -293,6 +293,9 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *
|
||||||
|
|
||||||
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS))
|
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS))
|
||||||
{
|
{
|
||||||
|
if(device->config.mode & RT_SPI_CS_HIGH)
|
||||||
|
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_SET);
|
||||||
|
else
|
||||||
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,6 +390,9 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *
|
||||||
|
|
||||||
if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS))
|
if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS))
|
||||||
{
|
{
|
||||||
|
if(device->config.mode & RT_SPI_CS_HIGH)
|
||||||
|
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_RESET);
|
||||||
|
else
|
||||||
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue