|
-
-
- #include <Arduino.h>
- #include "HardwareSerial.h"
-
- #ifndef SERIAL1_TX_BUFFER_SIZE
- #define SERIAL1_TX_BUFFER_SIZE 64
- #endif
- #ifndef SERIAL1_RX_BUFFER_SIZE
- #define SERIAL1_RX_BUFFER_SIZE 64
- #endif
- #define IRQ_PRIORITY 64
-
- void IRQHandler_Serial1()
- {
- Serial1.IRQHandler();
- }
-
- void serial_event_check_serial1()
- {
- if (Serial1.available()) serialEvent1();
- }
-
-
- static BUFTYPE tx_buffer1[SERIAL1_TX_BUFFER_SIZE];
- static BUFTYPE rx_buffer1[SERIAL1_RX_BUFFER_SIZE];
-
- const HardwareSerial::hardware_t UART6_Hardware = {
- 0, IRQ_LPUART6, &IRQHandler_Serial1, &serial_event_check_serial1,
- CCM_CCGR3, CCM_CCGR3_LPUART6(CCM_CCGR_ON),
- 0,
- 1,
- 0xff,
- IOMUXC_LPUART6_RX_SELECT_INPUT,
- 2,
- 2,
- 0,
- 1,
- IRQ_PRIORITY, 38, 24,
- };
- HardwareSerial Serial1(&IMXRT_LPUART6, &UART6_Hardware, tx_buffer1, SERIAL1_TX_BUFFER_SIZE,
- rx_buffer1, SERIAL1_RX_BUFFER_SIZE);
-
- void serialEvent1() __attribute__((weak));
- void serialEvent1() {Serial1.disableSerialEvents(); }
|