dmadison / ServoInput

Interrupt-driven servo decoder library for Arduino
GNU Lesser General Public License v3.0
22 stars 10 forks source link

Linked List (Manager Class) #2

Closed dmadison closed 4 years ago

dmadison commented 4 years ago

Creates a ServoInputManager class with a global ServoInput object to manage a linked list of all ServoInputSignal instances. Users can now call ServoInput.begin() to initialize all objects rather than having to call the begin() function for every object separately. Detaching all interrupts at once with end() is also supported.

On the 328P this adds 12 bytes of memory usage for the static head & tail pointers and the ServoInputManager object. Each ServoInputPin object will use 8 bytes of additional memory for the next pointer and the virtual begin/end memory maps. Program size for all examples increases by about 320 bytes.

So this isn't the most lightweight feature for the library, but it's a nice quality of life change to have an overarching "manager" class and the ability to iterate through all of the objects. Especially once you start dealing with 4 or more input signals.