@@ -98,6 +98,7 @@ class Serial_ : public Stream
9898 virtual int available (void );
9999 virtual int peek (void );
100100 virtual int read (void );
101+ int availableForWrite (void );
101102 virtual void flush (void );
102103 virtual size_t write (uint8_t );
103104 virtual size_t write (const uint8_t *, size_t );
@@ -107,6 +108,46 @@ class Serial_ : public Stream
107108 volatile uint8_t _rx_buffer_head;
108109 volatile uint8_t _rx_buffer_tail;
109110 unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
111+
112+ // This method allows processing "SEND_BREAK" requests sent by
113+ // the USB host. Those requests indicate that the host wants to
114+ // send a BREAK signal and are accompanied by a single uint16_t
115+ // value, specifying the duration of the break. The value 0
116+ // means to end any current break, while the value 0xffff means
117+ // to start an indefinite break.
118+ // readBreak() will return the value of the most recent break
119+ // request, but will return it at most once, returning -1 when
120+ // readBreak() is called again (until another break request is
121+ // received, which is again returned once).
122+ // This also mean that if two break requests are received
123+ // without readBreak() being called in between, the value of the
124+ // first request is lost.
125+ // Note that the value returned is a long, so it can return
126+ // 0-0xffff as well as -1.
127+ int32_t readBreak ();
128+
129+ // These return the settings specified by the USB host for the
130+ // serial port. These aren't really used, but are offered here
131+ // in case a sketch wants to act on these settings.
132+ uint32_t baud ();
133+ uint8_t stopbits ();
134+ uint8_t paritytype ();
135+ uint8_t numbits ();
136+ bool dtr ();
137+ bool rts ();
138+ enum {
139+ ONE_STOP_BIT = 0 ,
140+ ONE_AND_HALF_STOP_BIT = 1 ,
141+ TWO_STOP_BITS = 2 ,
142+ };
143+ enum {
144+ NO_PARITY = 0 ,
145+ ODD_PARITY = 1 ,
146+ EVEN_PARITY = 2 ,
147+ MARK_PARITY = 3 ,
148+ SPACE_PARITY = 4 ,
149+ };
150+
110151};
111152extern Serial_ Serial;
112153
@@ -154,6 +195,7 @@ int USB_SendControl(uint8_t flags, const void* d, int len);
154195int USB_RecvControl (void * d, int len);
155196
156197uint8_t USB_Available (uint8_t ep);
198+ uint8_t USB_SendSpace (uint8_t ep);
157199int USB_Send (uint8_t ep, const void * data, int len); // blocking
158200int USB_Recv (uint8_t ep, void * data, int len); // non-blocking
159201int USB_Recv (uint8_t ep); // non-blocking
0 commit comments