mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #234 from fdlamotte/Arduino_serial_using_stream
use Stream abstract interface for serial port in ArduinoSerialInterface
This commit is contained in:
commit
d63775b878
1 changed files with 4 additions and 16 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue