summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
authorLu_Reaper <[email protected]>2023-04-14 00:27:03 +0800
committerGitHub <[email protected]>2023-04-14 00:27:03 +0800
commitaf914a16907385c8498ee8d270f76ca677d6d387 (patch)
tree84eaecd630376e6c96b771895825513c46a4678a /bsp
parent8487caad4bbeb66d8c70a9c5cec5261afe2c537f (diff)
[bsp]: fix spi chipselect in Infineon (#7234)
1. compatible for HIGH ACTIVE SPI CHIP_SELECT
Diffstat (limited to 'bsp')
-rw-r--r--bsp/Infineon/libraries/HAL_Drivers/drv_spi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bsp/Infineon/libraries/HAL_Drivers/drv_spi.c b/bsp/Infineon/libraries/HAL_Drivers/drv_spi.c
index 0d3c3f2cac..80448b19fc 100644
--- a/bsp/Infineon/libraries/HAL_Drivers/drv_spi.c
+++ b/bsp/Infineon/libraries/HAL_Drivers/drv_spi.c
@@ -180,7 +180,14 @@ static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *m
/* take CS */
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
{
- cyhal_gpio_write(device->cs_pin, PIN_LOW);
+ 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);
+ }
LOG_D("spi take cs\n");
}