esp8266/machine_uart: Add rxbuf keyword arg to UART constructor/init.
As per the machine.UART documentation, this is used to set the length of the UART RX buffer.
This commit is contained in:
@@ -36,7 +36,7 @@ static os_event_t uart_evt_queue[16];
|
||||
|
||||
// A small, static ring buffer for incoming chars
|
||||
// This will only be populated if the UART is not attached to dupterm
|
||||
static byte uart_ringbuf_array[16];
|
||||
uint8 uart_ringbuf_array[UART0_STATIC_RXBUF_LEN];
|
||||
static ringbuf_t uart_ringbuf = {uart_ringbuf_array, sizeof(uart_ringbuf_array), 0, 0};
|
||||
|
||||
static void uart0_rx_intr_handler(void *para);
|
||||
@@ -269,6 +269,19 @@ void ICACHE_FLASH_ATTR uart_setup(uint8 uart) {
|
||||
ETS_UART_INTR_ENABLE();
|
||||
}
|
||||
|
||||
int ICACHE_FLASH_ATTR uart0_get_rxbuf_len(void) {
|
||||
return uart_ringbuf.size;
|
||||
}
|
||||
|
||||
void ICACHE_FLASH_ATTR uart0_set_rxbuf(uint8 *buf, int len) {
|
||||
ETS_UART_INTR_DISABLE();
|
||||
uart_ringbuf.buf = buf;
|
||||
uart_ringbuf.size = len;
|
||||
uart_ringbuf.iget = 0;
|
||||
uart_ringbuf.iput = 0;
|
||||
ETS_UART_INTR_ENABLE();
|
||||
}
|
||||
|
||||
// Task-based UART interface
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
Reference in New Issue
Block a user