From 56c268e88a87f708de1824d87fbf7b824d4c1c2a Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 25 Oct 2020 16:52:57 +0100 Subject: Remove any Heap Allocation --- libraries/usart.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'libraries/usart.c') diff --git a/libraries/usart.c b/libraries/usart.c index 61de99c..67dd30a 100644 --- a/libraries/usart.c +++ b/libraries/usart.c @@ -8,7 +8,7 @@ extern USART usart3; // init functions -void usart_init(USART *usart) +void usart_init(USART *usart, uint8_t *rx_buffer, uint16_t rx_buffersize, uint8_t *tx_buffer, uint16_t tx_buffersize) { // clock config rcc_periph_clock_enable(RCC_GPIOB); // for USART3 @@ -32,14 +32,8 @@ void usart_init(USART *usart) usart_enable(USART3); // fifo init - fifo_init(&usart->rx_fifo, USART_BUFFER_SIZE); - fifo_init(&usart->tx_fifo, USART_BUFFER_SIZE); -} - -void usart_deinit(USART *usart) -{ - fifo_deinit(&usart->rx_fifo); - fifo_deinit(&usart->tx_fifo); + fifo_init(&usart->rx_fifo, rx_buffer, rx_buffersize); + fifo_init(&usart->tx_fifo, tx_buffer, tx_buffersize); } -- cgit v1.2.3-70-g09d2