rlogiacco / CircularBuffer

Arduino circular buffer library
GNU Lesser General Public License v3.0
312 stars 85 forks source link

Renamed classes to avoid conflict with Arduino bundled CircularBuffer #73

Closed ubidefeo closed 1 year ago

ubidefeo commented 1 year ago

The name CircularBuffer is used inside Arduino by some platforms. Being bundled with a platform gives it higher priority in respect to the user folder library, causing this library to never be picked up when compiling, for example, for Nano 33 BLE

Renaming the class, adding RLG_ as prefix prevents the need to use a namespace (difficult to understand for beginners) and lets this compile successfully

addresses #72

rlogiacco commented 1 year ago

Hi @ubidefeo and thanks a lot for your contribution, really appreciated. Honestly I'm not willing to personalize this library: I might have been the starter, but I'm not the only contributor and I'm hoping more will add along the way. Also, I don't think introducing a breaking change is the right way to address this issue, especially if it's a limited set of users those affected by it. I agree with you regarding the namespace: fresh starters will be very confused if this library uses a namespace, almost no other library in the Arduino world uses namespaces. I believe the proper way to address this is by improving the documentation and change the inclusion path in the header file from #include <CircularBuffer.tpp> to #include "CircularBuffer.tpp" (see https://www.geeksforgeeks.org/c-c-include-directive-with-examples/)

rsalvati commented 1 year ago

I went through the same issue using my Nano 33 BLE and I solved specifying the path inside the include function:

#include <C:\Users\Raffaele\Documents\Arduino\libraries\CircularBuffer\CircularBuffer.h>

Also, I had to specify the full path of the CircularBuffer.tpp inside the CircularBuffer.h script (placed at the end). This could be added as a note under the "Usage" section for Arduino Mbed OS Nano Boards without changing the library.