Serial
acquireSerialBuffer()
// SYNTAX
HAL_USB_USART_Config acquireSerialBuffer()
{
HAL_USB_USART_Config conf = {0};
// The usable buffer size will be 128
static uint8_t serial_rx_buffer[129];
static uint8_t serial_tx_buffer[129];
conf.rx_buffer = serial_rx_buffer;
conf.tx_buffer = serial_tx_buffer;
conf.rx_buffer_size = 129;
conf.tx_buffer_size = 129;
return conf;
}
HAL_USB_USART_Config acquireUSBSerial1Buffer()
{
HAL_USB_USART_Config conf = {0};
// The usable buffer size will be 128
static uint8_t usbserial1_rx_buffer[129];
static uint8_t usbserial1_tx_buffer[129];
conf.rx_buffer = usbserial1_rx_buffer;
conf.tx_buffer = usbserial1_tx_buffer;
conf.rx_buffer_size = 129;
conf.tx_buffer_size = 129;
return conf;
}
Since 0.6.0:
It is possible for the application to allocate its own buffers for Serial
(USB serial) by implementing acquireSerialBuffer
. Minimum receive buffer size is 65 bytes.
On Gen 2 devices (Photon, P1, Electron. E-Series), the USBSerial1
receive buffer can be resized using acquireUSBSerial1Buffer
. Minimum receive buffer size is 65 bytes.
Since 3.2.0: This is also available for hardware UART ports like Serial1
, Serial2
, etc, see acquireSerial1Buffer
.