An input/output controller for virtual pinball machines, with plunger position tracking, accelerometer-based nudge sensing, button input encoding, and feedback device control.

Dependencies:   USBDevice mbed FastAnalogIn FastIO FastPWM SimpleDMA

Embed: (wiki syntax)

« Back to documentation index

TLC5940 Class Reference

TLC5940 Class Reference

This class controls a TLC5940 PWM driver IC. More...

#include <TLC5940.h>

Public Member Functions

 TLC5940 (PinName SCLK, PinName MOSI, PinName GSCLK, PinName BLANK, PinName XLAT, int nchips)
 Set up the TLC5940.
void set (int idx, unsigned short data)
 Set the next chunk of grayscale data to be sent.

Detailed Description

This class controls a TLC5940 PWM driver IC.

Using the TLC5940 class to control an LED:

  #include "mbed.h"
  #include "TLC5940.h"
  
  // Create the TLC5940 instance
  TLC5940 tlc(p7, p5, p21, p9, p10, p11, p12, 1);
  
  int main()
  {   
      // Enable the first LED
      tlc.set(0, 0xfff);
      
      while(1)
      {
      }
  }

Definition at line 152 of file TLC5940.h.


Constructor & Destructor Documentation

TLC5940 ( PinName  SCLK,
PinName  MOSI,
PinName  GSCLK,
PinName  BLANK,
PinName  XLAT,
int  nchips 
)

Set up the TLC5940.

Parameters:
SCLK- The SCK pin of the SPI bus
MOSI- The MOSI pin of the SPI bus
GSCLK- The GSCLK pin of the TLC5940(s)
BLANK- The BLANK pin of the TLC5940(s)
XLAT- The XLAT pin of the TLC5940(s)
nchips- The number of TLC5940s (if you are daisy chaining)

Definition at line 164 of file TLC5940.h.


Member Function Documentation

void set ( int  idx,
unsigned short  data 
)

Set the next chunk of grayscale data to be sent.

Parameters:
data- Array of 16 bit shorts containing 16 12 bit grayscale data chunks per TLC5940
Note:
These must be in intervals of at least (1/GSCLK_SPEED) * 4096 to be sent

Definition at line 274 of file TLC5940.h.