bsps/stm32h7: Add full duplex support for SPI

This commit is contained in:
Kinsey Moore
2024-09-06 15:11:29 -05:00
committed by Chris Johns
parent 601e52f495
commit b1a350a18a

View File

@@ -298,13 +298,19 @@ static int stm32h7_spi_transfer(
return 1;
}
/* perform transfer */
if (msg->tx_buf != NULL) {
if (msg->tx_buf != NULL && msg->rx_buf != NULL) {
status = HAL_SPI_TransmitReceive(
&ctx->spi, msg->tx_buf, msg->rx_buf, msg->len, 100
);
if (status != HAL_OK) {
return 1;
}
} else if (msg->tx_buf != NULL) {
status = HAL_SPI_Transmit(&ctx->spi, msg->tx_buf, msg->len, 100);
if (status != HAL_OK) {
return 1;
}
}
if (msg->rx_buf != NULL) {
} else if (msg->rx_buf != NULL) {
status = HAL_SPI_Receive(&ctx->spi, msg->rx_buf, msg->len, 100);
if (status != HAL_OK) {
return 1;