Tlc5940.cpp File Reference


Detailed Description

Tlc5940 class functions.

#include <avr/io.h>
#include <avr/interrupt.h>
#include "tlc_config.h"
#include "Tlc5940.h"

Defines

#define pulse_pin(port, pin)   port |= _BV(pin); port &= ~_BV(pin)
 Pulses a pin - high then low.

Functions

 ISR (TIMER1_OVF_vect)
 Interrupt called after an XLAT pulse to prevent more XLAT pulses.
void tlc_shift8_init (void)
 Initializes the SPI module to double speed (f_osc / 2).
void tlc_shift8 (uint8_t byte)
 Shifts out a byte, MSB first.
void tlc_dcModeStart (void)
 Switches to dot correction mode and clears any waiting grayscale latches.
void tlc_dcModeStop (void)
 Switches back to grayscale mode.

Variables

volatile uint8_t tlc_needXLAT
 This will be true (!= 0) if update was just called and the data has not been latched in yet.
volatile void(* tlc_onUpdateFinished )(void)
 Some of the extened library will need to be called after a successful update.
uint8_t tlc_GSData [NUM_TLCS *24]
 Packed grayscale data, 24 bytes (16 * 12 bits) per TLC.
Tlc5940 Tlc
 Preinstantiated Tlc variable.


Define Documentation

#define pulse_pin ( port,
pin   )     port |= _BV(pin); port &= ~_BV(pin)

Pulses a pin - high then low.


Function Documentation

ISR ( TIMER1_OVF_vect   ) 

Interrupt called after an XLAT pulse to prevent more XLAT pulses.

void tlc_dcModeStart ( void   ) 

Switches to dot correction mode and clears any waiting grayscale latches.

void tlc_dcModeStop ( void   ) 

Switches back to grayscale mode.


Variable Documentation

Preinstantiated Tlc variable.

uint8_t tlc_GSData[NUM_TLCS *24]

Packed grayscale data, 24 bytes (16 * 12 bits) per TLC.

Format: Lets assume we have 2 TLCs, A and B, daisy-chained with the SOUT of A going into the SIN of B.

  • byte 0: upper 8 bits of B.15
  • byte 1: lower 4 bits of B.15 and upper 4 bits of B.14
  • byte 2: lower 8 bits of B.0
  • ...
  • byte 24: upper 8 bits of A.15
  • byte 25: lower 4 bits of A.15 and upper 4 bits of A.14
  • ...
  • byte 47: lower 8 bits of A.0

Note:
Normally packing data like this is bad practice. But in this situation, shifting the data out is really fast because the format of the array is the same as the format of the TLC's serial interface.

volatile uint8_t tlc_needXLAT

This will be true (!= 0) if update was just called and the data has not been latched in yet.

volatile void(* tlc_onUpdateFinished)(void)

Some of the extened library will need to be called after a successful update.


Generated on Sun Apr 19 14:12:40 2009 for Arduino Tlc5940 Library by  doxygen 1.5.6