Interface Skywriter HAT to main C++ on RPi2


Hello! I have a new Raspberry Pi 2, and would like to make an application that uses the Skywriter HAT gesture sensing. I’d like to write the application in C++, but not sure how best to interface with Skywriter HAT. For Raspberry Pi 2, the Python library is readily available, so would you recommend I use Boost Python to poll the Skywriter HAT functions? I’m not very familiar with Boost, and not even sure threading would work with Boost. Your input would be much appreciated, thanks!


The Python library is only 400 lines, so reimplementing it in C++ shouldn’t be too hard. Look at the source:

You can controll the GPIO through sysfs and do I2C communication via Linux i2c_* calls. You might get inspiration for the later by looking at the source for backlight.c.


Possibly helpful, this is the library in Arduino C, which is a closer approximation of how it might work in C++.