Frame decoding

As data comes in from the USB, it is placed in a stream buffer by the USB stack. The StreamBuffer function for incoming data can be accessed from GetUsbRxStreamBuff() in Drivers/HandsOnRTOS/VirtualCommDriverMultiTask.c:

StreamBufferHandle_t const * GetUsbRxStreamBuff( void ){  return &vcom_rxStream;}

This function returns a constant pointer to StreamBufferHandle_t. This is done so the calling code can access the stream buffer directly, but isn't able to change the pointer's value.

The protocol itself is a strictly binary stream that starts with 0x02 and ends with a CRC-32 checksum, transmitted in little endian byte order:

There ...

Get Hands-On RTOS with Microcontrollers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.