|
-
-
- #include <Arduino.h>
- #include "HardwareSerial.h"
-
- #ifndef SERIAL4_TX_BUFFER_SIZE
- #define SERIAL4_TX_BUFFER_SIZE 40
- #endif
- #ifndef SERIAL4_RX_BUFFER_SIZE
- #define SERIAL4_RX_BUFFER_SIZE 64
- #endif
- #define IRQ_PRIORITY 64
-
-
- void IRQHandler_Serial4()
- {
- Serial4.IRQHandler();
- }
-
- void serial_event_check_serial4()
- {
- if (Serial4.available()) serialEvent4();
- }
-
-
- static BUFTYPE tx_buffer4[SERIAL4_TX_BUFFER_SIZE];
- static BUFTYPE rx_buffer4[SERIAL4_RX_BUFFER_SIZE];
-
- static HardwareSerial::hardware_t UART3_Hardware = {
- 3, IRQ_LPUART3, &IRQHandler_Serial4, &serial_event_check_serial4,
- CCM_CCGR0, CCM_CCGR0_LPUART3(CCM_CCGR_ON),
- {{16,2, &IOMUXC_LPUART3_RX_SELECT_INPUT, 0}, {0xff, 0xff, nullptr, 0}},
- {{17,2, nullptr, 0}, {0xff, 0xff, nullptr, 0}},
- 0xff,
- 0,
- IRQ_PRIORITY, 38, 24,
- };
- HardwareSerial Serial4(&IMXRT_LPUART3, &UART3_Hardware, tx_buffer4, SERIAL4_TX_BUFFER_SIZE,
- rx_buffer4, SERIAL4_RX_BUFFER_SIZE);
-
-
- void serialEvent4() __attribute__((weak));
- void serialEvent4() {Serial4.disableSerialEvents(); }
|