|
-
-
- #include <Arduino.h>
- #include "HardwareSerial.h"
-
- #ifndef SERIAL3_TX_BUFFER_SIZE
- #define SERIAL3_TX_BUFFER_SIZE 40
- #endif
- #ifndef SERIAL3_RX_BUFFER_SIZE
- #define SERIAL3_RX_BUFFER_SIZE 64
- #endif
- #define IRQ_PRIORITY 64
-
- void IRQHandler_Serial3()
- {
- Serial3.IRQHandler();
- }
-
- void serial_event_check_serial3()
- {
- if (Serial3.available()) serialEvent3();
- }
-
-
- static BUFTYPE tx_buffer3[SERIAL3_TX_BUFFER_SIZE];
- static BUFTYPE rx_buffer3[SERIAL3_RX_BUFFER_SIZE];
-
- static HardwareSerial::hardware_t UART2_Hardware = {
- 2, IRQ_LPUART2, &IRQHandler_Serial3, &serial_event_check_serial3,
- CCM_CCGR0, CCM_CCGR0_LPUART2(CCM_CCGR_ON),
- {{15,2, &IOMUXC_LPUART2_RX_SELECT_INPUT, 1}, {0xff, 0xff, nullptr, 0}},
- {{14,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}},
- 18,
- 2,
- IRQ_PRIORITY, 38, 24,
- };
- HardwareSerial Serial3(&IMXRT_LPUART2, &UART2_Hardware,tx_buffer3, SERIAL3_TX_BUFFER_SIZE,
- rx_buffer3, SERIAL3_RX_BUFFER_SIZE);
-
- void serialEvent3() __attribute__((weak));
- void serialEvent3() {Serial3.disableSerialEvents(); }
|