I2C driver for TLC59116 led driver
Dependents: m3Dpi kousenMusicGame-test
TLC59116.h@1:c285b2c57b2e, 2015-12-19 (annotated)
- Committer:
- sillevl
- Date:
- Sat Dec 19 10:41:07 2015 +0000
- Revision:
- 1:c285b2c57b2e
- Parent:
- 0:52a1996ad711
add constructor that accepts I2C object
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 | 1:c285b2c57b2e | 7 | |
sillevl | 1:c285b2c57b2e | 8 | TLC59116(I2C &i2c, int address); |
sillevl | 0:52a1996ad711 | 9 | TLC59116(PinName sda, PinName scl, int address); |
sillevl | 0:52a1996ad711 | 10 | |
sillevl | 0:52a1996ad711 | 11 | void setBrightness(float brightness); |
sillevl | 0:52a1996ad711 | 12 | void setChannel(int channel, float brightness); |
sillevl | 0:52a1996ad711 | 13 | void enable(); |
sillevl | 0:52a1996ad711 | 14 | void disable(); |
sillevl | 0:52a1996ad711 | 15 | |
sillevl | 0:52a1996ad711 | 16 | protected: |
sillevl | 0:52a1996ad711 | 17 | int address; |
sillevl | 0:52a1996ad711 | 18 | I2C i2c; |
sillevl | 0:52a1996ad711 | 19 | |
sillevl | 1:c285b2c57b2e | 20 | void initialize(); |
sillevl | 1:c285b2c57b2e | 21 | |
sillevl | 0:52a1996ad711 | 22 | void setOutputState(int ledout0, int ledout1, int ledout2, int ledout3); |
sillevl | 0:52a1996ad711 | 23 | |
sillevl | 0:52a1996ad711 | 24 | private: |
sillevl | 0:52a1996ad711 | 25 | void setRegister(int reg, int value); |
sillevl | 0:52a1996ad711 | 26 | void setRegisters(int reg, char* value, int length, int mode = AUTO_INCREMENT_ALL_REGISTERS); |
sillevl | 0:52a1996ad711 | 27 | |
sillevl | 0:52a1996ad711 | 28 | static const int AUTO_INCREMENT_ALL_REGISTERS = 0x80; |
sillevl | 0:52a1996ad711 | 29 | static const int AUTO_INCREMENT_BRIGHTNESS = 0xA0; |
sillevl | 0:52a1996ad711 | 30 | static const int AUTO_INCREMENT_CONTROL = 0xC0; |
sillevl | 0:52a1996ad711 | 31 | static const int AUTO_INCREMENT_BRIGHTNESS_CONTROL = 0xE0; |
sillevl | 0:52a1996ad711 | 32 | static const int NO_AUTO_INCREMENT = 0x00; |
sillevl | 0:52a1996ad711 | 33 | |
sillevl | 0:52a1996ad711 | 34 | static const int GRPPWM = 0x12; |
sillevl | 0:52a1996ad711 | 35 | static const int LEDOUT0 = 0x014; |
sillevl | 0:52a1996ad711 | 36 | |
sillevl | 0:52a1996ad711 | 37 | |
sillevl | 0:52a1996ad711 | 38 | }; |