|
|
|
|
|
|
|
|
class usb_serial_class : public Stream |
|
|
class usb_serial_class : public Stream |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
void begin(long) { /* TODO: call a function that tries to wait for enumeration */ }; |
|
|
|
|
|
|
|
|
void begin(long) { |
|
|
|
|
|
uint32_t millis_begin = systick_millis_count; |
|
|
|
|
|
while (!(*this)) { |
|
|
|
|
|
// wait up to 1 second for Arduino Serial Monitor |
|
|
|
|
|
if ((uint32_t)(systick_millis_count - millis_begin) > 1000) break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
void end() { /* TODO: flush output and shut down USB port */ }; |
|
|
void end() { /* TODO: flush output and shut down USB port */ }; |
|
|
virtual int available() { return usb_serial_available(); } |
|
|
virtual int available() { return usb_serial_available(); } |
|
|
virtual int read() { return usb_serial_getchar(); } |
|
|
virtual int read() { return usb_serial_getchar(); } |