16-channel I2C constant current LED sink driver

Fork of TLC59116 by Sille Van Landschoot

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TLC59116.h Source File

TLC59116.h

00001 #pragma once
00002 
00003 #include "mbed.h"
00004 
00005 class TLC59116{
00006 public:
00007     
00008     TLC59116(I2C &i2c_obj, int address);
00009     TLC59116(PinName sda, PinName scl, int address);
00010     
00011     void setBrightness(float brightness);
00012     void setChannel(int channel, float brightness);
00013     void enable();
00014     void disable();
00015     
00016     protected:
00017     int address;
00018 
00019     
00020     void initialize();
00021     
00022     void setOutputState(int ledout0, int ledout1, int ledout2, int ledout3);
00023     
00024 private:
00025     I2C *i2c_p;
00026     I2C &i2c;
00027     void setRegister(int reg, int value);
00028     void setRegisters(int reg, char* value, int length, int mode = AUTO_INCREMENT_ALL_REGISTERS);
00029     
00030     static const int AUTO_INCREMENT_ALL_REGISTERS = 0x80;
00031     static const int AUTO_INCREMENT_BRIGHTNESS = 0xA0;
00032     static const int AUTO_INCREMENT_CONTROL = 0xC0;
00033     static const int AUTO_INCREMENT_BRIGHTNESS_CONTROL = 0xE0;
00034     static const int NO_AUTO_INCREMENT = 0x00;
00035     
00036     static const int GRPPWM = 0x12;
00037     static const int LEDOUT0 = 0x014;
00038 
00039     
00040 };