Skip to content

Commit

Permalink
Merge pull request #248 from Max-Plastix/static-uart-buffer
Browse files Browse the repository at this point in the history
Statically allocate UART Receive buffers
  • Loading branch information
Quency-D authored Sep 19, 2022
2 parents f223cb1 + 5a39cb6 commit 2300ef2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions cores/asr650x/Serial/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ bool HardwareSerial::begin(uint32_t baud, uint32_t config, int rxPin, int txPin,
}
_rxbuff[_uart_num].rx_r=0;
_rxbuff[_uart_num].rx_w=0;
_rxbuff[_uart_num].rx_buf=(uint8_t*) malloc(UART_RX_SIZE);

if( _uart_num == UART_NUM_0)
{
Expand Down Expand Up @@ -176,7 +175,6 @@ void HardwareSerial::updateBaudRate(unsigned long baud)

void HardwareSerial::end()
{
free(_rxbuff[_uart_num].rx_buf);
if( _uart_num == UART_NUM_0)
{
UART_1_Stop();
Expand Down
2 changes: 1 addition & 1 deletion cores/asr650x/Serial/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#define UART_RX_SIZE (UART_BUFF_SIZE+1)

typedef struct {
uint8_t * rx_buf;
uint8_t rx_buf[UART_RX_SIZE];
uint16_t rx_w;
uint16_t rx_r;
} uart_rxbuff_t;
Expand Down

0 comments on commit 2300ef2

Please sign in to comment.