16-channel I2C constant current LED sink driver

Fork of TLC59116 by Sille Van Landschoot

TLC59116.h

Committer:
pilotak
Date:
2017-08-22
Revision:
2:daabe2fe9b1d
Parent:
1:c285b2c57b2e

File content as of revision 2:daabe2fe9b1d:

#pragma once

#include "mbed.h"

class TLC59116{
public:
    
    TLC59116(I2C &i2c_obj, int address);
    TLC59116(PinName sda, PinName scl, int address);
    
    void setBrightness(float brightness);
    void setChannel(int channel, float brightness);
    void enable();
    void disable();
    
    protected:
    int address;

    
    void initialize();
    
    void setOutputState(int ledout0, int ledout1, int ledout2, int ledout3);
    
private:
    I2C *i2c_p;
    I2C &i2c;
    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;

    
};