From 3645ee19efebfa61c314c1d78128e4ba32bfac09 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Fri, 30 Jun 2017 22:53:36 -0400 Subject: [PATCH] Adding pin definitions for Teensy boards --- BUILD.txt | 42 +++++++++++++++++++++++++++++++++++++++--- IOArduino.cpp | 20 ++++++++++++++++++++ SerialArduino.cpp | 9 +++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/BUILD.txt b/BUILD.txt index e802c56..f37434a 100644 --- a/BUILD.txt +++ b/BUILD.txt @@ -296,7 +296,7 @@ SDATA PB6 SCLK PB5 DATA PB4 (TxRxData)* DCLK PB3 (TxRxCLK)* -CLKOUT PA15 (jumper wire in RF7021SE) +CLKOUT PA15 (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) PAC PB14 (PTT LED) VCC 3.3 V GND Ground @@ -335,7 +335,7 @@ reducing EMI. Pinout definitions for Arduino Due/Zero + RF7021SE: =================================================== -Use STM32duino + Arduino IDE for building the code +Use Arduino IDE for building the code - Main RF7021SE board: CE 12 @@ -345,7 +345,7 @@ SDATA 4 // 2 in Arduino Zero Pro SCLK 3 DATA 7 (TxRxData)* DCLK 8 (TxRxCLK)* -CLKOUT 2 // 4 in Arduino Zero Pro (jumper wire in RF7021SE) +CLKOUT 2 // 4 in Arduino Zero Pro (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) PAC 9 (PTT LED) VCC 3.3 V GND Ground @@ -368,3 +368,39 @@ PIN_DEB 11 * You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI. +Pinout definitions for Teensy (3.1, 3.2, 3.5 or 3.6) + RF7021SE: +=================================================== +Use Teensyduino + Arduino IDE for building the code + +- Main RF7021SE board: +CE 6 +SLE 5 +SREAD 4 +SDATA 3 +SCLK 2 +DATA 7 (TxRxData)* +DCLK 8 (TxRxCLK)* +CLKOUT 22 (jumper wire in RF7021SE, not needed with BIDIR_DATA_PIN enabled) +PAC 14 (PTT LED) +VCC 3.3 V +GND Ground + +- Serial ports: +Teensy USB Port (host communication) +DISP_TXD 1 (Nextion LCD serial repeater) +DISP_RXD 0 (Nextion LCD serial repeater) + +- Status LEDs: +COS_LED 15 +PTT_LED 14 +P25_LED 19 +YSF_LED 18 +DMR_LED 17 +DSTAR_LED 16 + +- Misc pins: +PIN_LED 13 +PIN_DEB 23 + +* You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for +reducing EMI. diff --git a/IOArduino.cpp b/IOArduino.cpp index d99b959..a74a324 100644 --- a/IOArduino.cpp +++ b/IOArduino.cpp @@ -88,6 +88,26 @@ #error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03, or ADF7021_CARRIER_BOARD need to be defined" #endif +#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) + +// Teensy pin definitions +#define PIN_SCLK 2 +#define PIN_SDATA 3 +#define PIN_SREAD 4 +#define PIN_SLE 5 +#define PIN_CE 6 +#define PIN_RXD 7 +#define PIN_TXD 8 +#define PIN_CLKOUT 22 +#define PIN_LED 13 +#define PIN_DEB 23 +#define PIN_DSTAR_LED 16 +#define PIN_DMR_LED 17 +#define PIN_YSF_LED 18 +#define PIN_P25_LED 19 +#define PIN_PTT_LED 14 +#define PIN_COS_LED 15 + #else // Arduino pin definitions (Due and Zero) diff --git a/SerialArduino.cpp b/SerialArduino.cpp index c2c4c8d..021bfbc 100644 --- a/SerialArduino.cpp +++ b/SerialArduino.cpp @@ -37,6 +37,8 @@ void CSerialPort::beginInt(uint8_t n, int speed) case 3U: #if defined(SERIAL_REPEATER) && defined(__STM32F1__) Serial2.begin(speed); + #elif defined(SERIAL_REPEATER) && (defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)) + Serial1.begin(speed); #endif break; default: @@ -56,6 +58,8 @@ int CSerialPort::availableInt(uint8_t n) case 3U: #if defined(SERIAL_REPEATER) && defined(__STM32F1__) return Serial2.available(); + #elif defined(SERIAL_REPEATER) && (defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)) + return Serial1.available(); #endif default: return false; @@ -74,6 +78,8 @@ uint8_t CSerialPort::readInt(uint8_t n) case 3U: #if defined(SERIAL_REPEATER) && defined(__STM32F1__) return Serial2.read(); + #elif defined(SERIAL_REPEATER) && (defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)) + return Serial1.read(); #endif default: return 0U; @@ -97,6 +103,9 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool #if defined(SERIAL_REPEATER) && defined(__STM32F1__) Serial2.write(data, length); break; + #elif defined(SERIAL_REPEATER) && (defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)) + Serial1.write(data, length); + break; #endif default: break;