Merge pull request #234 from fdlamotte/Arduino_serial_using_stream

use Stream abstract interface for serial port in ArduinoSerialInterface
This commit is contained in:
ripplebiz 2025-04-30 22:14:55 +10:00 committed by GitHub
commit d63775b878
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,30 +8,18 @@ class ArduinoSerialInterface : public BaseSerialInterface {
uint8_t _state;
uint16_t _frame_len;
uint16_t rx_len;
#ifdef LILYGO_T3S3
HWCDC* _serial;
#elif defined(NRF52_PLATFORM)
Adafruit_USBD_CDC* _serial;
#else
HardwareSerial* _serial;
#endif
Stream* _serial;
uint8_t rx_buf[MAX_FRAME_SIZE];
public:
ArduinoSerialInterface() { _isEnabled = false; _state = 0; }
#ifdef LILYGO_T3S3
void begin(HWCDC& serial) { _serial = &serial; }
#elif defined(NRF52_PLATFORM)
void begin(Adafruit_USBD_CDC& serial) {
_serial = &serial;
void begin(Stream& serial) {
_serial = &serial;
#ifdef RAK_4631
pinMode(WB_IO2, OUTPUT);
#endif
#endif
}
#else
void begin(HardwareSerial& serial) { _serial = &serial; }
#endif
// BaseSerialInterface methods
void enable() override;