Two different files handling low level control of Toshiba LED driver

41 views
Skip to first unread message

Jeroen Taverne

unread,
Jun 27, 2016, 12:19:01 PM6/27/16
to drones-discuss
Hi.

I don't have access to the development forum yet. As the current Toshiba RGB LED driver in the Pixhawk (V2) is end of life I have added support for a TI LED driver in the source code. When trying to find the files that had to be modified I found something strange. There are two files that both are compiled in and both have code for low level control of the Toshiba LED driver. These are rgbled.cpp and ToshibaLED_I2C.cpp. At the end only modification to rgbled.cpp seem to have effect. I have the idea that this is also the case with controlling the buzzer. Some files are compiled but not actually used. Is there a reason for this? Is there a cleanup planned for obsolete source files? 

Goro Senzai

unread,
Jun 28, 2016, 1:36:16 PM6/28/16
to drones-discuss
Hi,

I'm not an expert in this area, but I did some work with the LED drivers a while ago. I believe the dependencies goes like: ToshibaLED_I2C.h includes ToshibaLED.h which in turn includes RGBLed.h.

I believe the low-level call that actually obtains a semaphore and calls the I2C function in HAL layer is hw_set_rgb(), which is defined as virtual in RGBLed.h and actually defined in ToshibaLED_I2C.cpp. RGBLed.h simply maintains LED status and colour, delegating actual I2C register manipulation to ToshibaLED_I2C.cpp on boards that has ToshibaLED on the default I2C bus.

If you wanted to create a driver for another I2C based LED module, I think the easiest way is to copy ToshibaLED* and define I2C address and registers accordingly.
Reply all
Reply to author
Forward
0 new messages