Skip to content

Commit 0be991b

Browse files
authored
Update usb_serial.h
1 parent cbfb872 commit 0be991b

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

STM32F1/cores/maple/usb_serial.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class USBSerial : public Stream {
4949
void begin(unsigned long, uint8_t);
5050
void end(void);
5151

52-
operator bool() { return true; } // Roger Clark. This is needed because in cardinfo.ino it does if (!Serial) . It seems to be a work around for the Leonardo that we needed to implement just to be compliant with the API
53-
5452
virtual int available(void);// Changed to virtual
5553

5654
uint32 read(uint8 * buf, uint32 len);
@@ -69,8 +67,20 @@ class USBSerial : public Stream {
6967

7068
uint8 getRTS();
7169
uint8 getDTR();
72-
uint8 isConnected();
7370
uint8 pending();
71+
72+
/* SukkoPera: This is the Arduino way to check if an USB CDC serial
73+
* connection is open.
74+
75+
* Used for instance in cardinfo.ino.
76+
*/
77+
operator bool();
78+
79+
/* Old libmaple way to check for serial connection.
80+
*
81+
* Deprecated, use the above.
82+
*/
83+
uint8 isConnected() { return (bool) *this; }
7484
};
7585

7686
#ifdef SERIAL_USB

0 commit comments

Comments
 (0)