Arduino Basic Library

This is an ensemble of independent Arduino libraries to manage basic components such as buttons, potentiometers and leds.

Code and functionalities are intentionally trivial and independent to favor fast prototyping, modifications and customization.

Pros:

  • modular – completely written in C++ with OOP programming principles and it doesn’t interfere with other libraries
  • non-blocking – delay() function is not used
  • easy to customize

This library was created with the help of PlatformIO.
Continue reading “Arduino Basic Library”

Lightweight and multipurpose list data structure in C

In the last C project I needed a versatile list data structure.

The needs for this list where:

  • lightweight on memory
  • easy to use
  • support for every kind of information I wanted to store

Given those premises, I decided to create a classic list data structure that instead of using the correct data type, it uses (void *) as the information holder.
Using a void pointer gives you a lot of flexibility because in this way you can store every kind of information you need. You can even obtain a list that holds different element types!
However the use of (void *) requires a bit of a consideration. In fact, deleting a node from the list becomes difficult because the information that is being held by the list node needs an appropriate deallocator function. Another reason of concern is that when you get the info from a node list, you have to cast it as the element type that you know it is.
Continue reading “Lightweight and multipurpose list data structure in C”