Add support for Teensy 4

This commit is contained in:
PaulStoffregen
2022-02-25 07:27:48 -08:00
parent 0c19010948
commit e82dba6210
5 changed files with 85 additions and 2 deletions

37
pinouts/Teensy_IMXRT.h Normal file
View File

@@ -0,0 +1,37 @@
#ifndef TLC_Teensy_IMXRT_h
#define TLC_Teensy_IMXRT_h
// bitbang I/O is pretty fast on Teensy 3.1
// and avoids SPI sharing problems
#ifdef DATA_TRANSFER_MODE
#undef DATA_TRANSFER_MODE
#endif
#define DATA_TRANSFER_MODE TLC_BITBANG
// Teensy pin 6 -> SIN (TLC pin 26)
#define DEFAULT_BB_SIN_PIN 6
#define DEFAULT_BB_SIN_PORT 6
#define DEFAULT_BB_SIN_DDR 6
// Teensy pin 7 -> SCLK (TLC pin 25)
#define DEFAULT_BB_SCLK_PIN 7
#define DEFAULT_BB_SCLK_PORT 7
#define DEFAULT_BB_SCLK_DDR 7
// FTM1_CH0 (Teensy pin 3) -> XLAT (TLC pin 24)
#define XLAT_PIN 3
#define XLAT_PORT 3
#define XLAT_DDR 3
// FTM1_CH1 (Teensy pin 4) -> BLANK (TLC pin 23)
#define BLANK_PIN 2
#define BLANK_PORT 2
#define BLANK_DDR 2
// CMTOUT (Teensy pin 5) -> GSCLK (TLC pin 18)
#define GSCLK_PIN 5
#define GSCLK_PORT 5
#define GSCLK_DDR 5
#endif

View File

@@ -120,6 +120,10 @@
/* Teensy 3.0 & 3.1 & 3.2 & 3.5 & 3.6*/
#include "Teensy_KinetisK20.h"
#elif defined (__IMXRT1062__)
/* Teensy 4.0, 4.1, MicroMod */
#include "Teensy_IMXRT.h"
#else
#error "Unknown Chip!"

View File

@@ -8,7 +8,9 @@
#define output_pin(ddr, pin) ddr |= _BV(pin)
#define pullup_pin(ddr, port, pin) ddr &= ~_BV(pin); port |= _BV(pin)
#elif defined(TEENSYDUINO)
#if F_CPU > 48000000
#if F_CPU > 120000000
#define pulse_pin(port, pin) delayNanoseconds(10); digitalWriteFast(pin, HIGH); delayNanoseconds(20); digitalWriteFast(pin, LOW)
#elif F_CPU > 48000000
#define pulse_pin(port, pin) digitalWriteFast(pin, HIGH); asm("nop"); digitalWriteFast(pin, LOW)
#else
#define pulse_pin(port, pin) digitalWriteFast(pin, HIGH); digitalWriteFast(pin, LOW)