I forgot to remove the default eventhandlers from some of the HardwareSerial files as such the ones in the serialEventX files was not used and why my flags were not set properly. Could have done simple fix, but decide to make it more consistent with what I did in T3.x/LC code and not look through all the NULLS, but simply have list of active ones and count of active. Appears to fix the issue so far.teensy4-core
} | } | ||||
#if defined(ARDUINO_TEENSY41) | #if defined(ARDUINO_TEENSY41) | ||||
SerialEventCheckingFunctionPointer HardwareSerial::serial_event_handler_checks[8] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; | |||||
HardwareSerial *HardwareSerial::s_serials_with_serial_events[8]; | |||||
#else | #else | ||||
SerialEventCheckingFunctionPointer HardwareSerial::serial_event_handler_checks[7] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; | |||||
HardwareSerial *HardwareSerial::s_serials_with_serial_events[7]; | |||||
#endif | #endif | ||||
uint8_t HardwareSerial::serial_event_handlers_active = 0; | |||||
// define our static objects | |||||
uint8_t HardwareSerial::s_count_serials_with_serial_events = 0; | |||||
#define CTRL_ENABLE (LPUART_CTRL_TE | LPUART_CTRL_RE | LPUART_CTRL_RIE | LPUART_CTRL_ILIE) | #define CTRL_ENABLE (LPUART_CTRL_TE | LPUART_CTRL_RE | LPUART_CTRL_RIE | LPUART_CTRL_ILIE) | ||||
//Serial.printf(" stat:%x ctrl:%x fifo:%x water:%x\n", port->STAT, port->CTRL, port->FIFO, port->WATER ); | //Serial.printf(" stat:%x ctrl:%x fifo:%x water:%x\n", port->STAT, port->CTRL, port->FIFO, port->WATER ); | ||||
// Only if the user implemented their own... | // Only if the user implemented their own... | ||||
if (!(*hardware->serial_event_handler_default)) enableSerialEvents(); // Enable the processing of serialEvent for this object | |||||
if (!(*hardware->serial_event_handler_default)) addToSerialEventsList(); // Enable the processing of serialEvent for this object | |||||
}; | }; | ||||
inline void HardwareSerial::rts_assert() | inline void HardwareSerial::rts_assert() | ||||
rx_buffer_tail_ = 0; | rx_buffer_tail_ = 0; | ||||
if (rts_pin_baseReg_) rts_deassert(); | if (rts_pin_baseReg_) rts_deassert(); | ||||
// | // | ||||
disableSerialEvents(); // disable the processing of serialEvent for this object | |||||
} | } | ||||
void HardwareSerial::transmitterEnable(uint8_t pin) | void HardwareSerial::transmitterEnable(uint8_t pin) | ||||
} | } | ||||
void HardwareSerial::processSerialEvents() | |||||
{ | |||||
if (!serial_event_handlers_active) return; // bail quick if no one processing SerialEvents. | |||||
uint8_t handlers_still_to_process = serial_event_handlers_active; | |||||
for (uint8_t i = 0; i < 8; i++) { | |||||
if (serial_event_handler_checks[i]) { | |||||
(*serial_event_handler_checks[i])(); | |||||
if (--handlers_still_to_process == 0) return; | |||||
} | |||||
} | |||||
} | |||||
void HardwareSerial::enableSerialEvents() | |||||
{ | |||||
if (!serial_event_handler_checks[hardware->serial_index]) { | |||||
serial_event_handler_checks[hardware->serial_index] = hardware->serial_event_handler_check; // clear it out | |||||
serial_event_handlers_active++; | |||||
yield_active_check_flags |= YIELD_CHECK_HARDWARE_SERIAL; | |||||
} | |||||
} | |||||
void HardwareSerial::disableSerialEvents() | |||||
{ | |||||
if (serial_event_handler_checks[hardware->serial_index]) { | |||||
serial_event_handler_checks[hardware->serial_index] = nullptr; // clear it out | |||||
serial_event_handlers_active--; | |||||
if (!serial_event_handlers_active) yield_active_check_flags &= ~YIELD_CHECK_HARDWARE_SERIAL; | |||||
} | |||||
void HardwareSerial::addToSerialEventsList() { | |||||
s_serials_with_serial_events[s_count_serials_with_serial_events++] = this; | |||||
yield_active_check_flags |= YIELD_CHECK_HARDWARE_SERIAL; | |||||
} | } | ||||
extern const uint8_t count_pin_to_xbar_info; | extern const uint8_t count_pin_to_xbar_info; | ||||
typedef void(*SerialEventCheckingFunctionPointer)(); | |||||
class HardwareSerial : public Stream | class HardwareSerial : public Stream | ||||
{ | { | ||||
public: | public: | ||||
uint8_t serial_index; // which object are we? 0 based | uint8_t serial_index; // which object are we? 0 based | ||||
IRQ_NUMBER_t irq; | IRQ_NUMBER_t irq; | ||||
void (*irq_handler)(void); | void (*irq_handler)(void); | ||||
void (*serial_event_handler_check)(void); | |||||
void (* _serialEvent)(void); | |||||
const uint8_t *serial_event_handler_default; | const uint8_t *serial_event_handler_default; | ||||
volatile uint32_t &ccm_register; | volatile uint32_t &ccm_register; | ||||
const uint32_t ccm_value; | const uint32_t ccm_value; | ||||
size_t write9bit(uint32_t c); | size_t write9bit(uint32_t c); | ||||
// Event Handler functions and data | // Event Handler functions and data | ||||
void enableSerialEvents(); | |||||
void disableSerialEvents(); | |||||
static void processSerialEvents(); | |||||
static uint8_t serial_event_handlers_active; | static uint8_t serial_event_handlers_active; | ||||
using Print::write; | using Print::write; | ||||
*/ | */ | ||||
operator bool() { return true; } | operator bool() { return true; } | ||||
static inline void processSerialEventsList() { | |||||
for (uint8_t i = 0; i < s_count_serials_with_serial_events; i++) { | |||||
s_serials_with_serial_events[i]->doYieldCode(); | |||||
} | |||||
} | |||||
private: | private: | ||||
IMXRT_LPUART_t * const port; | IMXRT_LPUART_t * const port; | ||||
const hardware_t * const hardware; | const hardware_t * const hardware; | ||||
friend void IRQHandler_Serial7(); | friend void IRQHandler_Serial7(); | ||||
#if defined(ARDUINO_TEENSY41) | #if defined(ARDUINO_TEENSY41) | ||||
friend void IRQHandler_Serial8(); | friend void IRQHandler_Serial8(); | ||||
static SerialEventCheckingFunctionPointer serial_event_handler_checks[8]; | |||||
static HardwareSerial *s_serials_with_serial_events[8]; | |||||
#else | #else | ||||
static SerialEventCheckingFunctionPointer serial_event_handler_checks[7]; | |||||
static HardwareSerial *s_serials_with_serial_events[7]; | |||||
#endif | #endif | ||||
static uint8_t s_count_serials_with_serial_events; | |||||
void addToSerialEventsList(); | |||||
inline void doYieldCode() { | |||||
if (available()) (*hardware->_serialEvent)(); | |||||
} | |||||
Serial1.IRQHandler(); | Serial1.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial1() | |||||
{ | |||||
if (Serial1.available()) serialEvent1(); | |||||
} | |||||
// Serial1 | // Serial1 | ||||
static BUFTYPE tx_buffer1[SERIAL1_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer1[SERIAL1_TX_BUFFER_SIZE]; | ||||
const HardwareSerial::hardware_t UART6_Hardware = { | const HardwareSerial::hardware_t UART6_Hardware = { | ||||
0, IRQ_LPUART6, &IRQHandler_Serial1, | 0, IRQ_LPUART6, &IRQHandler_Serial1, | ||||
&serial_event_check_serial1, &_serialEvent1_default, | |||||
&serialEvent1, &_serialEvent1_default, | |||||
CCM_CCGR3, CCM_CCGR3_LPUART6(CCM_CCGR_ON), | CCM_CCGR3, CCM_CCGR3_LPUART6(CCM_CCGR_ON), | ||||
#if defined(ARDUINO_TEENSY41) | #if defined(ARDUINO_TEENSY41) | ||||
{{0,2, &IOMUXC_LPUART6_RX_SELECT_INPUT, 1}, {52, 2, &IOMUXC_LPUART6_RX_SELECT_INPUT, 0}}, | {{0,2, &IOMUXC_LPUART6_RX_SELECT_INPUT, 1}, {52, 2, &IOMUXC_LPUART6_RX_SELECT_INPUT, 0}}, |
Serial2.IRQHandler(); | Serial2.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial2() | |||||
{ | |||||
if (Serial2.available()) serialEvent2(); | |||||
} | |||||
// Serial2 | // Serial2 | ||||
static BUFTYPE tx_buffer2[SERIAL2_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer2[SERIAL2_TX_BUFFER_SIZE]; | ||||
static BUFTYPE rx_buffer2[SERIAL2_RX_BUFFER_SIZE]; | static BUFTYPE rx_buffer2[SERIAL2_RX_BUFFER_SIZE]; | ||||
uint8_t _serialEvent2_default __attribute__((weak)) PROGMEM = 0 ; | uint8_t _serialEvent2_default __attribute__((weak)) PROGMEM = 0 ; | ||||
static HardwareSerial::hardware_t UART4_Hardware = { | static HardwareSerial::hardware_t UART4_Hardware = { | ||||
1, IRQ_LPUART4, &IRQHandler_Serial2, | 1, IRQ_LPUART4, &IRQHandler_Serial2, | ||||
&serial_event_check_serial2, &_serialEvent2_default, | |||||
&serialEvent2, &_serialEvent2_default, | |||||
CCM_CCGR1, CCM_CCGR1_LPUART4(CCM_CCGR_ON), | CCM_CCGR1, CCM_CCGR1_LPUART4(CCM_CCGR_ON), | ||||
#if defined(__IMXRT1052__) | #if defined(__IMXRT1052__) | ||||
{{6,2, &IOMUXC_LPUART4_RX_SELECT_INPUT, 2}, {0xff, 0xff, nullptr, 0}}, | {{6,2, &IOMUXC_LPUART4_RX_SELECT_INPUT, 2}, {0xff, 0xff, nullptr, 0}}, | ||||
}; | }; | ||||
HardwareSerial Serial2(&IMXRT_LPUART4, &UART4_Hardware, tx_buffer2, SERIAL2_TX_BUFFER_SIZE, | HardwareSerial Serial2(&IMXRT_LPUART4, &UART4_Hardware, tx_buffer2, SERIAL2_TX_BUFFER_SIZE, | ||||
rx_buffer2, SERIAL2_RX_BUFFER_SIZE); | rx_buffer2, SERIAL2_RX_BUFFER_SIZE); | ||||
void serialEvent2() __attribute__((weak)); | |||||
void serialEvent2() {Serial2.disableSerialEvents(); } // No use calling this so disable if called... |
Serial3.IRQHandler(); | Serial3.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial3() | |||||
{ | |||||
if (Serial3.available()) serialEvent3(); | |||||
} | |||||
// Serial3 | // Serial3 | ||||
static BUFTYPE tx_buffer3[SERIAL3_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer3[SERIAL3_TX_BUFFER_SIZE]; | ||||
static BUFTYPE rx_buffer3[SERIAL3_RX_BUFFER_SIZE]; | static BUFTYPE rx_buffer3[SERIAL3_RX_BUFFER_SIZE]; | ||||
static HardwareSerial::hardware_t UART2_Hardware = { | static HardwareSerial::hardware_t UART2_Hardware = { | ||||
2, IRQ_LPUART2, &IRQHandler_Serial3, | 2, IRQ_LPUART2, &IRQHandler_Serial3, | ||||
&serial_event_check_serial3, &_serialEvent3_default, | |||||
&serialEvent3, &_serialEvent3_default, | |||||
CCM_CCGR0, CCM_CCGR0_LPUART2(CCM_CCGR_ON), | CCM_CCGR0, CCM_CCGR0_LPUART2(CCM_CCGR_ON), | ||||
{{15,2, &IOMUXC_LPUART2_RX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | {{15,2, &IOMUXC_LPUART2_RX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | ||||
{{14,2, &IOMUXC_LPUART2_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | {{14,2, &IOMUXC_LPUART2_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | ||||
HardwareSerial Serial3(&IMXRT_LPUART2, &UART2_Hardware,tx_buffer3, SERIAL3_TX_BUFFER_SIZE, | HardwareSerial Serial3(&IMXRT_LPUART2, &UART2_Hardware,tx_buffer3, SERIAL3_TX_BUFFER_SIZE, | ||||
rx_buffer3, SERIAL3_RX_BUFFER_SIZE); | rx_buffer3, SERIAL3_RX_BUFFER_SIZE); | ||||
void serialEvent3() __attribute__((weak)); | |||||
void serialEvent3() {Serial3.disableSerialEvents(); } // No use calling this so disable if called... | |||||
Serial4.IRQHandler(); | Serial4.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial4() | |||||
{ | |||||
if (Serial4.available()) serialEvent4(); | |||||
} | |||||
// Serial4 | // Serial4 | ||||
static BUFTYPE tx_buffer4[SERIAL4_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer4[SERIAL4_TX_BUFFER_SIZE]; | ||||
static BUFTYPE rx_buffer4[SERIAL4_RX_BUFFER_SIZE]; | static BUFTYPE rx_buffer4[SERIAL4_RX_BUFFER_SIZE]; | ||||
static HardwareSerial::hardware_t UART3_Hardware = { | static HardwareSerial::hardware_t UART3_Hardware = { | ||||
3, IRQ_LPUART3, &IRQHandler_Serial4, | 3, IRQ_LPUART3, &IRQHandler_Serial4, | ||||
&serial_event_check_serial4, &_serialEvent4_default, | |||||
&serialEvent4, &_serialEvent4_default, | |||||
CCM_CCGR0, CCM_CCGR0_LPUART3(CCM_CCGR_ON), | CCM_CCGR0, CCM_CCGR0_LPUART3(CCM_CCGR_ON), | ||||
{{16,2, &IOMUXC_LPUART3_RX_SELECT_INPUT, 0}, {0xff, 0xff, nullptr, 0}}, | {{16,2, &IOMUXC_LPUART3_RX_SELECT_INPUT, 0}, {0xff, 0xff, nullptr, 0}}, | ||||
{{17,2, &IOMUXC_LPUART3_TX_SELECT_INPUT, 0}, {0xff, 0xff, nullptr, 0}}, | {{17,2, &IOMUXC_LPUART3_TX_SELECT_INPUT, 0}, {0xff, 0xff, nullptr, 0}}, | ||||
}; | }; | ||||
HardwareSerial Serial4(&IMXRT_LPUART3, &UART3_Hardware, tx_buffer4, SERIAL4_TX_BUFFER_SIZE, | HardwareSerial Serial4(&IMXRT_LPUART3, &UART3_Hardware, tx_buffer4, SERIAL4_TX_BUFFER_SIZE, | ||||
rx_buffer4, SERIAL4_RX_BUFFER_SIZE); | rx_buffer4, SERIAL4_RX_BUFFER_SIZE); | ||||
void serialEvent4() __attribute__((weak)); | |||||
void serialEvent4() {Serial4.disableSerialEvents(); } // No use calling this so disable if called... |
{ | { | ||||
Serial5.IRQHandler(); | Serial5.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial5() | |||||
{ | |||||
if (Serial5.available()) serialEvent5(); | |||||
} | |||||
// Serial5 | // Serial5 | ||||
static BUFTYPE tx_buffer5[SERIAL5_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer5[SERIAL5_TX_BUFFER_SIZE]; | ||||
static BUFTYPE rx_buffer5[SERIAL5_RX_BUFFER_SIZE]; | static BUFTYPE rx_buffer5[SERIAL5_RX_BUFFER_SIZE]; | ||||
static HardwareSerial::hardware_t UART8_Hardware = { | static HardwareSerial::hardware_t UART8_Hardware = { | ||||
4, IRQ_LPUART8, &IRQHandler_Serial5, | 4, IRQ_LPUART8, &IRQHandler_Serial5, | ||||
&serial_event_check_serial5, &_serialEvent5_default, | |||||
&serialEvent5, &_serialEvent5_default, | |||||
CCM_CCGR6, CCM_CCGR6_LPUART8(CCM_CCGR_ON), | CCM_CCGR6, CCM_CCGR6_LPUART8(CCM_CCGR_ON), | ||||
#if defined(ARDUINO_TEENSY41) | #if defined(ARDUINO_TEENSY41) | ||||
{{21,2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 1}, {46, 2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 0}}, | {{21,2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 1}, {46, 2, &IOMUXC_LPUART8_RX_SELECT_INPUT, 0}}, | ||||
}; | }; | ||||
HardwareSerial Serial5(&IMXRT_LPUART8, &UART8_Hardware, tx_buffer5, SERIAL5_TX_BUFFER_SIZE, | HardwareSerial Serial5(&IMXRT_LPUART8, &UART8_Hardware, tx_buffer5, SERIAL5_TX_BUFFER_SIZE, | ||||
rx_buffer5, SERIAL5_RX_BUFFER_SIZE); | rx_buffer5, SERIAL5_RX_BUFFER_SIZE); | ||||
void serialEvent5() __attribute__((weak)); | |||||
void serialEvent5() {Serial5.disableSerialEvents(); } // No use calling this so disable if called... |
Serial6.IRQHandler(); | Serial6.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial6() | |||||
{ | |||||
if (Serial6.available()) serialEvent6(); | |||||
} | |||||
// Serial6 | // Serial6 | ||||
static BUFTYPE tx_buffer6[SERIAL6_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer6[SERIAL6_TX_BUFFER_SIZE]; | ||||
static HardwareSerial::hardware_t UART1_Hardware = { | static HardwareSerial::hardware_t UART1_Hardware = { | ||||
5, IRQ_LPUART1, &IRQHandler_Serial6, | 5, IRQ_LPUART1, &IRQHandler_Serial6, | ||||
&serial_event_check_serial6, &_serialEvent6_default, | |||||
&serialEvent6, &_serialEvent6_default, | |||||
CCM_CCGR5, CCM_CCGR5_LPUART1(CCM_CCGR_ON), | CCM_CCGR5, CCM_CCGR5_LPUART1(CCM_CCGR_ON), | ||||
{{25,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}}, | {{25,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}}, | ||||
{{24,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}}, | {{24,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}}, | ||||
HardwareSerial Serial6(&IMXRT_LPUART1, &UART1_Hardware, tx_buffer6, SERIAL6_TX_BUFFER_SIZE, | HardwareSerial Serial6(&IMXRT_LPUART1, &UART1_Hardware, tx_buffer6, SERIAL6_TX_BUFFER_SIZE, | ||||
rx_buffer6, SERIAL6_RX_BUFFER_SIZE); | rx_buffer6, SERIAL6_RX_BUFFER_SIZE); | ||||
void serialEvent6() __attribute__((weak)); | |||||
void serialEvent6() {Serial6.disableSerialEvents(); } // No use calling this so disable if called... |
Serial7.IRQHandler(); | Serial7.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial7() | |||||
{ | |||||
if (Serial7.available()) serialEvent7(); | |||||
} | |||||
// Serial7 | // Serial7 | ||||
static BUFTYPE tx_buffer7[SERIAL7_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer7[SERIAL7_TX_BUFFER_SIZE]; | ||||
static BUFTYPE rx_buffer7[SERIAL7_RX_BUFFER_SIZE]; | static BUFTYPE rx_buffer7[SERIAL7_RX_BUFFER_SIZE]; | ||||
static HardwareSerial::hardware_t UART7_Hardware = { | static HardwareSerial::hardware_t UART7_Hardware = { | ||||
6, IRQ_LPUART7, &IRQHandler_Serial7, | 6, IRQ_LPUART7, &IRQHandler_Serial7, | ||||
&serial_event_check_serial7, &_serialEvent7_default, | |||||
&serialEvent7, &_serialEvent7_default, | |||||
CCM_CCGR5, CCM_CCGR5_LPUART7(CCM_CCGR_ON), | CCM_CCGR5, CCM_CCGR5_LPUART7(CCM_CCGR_ON), | ||||
{{28,2, &IOMUXC_LPUART7_RX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | {{28,2, &IOMUXC_LPUART7_RX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | ||||
{{29,2, &IOMUXC_LPUART7_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | {{29,2, &IOMUXC_LPUART7_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | ||||
}; | }; | ||||
HardwareSerial Serial7(&IMXRT_LPUART7, &UART7_Hardware, tx_buffer7, SERIAL7_TX_BUFFER_SIZE, | HardwareSerial Serial7(&IMXRT_LPUART7, &UART7_Hardware, tx_buffer7, SERIAL7_TX_BUFFER_SIZE, | ||||
rx_buffer7, SERIAL7_RX_BUFFER_SIZE); | rx_buffer7, SERIAL7_RX_BUFFER_SIZE); | ||||
void serialEvent7() __attribute__((weak)); | |||||
void serialEvent7() {Serial7.disableSerialEvents(); } // No use calling this so disable if called... |
Serial8.IRQHandler(); | Serial8.IRQHandler(); | ||||
} | } | ||||
void serial_event_check_serial8() | |||||
{ | |||||
if (Serial8.available()) serialEvent8(); | |||||
} | |||||
// Serial8 | // Serial8 | ||||
static BUFTYPE tx_buffer8[SERIAL8_TX_BUFFER_SIZE]; | static BUFTYPE tx_buffer8[SERIAL8_TX_BUFFER_SIZE]; | ||||
static HardwareSerial::hardware_t UART5_Hardware = { | static HardwareSerial::hardware_t UART5_Hardware = { | ||||
7, IRQ_LPUART5, &IRQHandler_Serial8, | 7, IRQ_LPUART5, &IRQHandler_Serial8, | ||||
&serial_event_check_serial8, &_serialEvent8_default, | |||||
&serialEvent8, &_serialEvent8_default, | |||||
CCM_CCGR3, CCM_CCGR3_LPUART5(CCM_CCGR_ON), | CCM_CCGR3, CCM_CCGR3_LPUART5(CCM_CCGR_ON), | ||||
{{34,1, &IOMUXC_LPUART5_RX_SELECT_INPUT, 1}, {48, 2, &IOMUXC_LPUART5_RX_SELECT_INPUT, 0}}, | {{34,1, &IOMUXC_LPUART5_RX_SELECT_INPUT, 1}, {48, 2, &IOMUXC_LPUART5_RX_SELECT_INPUT, 0}}, | ||||
{{35,1, &IOMUXC_LPUART5_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | {{35,1, &IOMUXC_LPUART5_TX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}}, | ||||
}; | }; | ||||
HardwareSerial Serial8(&IMXRT_LPUART5, &UART5_Hardware, tx_buffer8, SERIAL8_TX_BUFFER_SIZE, | HardwareSerial Serial8(&IMXRT_LPUART5, &UART5_Hardware, tx_buffer8, SERIAL8_TX_BUFFER_SIZE, | ||||
rx_buffer8, SERIAL8_RX_BUFFER_SIZE); | rx_buffer8, SERIAL8_RX_BUFFER_SIZE); | ||||
void serialEvent8() __attribute__((weak)); | |||||
void serialEvent8() {Serial8.disableSerialEvents(); } // No use calling this so disable if called... | |||||
#endif | #endif |
} | } | ||||
// Current workaround until integrate with EventResponder. | // Current workaround until integrate with EventResponder. | ||||
if (yield_active_check_flags & YIELD_CHECK_HARDWARE_SERIAL) HardwareSerial::processSerialEvents(); | |||||
if (yield_active_check_flags & YIELD_CHECK_HARDWARE_SERIAL) HardwareSerial::processSerialEventsList(); | |||||
running = 0; | running = 0; | ||||
if (yield_active_check_flags & YIELD_CHECK_EVENT_RESPONDER) EventResponder::runFromYield(); | if (yield_active_check_flags & YIELD_CHECK_EVENT_RESPONDER) EventResponder::runFromYield(); |