提交 3c32e016 编写于 作者: L liukangcc

[drv_spi.c] 修复 stm32 drv_spi.c文件中的 spixfer 未实现片选为高电平的 spi 设备

上级 24f2ce62
......@@ -293,7 +293,10 @@ 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))
{
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_RESET);
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);
}
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 *
if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS))
{
HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_SET);
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);
}
return message->length;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册