This library creates the interface to operate the TLC5940. This device manages 16 PWM outputs.

Committer:
Fiuba
Date:
Sat Nov 27 00:50:01 2010 +0000
Revision:
2:500ec33cd4b6
Parent:
1:e8c8347fa919
Child:
3:40cb2f9adc4d
The number of ICs is defined by the constructor.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Fiuba 1:e8c8347fa919 1 /*
Fiuba 1:e8c8347fa919 2 * tlc5940 - Interface to operate TI's IC TLC5940
Fiuba 1:e8c8347fa919 3 * Copyright (C) 2010 German Bassi.
Fiuba 1:e8c8347fa919 4 *
Fiuba 1:e8c8347fa919 5 * This program is free software; you can redistribute it and/or modify
Fiuba 1:e8c8347fa919 6 * it under the terms of the GNU General Public License as published by
Fiuba 1:e8c8347fa919 7 * the Free Software Foundation; either version 2 of the License, or
Fiuba 1:e8c8347fa919 8 * (at your option) any later version.
Fiuba 1:e8c8347fa919 9 *
Fiuba 1:e8c8347fa919 10 * This program is distributed in the hope that it will be useful,
Fiuba 1:e8c8347fa919 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Fiuba 1:e8c8347fa919 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Fiuba 1:e8c8347fa919 13 * GNU General Public License for more details.
Fiuba 1:e8c8347fa919 14 *
Fiuba 1:e8c8347fa919 15 * You should have received a copy of the GNU General Public License
Fiuba 1:e8c8347fa919 16 * along with this program; if not, write to the Free Software
Fiuba 1:e8c8347fa919 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Fiuba 1:e8c8347fa919 18 */
Fiuba 1:e8c8347fa919 19
Fiuba 0:64ea4d75027c 20 #ifndef MBED_TLC5940_H
Fiuba 0:64ea4d75027c 21 #define MBED_TLC5940_H
Fiuba 0:64ea4d75027c 22
Fiuba 0:64ea4d75027c 23 #include "mbed.h"
Fiuba 0:64ea4d75027c 24
Fiuba 0:64ea4d75027c 25 class tlc5940 {
Fiuba 0:64ea4d75027c 26 private:
Fiuba 0:64ea4d75027c 27 bool first_cycle_flag;
Fiuba 0:64ea4d75027c 28 int GSCLK_counter, data_counter;
Fiuba 0:64ea4d75027c 29 int aux_value, aux_ind;
Fiuba 2:500ec33cd4b6 30 int num_ic;
Fiuba 0:64ea4d75027c 31
Fiuba 0:64ea4d75027c 32 DigitalOut VPROG;
Fiuba 0:64ea4d75027c 33 DigitalOut SIN;
Fiuba 0:64ea4d75027c 34 DigitalOut SCLK;
Fiuba 0:64ea4d75027c 35 DigitalOut XLAT;
Fiuba 0:64ea4d75027c 36 DigitalOut BLANK;
Fiuba 0:64ea4d75027c 37 DigitalOut DCPROG;
Fiuba 0:64ea4d75027c 38 DigitalOut GSCLK;
Fiuba 0:64ea4d75027c 39
Fiuba 0:64ea4d75027c 40 DigitalIn SOUT;
Fiuba 0:64ea4d75027c 41 DigitalIn XERR;
Fiuba 0:64ea4d75027c 42
Fiuba 0:64ea4d75027c 43 public:
Fiuba 1:e8c8347fa919 44 /** Create a tlc5940 interface object connected to some specifics pins
Fiuba 1:e8c8347fa919 45 *
Fiuba 2:500ec33cd4b6 46 * @param num_ics Number of TLC5940 connected in series
Fiuba 1:e8c8347fa919 47 * @param DC_data[] Dot Correction values for initialization
Fiuba 1:e8c8347fa919 48 */
Fiuba 2:500ec33cd4b6 49 tlc5940 (int num_ics, int DC_data[]);
Fiuba 1:e8c8347fa919 50
Fiuba 1:e8c8347fa919 51 /** Send the specified set of grayscale values
Fiuba 1:e8c8347fa919 52 *
Fiuba 1:e8c8347fa919 53 * @param data[] Array of 12-bit Grayscale values for transmission
Fiuba 1:e8c8347fa919 54 */
Fiuba 0:64ea4d75027c 55 void send_data (int data[]);
Fiuba 0:64ea4d75027c 56 };
Fiuba 0:64ea4d75027c 57
Fiuba 0:64ea4d75027c 58 #endif