Hi. Thanks for the wonderful library, I had a blast playing around with it in the Arduino IDE, building for a Teensy 3.2. Everything worked fine. However all of this is for a keyboard project that I’m working on. The keyboard firmware is written in C, and FastLED in C++. I now need to get them both to work together.
My understanding is that I need a C++ wrapper for C. How do I go about doing this?
You will need to provide a bit more detail. Basically, C++ is just C with some add ons, but that over simplifies. Is your keyboard firmware running on the Teensy? How does FastLED communicate with the firmware?
You pry don’t need a wrapper or anything so complicated. But to help, we need some more content to explain why you think you need this.
I have dabbled in C and C++ before, and understand the difference, and hence was hoping for something simpler than a wrapper. The keyboard firmware will be running on the Teensy along with FastLED.
Regarding how the two will communicate, I was hoping to simply include the FastLED.h and then code the setup and loop parts into the keyboard firmware’s setup and loop functions.
Ahh, I see where you are going with this I think. So you pry do need a wrapper that either exports some (abstract in a idea way) communication symbols to C linking style, and build the FastLED stuff into an object that can be linked, but still callable from your C code.
Don’t know which might be more work, but it should also be possible to build your entire project with C++ instead, and you don’t have any issues calling into FastLED directly as needed.
I’ve done both in other projects. I think #2 makes more sense, cmake can do it, and since C code runs perfectly in C++, it should be faster.