From 9b73356f2831800d2328827998e1e5b2a1994b68 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Sun, 15 May 2016 10:42:23 +0200 Subject: add simple filetransfer poc --- stm-uart.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'stm-uart.c') 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 */ -- cgit v1.2.3