ソースを参照

T4 SerialX - SerialX.end() and define Event callbacks

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...
main
Kurt Eckhardt 6年前
コミット
4a8bf778e0
2個のファイルの変更22行の追加1行の削除
  1. +14
    -0
      teensy4/HardwareSerial.cpp
  2. +8
    -1
      teensy4/HardwareSerial.h

+ 14
- 0
teensy4/HardwareSerial.cpp ファイルの表示

@@ -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();
//

}


+ 8
- 1
teensy4/HardwareSerial.h ファイルの表示

@@ -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

読み込み中…
キャンセル
保存