Description:
When using full-duplex SPI in master mode, there is an issue with the state management in the Rx functions. The parameters of the Rx function are checked within the TxRx functions. However, the state HAL_SPI_STATE_BUSY_RX is set within the Rx function itself. This leads to a scenario where if the Rx function is called with invalid parameters, the TxRx function returns an error, leaving the SPI state stuck in HAL_SPI_STATE_BUSY_RX.
Steps to Reproduce:
Set up SPI in full-duplex master mode.
Call the Rx function with invalid parameters.
Observe that the TxRx function returns an error.
Notice that the SPI state remains stuck in HAL_SPI_STATE_BUSY_RX.
Expected Behavior:
The SPI state should not be stuck in HAL_SPI_STATE_BUSY_RX when invalid parameters are passed to the Rx functions. Proper parameter validation should occur before changing the state.
Proposed Solution:
Move the parameter validation to occur before setting the state to HAL_SPI_STATE_BUSY_RX in the Rx functions. This ensures that the state is only set if the parameters are valid.
Description: When using full-duplex SPI in master mode, there is an issue with the state management in the Rx functions. The parameters of the Rx function are checked within the TxRx functions. However, the state
HAL_SPI_STATE_BUSY_RX
is set within the Rx function itself. This leads to a scenario where if the Rx function is called with invalid parameters, the TxRx function returns an error, leaving the SPI state stuck inHAL_SPI_STATE_BUSY_RX
.Steps to Reproduce:
HAL_SPI_STATE_BUSY_RX
.Expected Behavior: The SPI state should not be stuck in
HAL_SPI_STATE_BUSY_RX
when invalid parameters are passed to the Rx functions. Proper parameter validation should occur before changing the state.Proposed Solution: Move the parameter validation to occur before setting the state to
HAL_SPI_STATE_BUSY_RX
in the Rx functions. This ensures that the state is only set if the parameters are valid.