diff options
| author | David Madison <dmadison@users.noreply.github.com> | 2019-02-15 14:27:49 -0500 | 
|---|---|---|
| committer | David Madison <dmadison@users.noreply.github.com> | 2019-02-15 14:28:30 -0500 | 
| commit | 2307486942f246aca947d770849b5d05822d7d17 (patch) | |
| tree | 051494fa25c7614a79ed75b504fabf60fdf9249e /cores/arduino/USBAPI.h | |
| parent | fbad822c99b957b513b018cb135b41051f93cc11 (diff) | |
Replace Serial with null
Allows sketches using Serial to compile but discards all data
Diffstat (limited to 'cores/arduino/USBAPI.h')
| -rw-r--r-- | cores/arduino/USBAPI.h | 46 | 
1 files changed, 20 insertions, 26 deletions
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 479ced9..06dd737 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -87,27 +87,21 @@ struct ring_buffer;  class Serial_ : public Stream  { -private: -	int peek_buffer;  public: -	Serial_() { peek_buffer = -1; }; -	void begin(unsigned long); -	void begin(unsigned long, uint8_t); -	void end(void); - -	virtual int available(void); -	virtual int peek(void); -	virtual int read(void); -	virtual int availableForWrite(void); -	virtual void flush(void); -	virtual size_t write(uint8_t); -	virtual size_t write(const uint8_t*, size_t); +	Serial_() {}; +	void begin(unsigned long) {} +	void begin(unsigned long, uint8_t) {} +	void end(void) {} + +	virtual int available(void) { return -1; } +	virtual int peek(void) { return -1; } +	virtual int read(void) { return -1; } +	virtual int availableForWrite(void) { return 0; } +	virtual void flush(void) {} +	virtual size_t write(uint8_t) { return 1; } +	virtual size_t write(const uint8_t*, size_t n) { return n; }  	using Print::write; // pull in write(str) and write(buf, size) from Print -	operator bool(); - -	volatile uint8_t _rx_buffer_head; -	volatile uint8_t _rx_buffer_tail; -	unsigned char _rx_buffer[SERIAL_BUFFER_SIZE]; +	operator bool() { return true; }  	// This method allows processing "SEND_BREAK" requests sent by  	// the USB host. Those requests indicate that the host wants to @@ -124,17 +118,17 @@ public:  	// first request is lost.  	// Note that the value returned is a long, so it can return  	// 0-0xffff as well as -1. -	int32_t readBreak(); +	int32_t readBreak() { return -1; };  	// These return the settings specified by the USB host for the  	// serial port. These aren't really used, but are offered here  	// in case a sketch wants to act on these settings. -	uint32_t baud(); -	uint8_t stopbits(); -	uint8_t paritytype(); -	uint8_t numbits(); -	bool dtr(); -	bool rts(); +	uint32_t baud() { return 0; } +	uint8_t stopbits() { return 1; } +	uint8_t paritytype() { return 0; } +	uint8_t numbits() { return 8; } +	bool dtr() { return true; } +	bool rts() { return true; }  	enum {  		ONE_STOP_BIT = 0,  		ONE_AND_HALF_STOP_BIT = 1,  | 
