From 8c99bf3b623dc3f19d4f028a37f8013f5391883c Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Thu, 20 Jul 2017 16:05:15 +0200 Subject: [PATCH] SPI: HAL: disable IP at the end of transmit in case of 1LINE direction --- targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_spi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_spi.c b/targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_spi.c index d60c326dcf..95068ef614 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_spi.c +++ b/targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_spi.c @@ -655,6 +655,10 @@ HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint hspi->ErrorCode = HAL_SPI_ERROR_FLAG; } + if (hspi->Init.Direction == SPI_DIRECTION_1LINE) { + __HAL_SPI_DISABLE(hspi); + } + /* Clear overrun flag in 2 Lines communication mode because received is not read */ if (hspi->Init.Direction == SPI_DIRECTION_2LINES) {