Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions TelnetSpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,12 @@ uint16_t TelnetSpy::getRecBufferSize() {
return recLen;
}


#if ARDUINO_USB_CDC_ON_BOOT
void TelnetSpy::setSerial(USBCDC* usedSerial) {
#else
void TelnetSpy::setSerial(HardwareSerial* usedSerial) {
#endif
usedSer = usedSerial;
}

Expand Down Expand Up @@ -432,7 +437,11 @@ void TelnetSpy::begin(unsigned long baud, SerialConfig config, SerialMode mode,

void TelnetSpy::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) {
if (usedSer) {
#if ARDUINO_USB_CDC_ON_BOOT
usedSer->begin(baud);
#else
usedSer->begin(baud, config, rxPin, txPin, invert);
#endif
}
setDebugOutput(debugOutput);
started = true;
Expand Down
8 changes: 8 additions & 0 deletions TelnetSpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ class TelnetSpy : public Stream {
void setPingTime(uint16_t pngTime);
bool setRecBufferSize(uint16_t newSize);
uint16_t getRecBufferSize();
#if ARDUINO_USB_CDC_ON_BOOT
void setSerial(USBCDC* usedSerial);
#else
void setSerial(HardwareSerial* usedSerial);
#endif
bool isClientConnected();
void setCallbackOnConnect(void (*callback)());
void setCallbackOnDisconnect(void (*callback)());
Expand Down Expand Up @@ -356,7 +360,11 @@ class TelnetSpy : public Stream {
WiFiServer* telnetServer;
WiFiClient client;
uint16_t port;
#if ARDUINO_USB_CDC_ON_BOOT
USBCDC* usedSer;
#else
HardwareSerial* usedSer;
#endif
bool storeOffline;
bool started;
bool listening;
Expand Down