mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-06 15:43:15 +00:00
bsps/stm32h7: Add full duplex support for SPI
This commit is contained in:
committed by
Chris Johns
parent
601e52f495
commit
b1a350a18a
@@ -298,13 +298,19 @@ static int stm32h7_spi_transfer(
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* perform transfer */
|
/* 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);
|
status = HAL_SPI_Transmit(&ctx->spi, msg->tx_buf, msg->len, 100);
|
||||||
if (status != HAL_OK) {
|
if (status != HAL_OK) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
} else if (msg->rx_buf != NULL) {
|
||||||
if (msg->rx_buf != NULL) {
|
|
||||||
status = HAL_SPI_Receive(&ctx->spi, msg->rx_buf, msg->len, 100);
|
status = HAL_SPI_Receive(&ctx->spi, msg->rx_buf, msg->len, 100);
|
||||||
if (status != HAL_OK) {
|
if (status != HAL_OK) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user