-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Chapter 7 - Circular buffers:
I think there is an error where you calculate the difference between write and read pointer (page 204 where CBLengthData function is defined).
Looking at the comments in the function and data layout within the buffer, and assuming that the buffer starts at the LHS and every next write/read moves the pointer to the right, then the case where read pointer is ahead of write pointer (buffer length < 0) contains an error.
In return statement of that function, you calculate "aaaa" as a following substraction operation: cb->size - cb->write, but it is not correct as it yields the length of the buffer without the "aaaa" part. It should be cb->size - cb->read instead.
The "bbbb" part is calculated correctly as is the more efficient approach below the function (not shown in the screen).
Chapter 8 - Calculating Needs: Speeds and Feeds:
In Data Bandwidth description, you calculate ADC bandwidth as the following:

At the end you treat it as 352,800 bytes per second, whereas it should be bits per second as you assumed the size of sample to be 16 bits. The error here is propagated further down the chapter.
Those are the errors I cought and wanted to share them with you in case you planned to have some edition with fixes or something.
Great bokk by the way!
