I2C driver for TLC59116 led driver
Dependents: m3Dpi kousenMusicGame-test
Diff: TLC59116.h
- Revision:
- 0:52a1996ad711
- Child:
- 1:c285b2c57b2e
diff -r 000000000000 -r 52a1996ad711 TLC59116.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TLC59116.h Thu Dec 03 07:57:50 2015 +0000 @@ -0,0 +1,34 @@ +#pragma once + +#include "mbed.h" + +class TLC59116{ + public: + TLC59116(PinName sda, PinName scl, int address); + + void setBrightness(float brightness); + void setChannel(int channel, float brightness); + void enable(); + void disable(); + + protected: + int address; + I2C i2c; + + void setOutputState(int ledout0, int ledout1, int ledout2, int ledout3); + + private: + void setRegister(int reg, int value); + void setRegisters(int reg, char* value, int length, int mode = AUTO_INCREMENT_ALL_REGISTERS); + + static const int AUTO_INCREMENT_ALL_REGISTERS = 0x80; + static const int AUTO_INCREMENT_BRIGHTNESS = 0xA0; + static const int AUTO_INCREMENT_CONTROL = 0xC0; + static const int AUTO_INCREMENT_BRIGHTNESS_CONTROL = 0xE0; + static const int NO_AUTO_INCREMENT = 0x00; + + static const int GRPPWM = 0x12; + static const int LEDOUT0 = 0x014; + + +}; \ No newline at end of file