|
-
-
- #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,
- 14,
- 18,
- IOMUXC_LPUART2_RX_SELECT_INPUT,
- 2,
- 2,
- 2,
- 1,
- 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(); }
|