Browse Source

Add Print::availableForWrite

teensy4-core
PaulStoffregen 7 years ago
parent
commit
3580ee2bd0
3 changed files with 3 additions and 2 deletions
  1. +1
    -0
      teensy3/Print.h
  2. +1
    -1
      teensy3/usb_seremu.h
  3. +1
    -1
      teensy3/usb_serial.h

+ 1
- 0
teensy3/Print.h View File

@@ -53,6 +53,7 @@ class Print
virtual size_t write(uint8_t b) = 0;
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
virtual size_t write(const uint8_t *buffer, size_t size);
virtual int availableForWrite(void) { return 0; }
virtual void flush() { }
size_t write(const char *buffer, size_t size) { return write((const uint8_t *)buffer, size); }
size_t print(const String &s);

+ 1
- 1
teensy3/usb_seremu.h View File

@@ -76,7 +76,7 @@ public:
size_t write(long n) { return write((uint8_t)n); }
size_t write(unsigned int n) { return write((uint8_t)n); }
size_t write(int n) { return write((uint8_t)n); }
int availableForWrite() { return usb_seremu_write_buffer_free(); }
virtual int availableForWrite() { return usb_seremu_write_buffer_free(); }
using Print::write;
void send_now(void) { usb_seremu_flush_output(); };
uint32_t baud(void) { return 9600; }

+ 1
- 1
teensy3/usb_serial.h View File

@@ -90,7 +90,7 @@ public:
size_t write(long n) { return write((uint8_t)n); }
size_t write(unsigned int n) { return write((uint8_t)n); }
size_t write(int n) { return write((uint8_t)n); }
int availableForWrite() { return usb_serial_write_buffer_free(); }
virtual int availableForWrite() { return usb_serial_write_buffer_free(); }
using Print::write;
void send_now(void) { usb_serial_flush_output(); }
uint32_t baud(void) { return usb_cdc_line_coding[0]; }

Loading…
Cancel
Save