modm API documentation
|
#include <modm/driver/pwm/tlc594x.hpp>
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 () |
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.
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.
CHANNELS | Number of channels must be multiples of 4, adjust for daisy-chained chips |
Spi | Spi interface |
Xlat | Level triggered latch pin |
Xblank | Level triggered blank pin, use modm::platform::GpioUnused if not connected |
Vprog | Vprog pin, use modm::platform::GpioUnused if not connected |
Xerr | Error pin, use modm::platform::GpioUnused if not connected |
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
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
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 |
||
) |
channels | initialize channels buffer with value, disable with -1 |
dots | initialize dot correction buffer with value, disable with -1 |
writeCH | write channels value to chip |
writeDC | write dots value to chip |
enable | set blank pin low after initialization |
|
inline |
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::setAllChannels | ( | uint16_t | value | ) |
value | the 12bit value of all channels |
void modm::TLC594X< CHANNELS, Spi, Xlat, Xblank, Vprog, Xerr >::setAllDotCorrection | ( | uint8_t | value | ) |
value | the 6bit dot correction value of all channels |
update | write data to chip |
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
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