Browse Source

Merge pull request #439 from KurtE/T41_Serial8

T4.1 - Serial8 is on pins 34 and 35
main
Paul Stoffregen 4 years ago
parent
commit
b0c38794ff
No account linked to committer's email address
5 changed files with 18 additions and 8 deletions
  1. +1
    -1
      teensy4/HardwareSerial.cpp
  2. +3
    -3
      teensy4/HardwareSerial.h
  3. +5
    -0
      teensy4/HardwareSerial5.cpp
  4. +4
    -3
      teensy4/HardwareSerial8.cpp
  5. +5
    -1
      teensy4/pins_arduino.h

+ 1
- 1
teensy4/HardwareSerial.cpp View File



#define UART_CLOCK 24000000 #define UART_CLOCK 24000000


#if defined(__IMXRT1052__)
#if defined(ARDUINO_TEENSY41)
SerialEventCheckingFunctionPointer HardwareSerial::serial_event_handler_checks[8] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; SerialEventCheckingFunctionPointer HardwareSerial::serial_event_handler_checks[8] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
#else #else
SerialEventCheckingFunctionPointer HardwareSerial::serial_event_handler_checks[7] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; SerialEventCheckingFunctionPointer HardwareSerial::serial_event_handler_checks[7] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};

+ 3
- 3
teensy4/HardwareSerial.h View File

extern void IRQHandler_Serial5(); extern void IRQHandler_Serial5();
extern void IRQHandler_Serial6(); extern void IRQHandler_Serial6();
extern void IRQHandler_Serial7(); extern void IRQHandler_Serial7();
#if defined(__IMXRT1052__)
#if defined(ARDUINO_TEENSY41)
extern void IRQHandler_Serial8(); extern void IRQHandler_Serial8();
#endif #endif
} }
friend void IRQHandler_Serial5(); friend void IRQHandler_Serial5();
friend void IRQHandler_Serial6(); friend void IRQHandler_Serial6();
friend void IRQHandler_Serial7(); friend void IRQHandler_Serial7();
#if defined(__IMXRT1052__)
#if defined(ARDUINO_TEENSY41)
friend void IRQHandler_Serial8(); friend void IRQHandler_Serial8();
static SerialEventCheckingFunctionPointer serial_event_handler_checks[8]; static SerialEventCheckingFunctionPointer serial_event_handler_checks[8];
#else #else
extern void serialEvent6(void); extern void serialEvent6(void);
extern void serialEvent7(void); extern void serialEvent7(void);


#if defined(__IMXRT1052__)
#if defined(ARDUINO_TEENSY41)
extern HardwareSerial Serial8; extern HardwareSerial Serial8;
extern void serialEvent8(void); extern void serialEvent8(void);
#endif #endif

+ 5
- 0
teensy4/HardwareSerial5.cpp View File

static HardwareSerial::hardware_t UART8_Hardware = { static HardwareSerial::hardware_t UART8_Hardware = {
4, IRQ_LPUART8, &IRQHandler_Serial5, &serial_event_check_serial5, 4, IRQ_LPUART8, &IRQHandler_Serial5, &serial_event_check_serial5,
CCM_CCGR6, CCM_CCGR6_LPUART8(CCM_CCGR_ON), CCM_CCGR6, CCM_CCGR6_LPUART8(CCM_CCGR_ON),
#if defined(ARDUINO_TEENSY41)
{{21,2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 1}, {46, 2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 0}},
{{20,2, &IOMUXC_LPUART8_TX_SELECT_INPUT, 1}, {47, 2, &IOMUXC_LPUART8_TX_SELECT_INPUT, 0}},
#else
{{21,2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 1}, {38, 2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 0}}, {{21,2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 1}, {38, 2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 0}},
{{20,2, &IOMUXC_LPUART8_TX_SELECT_INPUT, 1}, {39, 2, &IOMUXC_LPUART8_TX_SELECT_INPUT, 0}}, {{20,2, &IOMUXC_LPUART8_TX_SELECT_INPUT, 1}, {39, 2, &IOMUXC_LPUART8_TX_SELECT_INPUT, 0}},
#endif
0xff, // No CTS pin 0xff, // No CTS pin
0, // No CTS 0, // No CTS
IRQ_PRIORITY, 38, 24, // IRQ, rts_low_watermark, rts_high_watermark IRQ_PRIORITY, 38, 24, // IRQ, rts_low_watermark, rts_high_watermark

+ 4
- 3
teensy4/HardwareSerial8.cpp View File



#include <Arduino.h> #include <Arduino.h>
#include "HardwareSerial.h" #include "HardwareSerial.h"
#if defined(__IMXRT1052__)
#if defined(__IMXRT1062__) && defined(ARDUINO_TEENSY41)


#ifndef SERIAL8_TX_BUFFER_SIZE #ifndef SERIAL8_TX_BUFFER_SIZE
#define SERIAL8_TX_BUFFER_SIZE 40 // number of outgoing bytes to buffer #define SERIAL8_TX_BUFFER_SIZE 40 // number of outgoing bytes to buffer
static HardwareSerial::hardware_t UART5_Hardware = { static HardwareSerial::hardware_t UART5_Hardware = {
7, IRQ_LPUART5, &IRQHandler_Serial8, &serial_event_check_serial8, 7, IRQ_LPUART5, &IRQHandler_Serial8, &serial_event_check_serial8,
CCM_CCGR3, CCM_CCGR3_LPUART5(CCM_CCGR_ON), CCM_CCGR3, CCM_CCGR3_LPUART5(CCM_CCGR_ON),
{{30,2, &IOMUXC_LPUART5_RX_SELECT_INPUT, 0}, {0xff, 0xff, nullptr, 0}},
{{31,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}},
{{34,1, &IOMUXC_LPUART5_RX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}},
{{35,1, &IOMUXC_LPUART5_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}},

0xff, // No CTS pin 0xff, // No CTS pin
0, // No CTS 0, // No CTS
IRQ_PRIORITY, 38, 24, // IRQ, rts_low_watermark, rts_high_watermark IRQ_PRIORITY, 38, 24, // IRQ, rts_low_watermark, rts_high_watermark

+ 5
- 1
teensy4/pins_arduino.h View File

#define PIN_SERIAL_TX (1) #define PIN_SERIAL_TX (1)




#ifdef ARDUINO_TEENSY41
#define NUM_DIGITAL_PINS 55
#define NUM_ANALOG_INPUTS 18
#else
#define NUM_DIGITAL_PINS 40 #define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 14 #define NUM_ANALOG_INPUTS 14

#endif


#define NOT_AN_INTERRUPT -1 #define NOT_AN_INTERRUPT -1



Loading…
Cancel
Save