aboutsummaryrefslogtreecommitdiff
path: root/stm-uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm-uart.c')
-rw-r--r--stm-uart.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/stm-uart.c b/stm-uart.c
index ce52ca0..2605f99 100644
--- a/stm-uart.c
+++ b/stm-uart.c
@@ -115,6 +115,17 @@ HAL_StatusTypeDef uart_send_bytes(enum stm_uart_port port, uint8_t *buf, size_t
return HAL_ERROR;
}
+/* receive raw bytes */
+HAL_StatusTypeDef uart_receive_bytes(enum stm_uart_port port, uint8_t *buf, size_t len, uint32_t timeout)
+{
+ UART_HandleTypeDef *uart = _which_uart(port);
+
+ if (uart)
+ return HAL_UART_Receive(uart, (uint8_t *) buf, (uint32_t) len, timeout);
+
+ return HAL_ERROR;
+}
+
/* Generalized routine to send binary, decimal, and hex integers.
* This code is adapted from Chris Giese's printf.c
*/