Serial8 is now defined for T4.1. Previously it was defined for T4B1, but went away on T4B2 and released. It is now defined on the T4.1teensy4-core
#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}; |
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 |
#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 |