This library creates the interface to operate the TLC5940. This device manages 16 PWM outputs.
tlc5940.h@1:e8c8347fa919, 2010-11-27 (annotated)
- Committer:
- Fiuba
- Date:
- Sat Nov 27 00:37:33 2010 +0000
- Revision:
- 1:e8c8347fa919
- Parent:
- 0:64ea4d75027c
- Child:
- 2:500ec33cd4b6
Fixed doxygen documentation (hope so)
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:64ea4d75027c | 30 | |
Fiuba | 0:64ea4d75027c | 31 | DigitalOut VPROG; |
Fiuba | 0:64ea4d75027c | 32 | DigitalOut SIN; |
Fiuba | 0:64ea4d75027c | 33 | DigitalOut SCLK; |
Fiuba | 0:64ea4d75027c | 34 | DigitalOut XLAT; |
Fiuba | 0:64ea4d75027c | 35 | DigitalOut BLANK; |
Fiuba | 0:64ea4d75027c | 36 | DigitalOut DCPROG; |
Fiuba | 0:64ea4d75027c | 37 | DigitalOut GSCLK; |
Fiuba | 0:64ea4d75027c | 38 | |
Fiuba | 0:64ea4d75027c | 39 | DigitalIn SOUT; |
Fiuba | 0:64ea4d75027c | 40 | DigitalIn XERR; |
Fiuba | 0:64ea4d75027c | 41 | |
Fiuba | 0:64ea4d75027c | 42 | public: |
Fiuba | 1:e8c8347fa919 | 43 | /** Create a tlc5940 interface object connected to some specifics pins |
Fiuba | 1:e8c8347fa919 | 44 | * |
Fiuba | 1:e8c8347fa919 | 45 | * @param DC_data[] Dot Correction values for initialization |
Fiuba | 1:e8c8347fa919 | 46 | */ |
Fiuba | 0:64ea4d75027c | 47 | tlc5940 (int DC_data[]); |
Fiuba | 1:e8c8347fa919 | 48 | |
Fiuba | 1:e8c8347fa919 | 49 | /** Send the specified set of grayscale values |
Fiuba | 1:e8c8347fa919 | 50 | * |
Fiuba | 1:e8c8347fa919 | 51 | * @param data[] Array of 12-bit Grayscale values for transmission |
Fiuba | 1:e8c8347fa919 | 52 | */ |
Fiuba | 0:64ea4d75027c | 53 | void send_data (int data[]); |
Fiuba | 0:64ea4d75027c | 54 | }; |
Fiuba | 0:64ea4d75027c | 55 | |
Fiuba | 0:64ea4d75027c | 56 | #endif |