[bsp]: fix spi chipselect in Infineon (#7234)

1. compatible for HIGH ACTIVE SPI CHIP_SELECT
This commit is contained in:
Lu_Reaper 2023-04-14 00:27:03 +08:00 committed by GitHub
parent 8487caad4b
commit af914a1690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -179,8 +179,15 @@ static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *m
/* take CS */ /* take CS */
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE)) if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
{
if (device->config.mode & RT_SPI_CS_HIGH)
{
cyhal_gpio_write(device->cs_pin, PIN_HIGH);
}
else
{ {
cyhal_gpio_write(device->cs_pin, PIN_LOW); cyhal_gpio_write(device->cs_pin, PIN_LOW);
}
LOG_D("spi take cs\n"); LOG_D("spi take cs\n");
} }