Import Tlc5940 version r014_2

This commit is contained in:
PaulStoffregen
2014-06-07 06:33:39 -07:00
commit d765d114e0
31 changed files with 4609 additions and 0 deletions

86
pinouts/ATmega_8.h Normal file
View File

@@ -0,0 +1,86 @@
/* Copyright (c) 2009 by Alex Leone <acleone ~AT~ gmail.com>
This file is part of the Arduino TLC5940 Library.
The Arduino TLC5940 Library is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The Arduino TLC5940 Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Arduino TLC5940 Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef TLC_ATMEGA_8_H
#define TLC_ATMEGA_8_H
#if DATA_TRANSFER_MODE == TLC_SPI
#warning SPI cannot be used on the ATmega8 because it interferes with timer2
#warning setting DATA_TRANSFER_MODE to TLC_BITBANG
#define DATA_TRANSFER_MODE TLC_BITBANG
#endif
/** \file
SPI and timer pins for the ATmega8. Don't edit these. All
changeable pins are defined in tlc_config.h */
/** VPRG (Arduino digital pin 8) -> VPRG (TLC pin 27) */
#define DEFAULT_VPRG_PIN PB0
#define DEFAULT_VPRG_PORT PORTB
#define DEFAULT_VPRG_DDR DDRB
/** XERR (Arduino digital pin 12) -> XERR (TLC pin 16) */
#define DEFAULT_XERR_PIN PB4
#define DEFAULT_XERR_PORT PORTB
#define DEFAULT_XERR_DDR DDRB
#define DEFAULT_XERR_PINS PINB
/** SIN (Arduino digital pin 7) -> SIN (TLC pin 26) */
#define DEFAULT_BB_SIN_PIN PD7
#define DEFAULT_BB_SIN_PORT PORTD
#define DEFAULT_BB_SIN_DDR DDRD
/** SCLK (Arduino digital pin 4) -> SCLK (TLC pin 25) */
#define DEFAULT_BB_SCLK_PIN PD4
#define DEFAULT_BB_SCLK_PORT PORTD
#define DEFAULT_BB_SCLK_DDR DDRD
/** MOSI (Arduino digital pin 11) -> SIN (TLC pin 26) */
#define TLC_MOSI_PIN PB3
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
/** SCK (Arduino digital pin 13) -> SCLK (TLC pin 25) */
#define TLC_SCK_PIN PB5
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
/** SS will be set to output as to not interfere with SPI master operation.
If you have changed the pin-outs and the library doesn't seem to work
or works intermittently, make sure this pin is set correctly. This pin
will not be used by the library other than setting its direction to
output. */
#define TLC_SS_PIN PB2
#define TLC_SS_DDR DDRB
/** OC1A (Arduino digital pin 9) -> XLAT (TLC pin 24) */
#define XLAT_PIN PB1
#define XLAT_PORT PORTB
#define XLAT_DDR DDRB
/** OC1B (Arduino digital pin 10) -> BLANK (TLC pin 23) */
#define BLANK_PIN PB2
#define BLANK_PORT PORTB
#define BLANK_DDR DDRB
/** OC2B (Arduino digital pin 3) -> GSCLK (TLC pin 18) */
#define GSCLK_PIN PD3
#define GSCLK_PORT PORTD
#define GSCLK_DDR DDRD
#endif

80
pinouts/ATmega_xx4.h Normal file
View File

@@ -0,0 +1,80 @@
/* Copyright (c) 2009 by Alex Leone <acleone ~AT~ gmail.com>
This file is part of the Arduino TLC5940 Library.
The Arduino TLC5940 Library is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The Arduino TLC5940 Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Arduino TLC5940 Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef TLC_ATMEGA_XX8_H
#define TLC_ATMEGA_XX8_H
/** \file
SPI and timer pins for the ATmega164/324/644. Don't edit these. All
changeable pins are defined in tlc_config.h */
/** VPRG (Sanguino digital pin 15) -> VPRG (TLC pin 27) */
#define DEFAULT_VPRG_PIN PD7
#define DEFAULT_VPRG_PORT PORTD
#define DEFAULT_VPRG_DDR DDRD
/** XERR (Sanguino digital pin 6) -> XERR (TLC pin 16) */
#define DEFAULT_XERR_PIN PB6
#define DEFAULT_XERR_PORT PORTB
#define DEFAULT_XERR_DDR DDRB
#define DEFAULT_XERR_PINS PINB
/** SIN (Sanguino digital pin 5) -> SIN (TLC pin 26) */
#define DEFAULT_BB_SIN_PIN PB5
#define DEFAULT_BB_SIN_PORT PORTB
#define DEFAULT_BB_SIN_DDR DDRB
/** SCLK (Sanguino digital pin 7) -> SCLK (TLC pin 25) */
#define DEFAULT_BB_SCLK_PIN PB7
#define DEFAULT_BB_SCLK_PORT PORTB
#define DEFAULT_BB_SCLK_DDR DDRB
/** MOSI (Sanguino digital pin 5) -> SIN (TLC pin 26) */
#define TLC_MOSI_PIN PB5
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
/** SCK (Sanguino digital pin 7) -> SCLK (TLC pin 25) */
#define TLC_SCK_PIN PB7
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
/** SS will be set to output as to not interfere with SPI master operation.
If you have changed the pin-outs and the library doesn't seem to work
or works intermittently, make sure this pin is set correctly. This pin
will not be used by the library other than setting its direction to
output. */
#define TLC_SS_PIN PB4
#define TLC_SS_DDR DDRB
/** OC1A (Sanguino digital pin 13) -> XLAT (TLC pin 24) */
#define XLAT_PIN PD5
#define XLAT_PORT PORTD
#define XLAT_DDR DDRD
/** OC1B (Sanguino digital pin 12) -> BLANK (TLC pin 23) */
#define BLANK_PIN PD4
#define BLANK_PORT PORTD
#define BLANK_DDR DDRD
/** OC2B (Sanguino digital pin 14) -> GSCLK (TLC pin 18) */
#define GSCLK_PIN PD6
#define GSCLK_PORT PORTD
#define GSCLK_DDR DDRD
#endif

80
pinouts/ATmega_xx8.h Normal file
View File

@@ -0,0 +1,80 @@
/* Copyright (c) 2009 by Alex Leone <acleone ~AT~ gmail.com>
This file is part of the Arduino TLC5940 Library.
The Arduino TLC5940 Library is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The Arduino TLC5940 Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Arduino TLC5940 Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef TLC_ATMEGA_XX8_H
#define TLC_ATMEGA_XX8_H
/** \file
SPI and timer pins for the ATmega168/48/88. Don't edit these. All
changeable pins are defined in tlc_config.h */
/** VPRG (Arduino digital pin 8) -> VPRG (TLC pin 27) */
#define DEFAULT_VPRG_PIN PB0
#define DEFAULT_VPRG_PORT PORTB
#define DEFAULT_VPRG_DDR DDRB
/** XERR (Arduino digital pin 12) -> XERR (TLC pin 16) */
#define DEFAULT_XERR_PIN PB4
#define DEFAULT_XERR_PORT PORTB
#define DEFAULT_XERR_DDR DDRB
#define DEFAULT_XERR_PINS PINB
/** SIN (Arduino digital pin 7) -> SIN (TLC pin 26) */
#define DEFAULT_BB_SIN_PIN PD7
#define DEFAULT_BB_SIN_PORT PORTD
#define DEFAULT_BB_SIN_DDR DDRD
/** SCLK (Arduino digital pin 4) -> SCLK (TLC pin 25) */
#define DEFAULT_BB_SCLK_PIN PD4
#define DEFAULT_BB_SCLK_PORT PORTD
#define DEFAULT_BB_SCLK_DDR DDRD
/** MOSI (Arduino digital pin 11) -> SIN (TLC pin 26) */
#define TLC_MOSI_PIN PB3
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
/** SCK (Arduino digital pin 13) -> SCLK (TLC pin 25) */
#define TLC_SCK_PIN PB5
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
/** SS will be set to output as to not interfere with SPI master operation.
If you have changed the pin-outs and the library doesn't seem to work
or works intermittently, make sure this pin is set correctly. This pin
will not be used by the library other than setting its direction to
output. */
#define TLC_SS_PIN PB2
#define TLC_SS_DDR DDRB
/** OC1A (Arduino digital pin 9) -> XLAT (TLC pin 24) */
#define XLAT_PIN PB1
#define XLAT_PORT PORTB
#define XLAT_DDR DDRB
/** OC1B (Arduino digital pin 10) -> BLANK (TLC pin 23) */
#define BLANK_PIN PB2
#define BLANK_PORT PORTB
#define BLANK_DDR DDRB
/** OC2B (Arduino digital pin 3) -> GSCLK (TLC pin 18) */
#define GSCLK_PIN PD3
#define GSCLK_PORT PORTD
#define GSCLK_DDR DDRD
#endif

81
pinouts/Arduino_Mega.h Normal file
View File

@@ -0,0 +1,81 @@
/* Copyright (c) 2009 by Alex Leone <acleone ~AT~ gmail.com>
This file is part of the Arduino TLC5940 Library.
The Arduino TLC5940 Library is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The Arduino TLC5940 Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Arduino TLC5940 Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef ARDUINO_MEGA_H
#define ARDUINO_MEGA_H
/** \file
SPI and timer pins for the Arduino Mega. Don't edit these. All
changeable pins are defined in tlc_config.h */
/** VPRG (Mega pin 50) -> VPRG (TLC pin 27) */
#define DEFAULT_VPRG_PIN PB3
#define DEFAULT_VPRG_PORT PORTB
#define DEFAULT_VPRG_DDR DDRB
/** XERR (Mega pin 10) -> XERR (TLC pin 16) */
#define DEFAULT_XERR_PIN PB4
#define DEFAULT_XERR_PORT PORTB
#define DEFAULT_XERR_DDR DDRB
#define DEFAULT_XERR_PINS PINB
/** SIN (Mega pin 51) -> SIN (TLC pin 26) */
#define DEFAULT_BB_SIN_PIN PB2
#define DEFAULT_BB_SIN_PORT PORTB
#define DEFAULT_BB_SIN_DDR DDRB
/** SCLK (Mega pin 52) -> SCLK (TLC pin 25) */
#define DEFAULT_BB_SCLK_PIN PB1
#define DEFAULT_BB_SCLK_PORT PORTB
#define DEFAULT_BB_SCLK_DDR DDRB
/** MOSI (Mega pin 51) -> SIN (TLC pin 26) */
#define TLC_MOSI_PIN PB2
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
/** SCK (Mega pin 52) -> SCLK (TLC pin 25) */
#define TLC_SCK_PIN PB1
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
// SS (Mega pin 53)
/** SS will be set to output as to not interfere with SPI master operation.
If you have changed the pin-outs and the library doesn't seem to work
or works intermittently, make sure this pin is set correctly. This pin
will not be used by the library other than setting its direction to
output. */
#define TLC_SS_PIN PB0
#define TLC_SS_DDR DDRB
/** OC1A (Mega pin 11) -> XLAT (TLC pin 24) */
#define XLAT_PIN PB5
#define XLAT_PORT PORTB
#define XLAT_DDR DDRB
/** OC1B (Mega pin 12) -> BLANK (TLC pin 23) */
#define BLANK_PIN PB6
#define BLANK_PORT PORTB
#define BLANK_DDR DDRB
/** OC2B (Mega pin 9) -> GSCLK (TLC pin 18) */
#define GSCLK_PIN PH6
#define GSCLK_PORT PORTH
#define GSCLK_DDR DDRH
#endif

39
pinouts/Teensy_xxU4.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef TLC_Teensy_xxU4_h
#define TLC_Teensy_xxU4_h
#if DATA_TRANSFER_MODE == TLC_BITBANG
#error "If you want bitbang mode, insert pin defs here"
#endif
// MOSI (Teensy pin 2) -> SIN (TLC pin 26)
#define TLC_MOSI_PIN 2
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
// SCK (Teensy pin 1) -> SCLK (TLC pin 25)
#define TLC_SCK_PIN 1
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
// SS (Teensy pin 0)
#define TLC_SS_PIN 0
#define TLC_SS_DDR DDRB
// OC1A (Teensy pin 14) -> XLAT (TLC pin 24)
#define XLAT_PIN 5
#define XLAT_PORT PORTB
#define XLAT_DDR DDRB
// OC1B (Teensy pin 15) -> BLANK (TLC pin 23)
#define BLANK_PIN 6
#define BLANK_PORT PORTB
#define BLANK_DDR DDRB
// OC3A (Teensy pin 9) -> GSCLK (TLC pin 18)
#define GSCLK_PIN 6
#define GSCLK_PORT PORTC
#define GSCLK_DDR DDRC
#define TLC_TIMER3_GSCLK 1
#endif

38
pinouts/Teensypp_xxx6.h Normal file
View File

@@ -0,0 +1,38 @@
#ifndef TLC_Teensypp_xxx6_H
#define TLC_Teensypp_xxx6_H
#if DATA_TRANSFER_MODE == TLC_BITBANG
#error "If you want bitbang mode, insert pin defs here"
#endif
// MOSI (Teensy++ pin 22) -> SIN (TLC pin 26)
#define TLC_MOSI_PIN 2
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
// SCK (Teensy++ pin 21) -> SCLK (TLC pin 25)
#define TLC_SCK_PIN 1
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
// SS (Teensy++ pin 20)
#define TLC_SS_PIN 0
#define TLC_SS_DDR DDRB
// OC1A (Teensy++ pin 25) -> XLAT (TLC pin 24)
#define XLAT_PIN 5
#define XLAT_PORT PORTB
#define XLAT_DDR DDRB
// OC1B (Teensy++ pin 26) -> BLANK (TLC pin 23)
#define BLANK_PIN 6
#define BLANK_PORT PORTB
#define BLANK_DDR DDRB
// OC2B (Teensy++ pin 1) -> GSCLK (TLC pin 18)
#define GSCLK_PIN 1
#define GSCLK_PORT PORTD
#define GSCLK_DDR DDRD
#endif

118
pinouts/chip_includes.h Normal file
View File

@@ -0,0 +1,118 @@
/* Copyright (c) 2009 by Alex Leone <acleone ~AT~ gmail.com>
This file is part of the Arduino TLC5940 Library.
The Arduino TLC5940 Library is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The Arduino TLC5940 Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Arduino TLC5940 Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef TLC_CHIP_INCLUDES_H
#define TLC_CHIP_INCLUDES_H
/** \file
Includes the chip-specfic defaults and pin definitions. */
#include <avr/io.h>
#ifndef PB0
#define PB0 PORTB0
#define PB1 PORTB1
#define PB2 PORTB2
#define PB3 PORTB3
#define PB4 PORTB4
#define PB5 PORTB5
#define PB6 PORTB6
#define PB7 PORTB7
#endif
#ifndef PC0
#define PC0 PORTC0
#define PC1 PORTC1
#define PC2 PORTC2
#define PC3 PORTC3
#define PC4 PORTC4
#define PC5 PORTC5
#define PC6 PORTC6
#define PC7 PORTC7
#endif
#ifndef PD0
#define PD0 PORTD0
#define PD1 PORTD1
#define PD2 PORTD2
#define PD3 PORTD3
#define PD4 PORTD4
#define PD5 PORTD5
#define PD6 PORTD6
#define PD7 PORTD7
#endif
#ifndef PH0
#define PH0 PORTH0
#define PH1 PORTH1
#define PH2 PORTH2
#define PH3 PORTH3
#define PH4 PORTH4
#define PH5 PORTH5
#define PH6 PORTH6
#define PH7 PORTH7
#endif
/* Chip Specific Pinouts */
#if defined (__AVR_ATmega168__) \
|| defined (__AVR_ATmega168P__) \
|| defined (__AVR_ATmega88P__) \
|| defined (__AVR_ATmega88__) \
|| defined (__AVR_ATmega48P__) \
|| defined (__AVR_ATmega48__) \
|| defined (__AVR_ATmega328P__)
/* Diecimila / Duemilanove / almost everything */
#include "ATmega_xx8.h"
#elif defined (__AVR_ATmega8__)
/* ATmega8 */
#include "ATmega_8.h"
#elif defined (__AVR_ATmega164P__) \
|| defined (__AVR_ATmega324P__) \
|| defined (__AVR_ATmega644__) \
|| defined (__AVR_ATmega644P__)
/* Sanguino */
#include "ATmega_xx4.h"
#elif defined (__AVR_ATmega640__) \
|| defined (__AVR_ATmega1280__) \
|| defined (__AVR_ATmega1281__) \
|| defined (__AVR_ATmega2560__) \
|| defined (__AVR_ATmega2561__)
/* Arduino Mega */
#include "Arduino_Mega.h"
#elif defined (__AVR_ATmega32U4__)
/* Teensy 2.0 */
#include "Teensy_xxU4.h"
#elif defined (__AVR_AT90USB646__) \
|| defined (__AVR_AT90USB1286__)
/* Teensy++ 2.0 */
#include "Teensypp_xxx6.h"
#else
#error "Unknown Chip!"
#endif
#endif