commit | dee73d53091d3c8cf0aac15863a7620a63f8a91a | [log] [tgz] |
---|---|---|
author | Tasnim <tasnim.ouni@st.com> | Fri Mar 24 12:38:11 2023 +0100 |
committer | Tasnim <tasnim.ouni@st.com> | Fri Mar 24 13:13:49 2023 +0100 |
tree | a81a60a6678ddd249873f4af7c14876c507f0c86 | |
parent | 9a351f80068e4f233c7fadd74a96225a1ec3d158 [diff] |
[HAL][SPI] Fix driver to don't update state in case of error (HAL_SPI_STATE_READY will be set only in case of HAL_TIMEOUT)
diff --git a/Src/stm32l4xx_hal_spi.c b/Src/stm32l4xx_hal_spi.c index 49b328d..deae017 100644 --- a/Src/stm32l4xx_hal_spi.c +++ b/Src/stm32l4xx_hal_spi.c
@@ -1550,6 +1550,14 @@ hspi->ErrorCode = HAL_SPI_ERROR_FLAG; } + if (hspi->ErrorCode != HAL_SPI_ERROR_NONE) + { + errorcode = HAL_ERROR; + } + else + { + hspi->State = HAL_SPI_STATE_READY; + } error : __HAL_UNLOCK(hspi);