Is there a C or C++ version of bh1745 library


#1

Hi Pimoroni, and fellow Pirates.

Short version of the question for those that do not read long posts ;)
Is there a C version of bh1745 library?

Question with context:
I’m having a lot of fun with the Pimoroni Products for the Raspberry Pi.
the last couple of weeks I’ve been buidling stuff with the breakout sensors that fit on the Garden.
Although I think Python is great, I mainly code with the Haxe Programming Language.
To use the sensors I’m building libraries/extensions that can be used from Haxe.
These are basically wrappers around c-libraries.
I’ve already built an extension for the VL53L1X Time of Flight Sensor.
Now I want to do the same for the BH1745 Color Sensor.
So I’m wondering if there is a C-version of the library out there somewhere.

Cheers


#2

There might be a C library out there or code that’s easily portable from Arduino, but we’ve no plans to ship one of our own since I just don’t have the capacity to support another language properly.

The availability of C-code for the VL53L1X and MLX90640 is something of an anomaly, since both of these libraries are supplied by the manufacturer and then wrapped into Python.

If you wanted to write your own C library, the Python code is probably a good place to start since it uses a DSL for describing the device registers that makes it almost a translation of the datasheet- https://github.com/pimoroni/bh1745-python/blob/master/library/bh1745/init.py


#3

Ok Thnx, I’ll have a look at the python code and search some more for an existing Aurduino lib.
I just didn’t want to make my own C-library if one already exists.
If I succeed I’l make it open source and post a link in a reply.

Cheers