aboutsummaryrefslogtreecommitdiff
path: root/stm-uart.c
diff options
context:
space:
mode:
authorFredrik Thulin <fredrik@thulin.net>2016-05-15 10:42:23 +0200
committerFredrik Thulin <fredrik@thulin.net>2016-05-15 10:43:03 +0200
commit9b73356f2831800d2328827998e1e5b2a1994b68 (patch)
tree194357028a78b8ef92e4914074c2b3c51df5b17b /stm-uart.c
parentcc07ee6bfcf4721254145ef388196be82532fd4a (diff)
add simple filetransfer poc
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
*/