diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-10-25 16:52:57 +0100 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-10-25 16:52:57 +0100 |
commit | 56c268e88a87f708de1824d87fbf7b824d4c1c2a (patch) | |
tree | 0a4ab861b2f03c2fde1de8d7a3b61d2603b4d503 /libraries/usart.c | |
parent | 58d3787ca563b7d6a2cb4e0a1ab7fdde67fd5557 (diff) | |
download | stm32f103c8-examples-56c268e88a87f708de1824d87fbf7b824d4c1c2a.tar stm32f103c8-examples-56c268e88a87f708de1824d87fbf7b824d4c1c2a.tar.zst stm32f103c8-examples-56c268e88a87f708de1824d87fbf7b824d4c1c2a.zip |
Remove any Heap Allocation
Diffstat (limited to 'libraries/usart.c')
-rw-r--r-- | libraries/usart.c | 12 |
1 files changed, 3 insertions, 9 deletions
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); } |