modm API documentation
modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr > Class Template Reference

#include <modm/driver/pwm/tlc594x.hpp>

Inheritance diagram for modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >:
modm::NestedResumable< 1 >

Public Member Functions

void initialize (uint16_t channels=0, uint8_t dots=63, bool writeCH=true, bool writeDC=true, bool enable=true)
 
void setChannel (uint16_t channel, uint16_t value)
 
void setAllChannels (uint16_t value)
 
uint16_t getChannel (uint16_t channel)
 
void setDotCorrection (uint16_t channel, uint8_t value)
 
void setAllDotCorrection (uint8_t value)
 
uint8_t getDotCorrection (uint16_t channel)
 
modm::ResumableResult< void > writeChannels (bool flush=true)
 transfer channel data to driver chip
 
modm::ResumableResult< void > writeDotCorrection (bool flush=true)
 transfer dot correction data to driver chip
 
void latch ()
 writes data from the input shift register to either GS or DC register.
 
void enable ()
 sets the blank pin low
 
void disable ()
 sets the blank pin high
 
bool isError ()
 
uint8_t * getGrayscaleData ()
 
uint8_t * getDotCorrectionData ()
 
uint8_t * getStatusData ()
 
bool isEnabled ()
 

Detailed Description

template<uint16_t CHANNELS, typename Spi, typename Xlat, typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
class modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >

TLC594* multi-channel, daisy-chainable, constant-current sink, 12bit PWM LED driver.

This class does not use the DCPRG pin, as writing to the EEPROM requires 22V to be applied to Vprog, requiring additional external circuits. Use of any EEPROM functions is therefore not implemented here. Make sure that pin is connected to Vcc, otherwise Dot Correction does not work.

This driver can be used for the 16-channel TLC5940 and 24-channel TLC5947 and probably similar TLC59s as well, simply by adjusting the number of CHANNELS. Therefore this class can also be used with daisy-chained TLC59s, e.g. to control two TLC5940s set CHANNELS to 2*16.

WARNING

Each channel in the TLC594x chip drives a transistor using a feedback loop to make it meet a particular current requirement. If a channel is disconnected, the feedback loop will fully drive the transistor. If most of the channels are disconnected (quite common in a testing environment if not in production), this will end up pulling quite a bit of power from the chip's 3.3 or 5v supply. This can significantly heat up the chip and cause power supply issues.

Template Parameters
CHANNELSNumber of channels must be multiples of 4, adjust for daisy-chained chips
SpiSpi interface
XlatLevel triggered latch pin
XblankLevel triggered blank pin, use modm::platform::GpioUnused if not connected
VprogVprog pin, use modm::platform::GpioUnused if not connected
XerrError pin, use modm::platform::GpioUnused if not connected
Author
Niklas Hauser

Member Function Documentation

template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
uint16_t modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::getChannel ( uint16_t  channel)

get the stored 12bit value of a channel this does reflect the actual value in the chip

template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
uint8_t modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::getDotCorrection ( uint16_t  channel)

get the stored 6bit dot correction value of a channel this does reflect the actual value in the chip

template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::initialize ( uint16_t  channels = 0,
uint8_t  dots = 63,
bool  writeCH = true,
bool  writeDC = true,
bool  enable = true 
)
Parameters
channelsinitialize channels buffer with value, disable with -1
dotsinitialize dot correction buffer with value, disable with -1
writeCHwrite channels value to chip
writeDCwrite dots value to chip
enableset blank pin low after initialization
template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
bool modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::isError ( )
inline
Returns
true if LOD or TEF is detected
template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::setAllChannels ( uint16_t  value)
Parameters
valuethe 12bit value of all channels
template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::setAllDotCorrection ( uint8_t  value)
Parameters
valuethe 6bit dot correction value of all channels
updatewrite data to chip
template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::setChannel ( uint16_t  channel,
uint16_t  value 
)

set the 12bit value of a channel call writeChannels() to update the chip

template<uint16_t CHANNELS, typename Spi , typename Xlat , typename Xblank = modm::platform::GpioUnused, typename Vprog = modm::platform::GpioUnused, typename Xerr = modm::platform::GpioUnused>
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::setDotCorrection ( uint16_t  channel,
uint8_t  value 
)

set the 6bit dot correction value of a channel call writeChannels() to update the chip


The documentation for this class was generated from the following file: