Sometimes I have a good idea how to extend one of my Processor Expert components with an extra feature, but then I step back because why implementing more than I need at the moment? Until another user of the component simply asks for the same thing, and here we go: if one or more can take advantage of a feature, that’s definitely a strong argument to add it :-). This happened with the RingBuffer Processor Expert component I’m using in many projects. And a reader of this blog asked to add some extra event methods: when an item is added or removed to the buffer.
Beside of the
OnItemGet() events, I added an extra
OnClear() event which gets called when the ring buffer Clear() method gets called. The events are disabled by default not to add any overhead, and they can be enabled individually.
Using the CDE (Component Development Environment) of Processor Expert makes it very easy to such additional events: define the interface for the event, and then add the event code to the driver. Below shows it for the Put() method:
To check the details of the change, see the commit on GitHub.
So with using the new RingBuffer events in my USB stack, I can get application notifications for every byte received or sent, which is very useful.
The updated component will be available with the next *.PEupd release.
Happy Eventing :-)