I2C driver for TLC59116 led driver
Dependents: m3Dpi kousenMusicGame-test
TLC59116.h@0:52a1996ad711, 2015-12-03 (annotated)
- Committer:
- sillevl
- Date:
- Thu Dec 03 07:57:50 2015 +0000
- Revision:
- 0:52a1996ad711
- Child:
- 1:c285b2c57b2e
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sillevl | 0:52a1996ad711 | 1 | #pragma once |
sillevl | 0:52a1996ad711 | 2 | |
sillevl | 0:52a1996ad711 | 3 | #include "mbed.h" |
sillevl | 0:52a1996ad711 | 4 | |
sillevl | 0:52a1996ad711 | 5 | class TLC59116{ |
sillevl | 0:52a1996ad711 | 6 | public: |
sillevl | 0:52a1996ad711 | 7 | TLC59116(PinName sda, PinName scl, int address); |
sillevl | 0:52a1996ad711 | 8 | |
sillevl | 0:52a1996ad711 | 9 | void setBrightness(float brightness); |
sillevl | 0:52a1996ad711 | 10 | void setChannel(int channel, float brightness); |
sillevl | 0:52a1996ad711 | 11 | void enable(); |
sillevl | 0:52a1996ad711 | 12 | void disable(); |
sillevl | 0:52a1996ad711 | 13 | |
sillevl | 0:52a1996ad711 | 14 | protected: |
sillevl | 0:52a1996ad711 | 15 | int address; |
sillevl | 0:52a1996ad711 | 16 | I2C i2c; |
sillevl | 0:52a1996ad711 | 17 | |
sillevl | 0:52a1996ad711 | 18 | void setOutputState(int ledout0, int ledout1, int ledout2, int ledout3); |
sillevl | 0:52a1996ad711 | 19 | |
sillevl | 0:52a1996ad711 | 20 | private: |
sillevl | 0:52a1996ad711 | 21 | void setRegister(int reg, int value); |
sillevl | 0:52a1996ad711 | 22 | void setRegisters(int reg, char* value, int length, int mode = AUTO_INCREMENT_ALL_REGISTERS); |
sillevl | 0:52a1996ad711 | 23 | |
sillevl | 0:52a1996ad711 | 24 | static const int AUTO_INCREMENT_ALL_REGISTERS = 0x80; |
sillevl | 0:52a1996ad711 | 25 | static const int AUTO_INCREMENT_BRIGHTNESS = 0xA0; |
sillevl | 0:52a1996ad711 | 26 | static const int AUTO_INCREMENT_CONTROL = 0xC0; |
sillevl | 0:52a1996ad711 | 27 | static const int AUTO_INCREMENT_BRIGHTNESS_CONTROL = 0xE0; |
sillevl | 0:52a1996ad711 | 28 | static const int NO_AUTO_INCREMENT = 0x00; |
sillevl | 0:52a1996ad711 | 29 | |
sillevl | 0:52a1996ad711 | 30 | static const int GRPPWM = 0x12; |
sillevl | 0:52a1996ad711 | 31 | static const int LEDOUT0 = 0x014; |
sillevl | 0:52a1996ad711 | 32 | |
sillevl | 0:52a1996ad711 | 33 | |
sillevl | 0:52a1996ad711 | 34 | }; |