Skip to content

Commit 3e60792

Browse files
committed
[bsp/renesas][drivers] Skip invalid chip select writes in SPI
1 parent 2b376fc commit 3e60792

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

  • bsp/renesas/libraries/HAL_Drivers/drivers

bsp/renesas/libraries/HAL_Drivers/drivers/drv_spi.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,17 @@ static rt_err_t ra_hw_spi_configure(struct rt_spi_device *device,
242242
spi_extended_cfg_t *spi_cfg = (spi_extended_cfg_t *)spi_dev->ra_spi_handle_t->spi_cfg_t->p_extend;
243243

244244
/**< Configure Select Line */
245-
rt_pin_write(device->cs_pin, PIN_HIGH);
245+
if (!(configuration->mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
246+
{
247+
if (configuration->mode & RT_SPI_CS_HIGH)
248+
{
249+
rt_pin_write(device->cs_pin, PIN_LOW);
250+
}
251+
else
252+
{
253+
rt_pin_write(device->cs_pin, PIN_HIGH);
254+
}
255+
}
246256

247257
/**< config bitrate */
248258
#if defined(SOC_SERIES_R7FA8M85) || defined(SOC_SERIES_R7KA8P1)

0 commit comments

Comments
 (0)