Put in first pass at SerialX.end(), Which should disable the Serial object, and I believe set the IO pins to be GPIO pins. Also defined the extern void SerialEvent1() like functions in header in preperation for callbacks...teensy4-core
@@ -198,6 +198,20 @@ inline void HardwareSerial::rts_deassert() | |||
void HardwareSerial::end(void) | |||
{ | |||
if (!(hardware->ccm_register & hardware->ccm_value)) return; | |||
while (transmitting_) yield(); // wait for buffered data to send | |||
port->CTRL = 0; // disable the TX and RX ... | |||
// Not sure if this is best, but I think most IO pins default to Mode 5? which appears to be digital IO? | |||
*(portConfigRegister(hardware->rx_pin)) = 5; | |||
*(portConfigRegister(hardware->tx_pin)) = 5; | |||
// Might need to clear out other areas as well? | |||
rx_buffer_head_ = 0; | |||
rx_buffer_tail_ = 0; | |||
if (rts_pin_baseReg_) rts_deassert(); | |||
// | |||
} | |||
@@ -231,7 +231,14 @@ extern HardwareSerial Serial5; | |||
extern HardwareSerial Serial6; | |||
extern HardwareSerial Serial7; | |||
extern HardwareSerial Serial8; | |||
//extern void serialEvent1(void); | |||
extern void serialEvent1(void); | |||
extern void serialEvent2(void); | |||
extern void serialEvent3(void); | |||
extern void serialEvent4(void); | |||
extern void serialEvent5(void); | |||
extern void serialEvent6(void); | |||
extern void serialEvent7(void); | |||
extern void serialEvent8(void); | |||
#endif // __cplusplus |