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
4 changes: 4 additions & 0 deletions src/SerialFake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ bool Serial_::rts()
return ArduinoFakeInstance(Serial, this)->rts();
}

void Serial_::setDebugOutput(bool _value){
return ArduinoFakeInstance(Serial, this) -> setDebugOutput(_value);
}

int32_t Serial_::readBreak()
{
return ArduinoFakeInstance(Serial, this)->readBreak();
Expand Down
2 changes: 2 additions & 0 deletions src/SerialFake.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct SerialFake : public StreamFake
virtual uint8_t numbits() = 0;
virtual bool dtr() = 0;
virtual bool rts() = 0;

virtual void setDebugOutput(bool);
};

class SerialFakeProxy : public StreamFakeProxy, public Serial_
Expand Down
7 changes: 7 additions & 0 deletions src/arduino/IPAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,10 @@ size_t IPAddress::printTo(Print& p) const
return n;
}

String IPAddress::toString() const
{
char szRet[16];
sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]);
return String(szRet);
}

1 change: 1 addition & 0 deletions src/arduino/IPAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class IPAddress : public Printable {
IPAddress& operator=(uint32_t address);

virtual size_t printTo(Print& p) const;
String toString() const;

friend class EthernetClass;
friend class UDP;
Expand Down
2 changes: 2 additions & 0 deletions src/arduino/USBAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class Serial_ : public Stream
volatile uint8_t _rx_buffer_tail;
unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];

virtual void setDebugOutput(bool);

// This method allows processing "SEND_BREAK" requests sent by
// the USB host. Those requests indicate that the host wants to
// send a BREAK signal and are accompanied by a single uint16_t
Expand Down
3 changes: 3 additions & 0 deletions test/test_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace SerialTest

Serial.flush();
Serial.end();
Serial.setDebugOutput(true);

Verify(OverloadedMethod(ArduinoFake(Serial), begin, void(unsigned long)).Using(9600)).Once();
Verify(Method(ArduinoFake(Serial), available)).Exactly(2_Times);
Expand All @@ -73,6 +74,8 @@ namespace SerialTest

Verify(Method(ArduinoFake(Serial), flush)).Once();
Verify(Method(ArduinoFake(Serial), end)).Once();

Verify(Method(ArduinoFake(Serial), setDebugOutput)).Once();
}

void run_tests()
Expand Down
Loading