1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

serial: allow buffering to speed up USB virtual COM ports.

Add begin write and end write hints.  If implemented by the serial
driver, then the driver can buffer up data sent via serialWrite() and
flush it when serialEndWrite() is called.

Implemented at the buffer level as it requires the least change to how
serial_msp and serial_cli are architected.

Also tidy up the visibility in the VCP driver.

Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
Michael Hope 2015-07-19 15:56:37 +02:00 committed by borisbstyle
parent 0e460c18b0
commit 195456f9ac
7 changed files with 84 additions and 2498 deletions

View file

@ -455,6 +455,8 @@ static uint32_t read32(void)
static void headSerialResponse(uint8_t err, uint8_t responseBodySize)
{
serialBeginWrite(mspSerialPort);
serialize8('$');
serialize8('M');
serialize8(err ? '!' : '>');
@ -476,6 +478,7 @@ static void headSerialError(uint8_t responseBodySize)
static void tailSerialReply(void)
{
serialize8(currentPort->checksum);
serialEndWrite(mspSerialPort);
}
static void s_struct(uint8_t *cb, uint8_t siz)