A buffer-based driver
Sometimes, the exact size of a transfer is known in advance. In this case, a pre-existing buffer can be passed to the driver and used in place of a queue. Let's take a look at an example of a buffer-based driver, where the exact number of bytes is known in advance. The hardware setup for this example is identical to the previous examples—we'll concentrate on receiving data through USART2.
Instead of using a queue, uartPrintOutTask will supply its own buffer to the startReceiveInt function. Data received by USART2 will be placed directly in the local buffer until the desired number of bytes have been added, then a semaphore will be given by the ISR to provide notification of the completion. The entire message will be ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access