Char buffer library

Several of the libraries I’ve been helping convert to XOD need a block of RAM as a buffer. So, to finish off those libraries, I wrote this library to provide a common buffer. I think of this as an experiment, since the XOD developers are thinking about this in a broader way. @bradzilla84 is also thinking about this.

I did it in a fairly obvious way: malloc, custom-type with char*, and length.

Here’s a little taste:

Library: awgrover/buffer, source: github. As usual, feedback/critique will help improve the library/concept.

I spent some time writing the example patch which is also the test. I did not use tabtest, which I should revisit. I also spent time writing a tutorial patch to explain using the library (it has illustrative fragments). And, I wrote a tutorial-cpp patch to show how to use it with your .cpp patches when you need the buffer (including a skeleton).

Writing the example patch made me think more about “impure” nodes (and objects with state). I’ve improved my understanding, but still need more experience with it.

Next, help @cesars write the methods that need a buffer for the RF24 library. As in, actually use it.

4 Likes