@@ -223,6 +223,24 @@ int usb_seremu_write(const void *buffer, uint32_t size) | |||
#endif | |||
} | |||
int usb_seremu_room(void) | |||
{ | |||
uint32_t len; | |||
tx_noautoflush = 1; | |||
if (!tx_packet) { | |||
if (!usb_configuration || | |||
usb_tx_packet_count(SEREMU_TX_ENDPOINT) >= TX_PACKET_LIMIT || | |||
(tx_packet = usb_malloc()) == NULL) { | |||
tx_noautoflush = 0; | |||
return 0; | |||
} | |||
} | |||
len = SEREMU_TX_SIZE - tx_packet->index; | |||
tx_noautoflush = 0; | |||
return len; | |||
} | |||
void usb_seremu_flush_output(void) | |||
{ | |||
int i; |
@@ -47,6 +47,7 @@ int usb_seremu_available(void); | |||
void usb_seremu_flush_input(void); | |||
int usb_seremu_putchar(uint8_t c); | |||
int usb_seremu_write(const void *buffer, uint32_t size); | |||
int usb_seremu_room(void); | |||
void usb_seremu_flush_output(void); | |||
void usb_seremu_flush_callback(void); | |||
extern volatile uint8_t usb_seremu_transmit_flush_timer; | |||
@@ -73,6 +74,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 room() { return usb_seremu_room(); } | |||
using Print::write; | |||
void send_now(void) { usb_seremu_flush_output(); }; | |||
uint32_t baud(void) { return 9600; } | |||
@@ -109,6 +111,7 @@ public: | |||
size_t write(long n) { return 1; } | |||
size_t write(unsigned int n) { return 1; } | |||
size_t write(int n) { return 1; } | |||
int room() { return 0; } | |||
using Print::write; | |||
void send_now(void) { } | |||
uint32_t baud(void) { return 0; } |
@@ -224,6 +224,24 @@ int usb_serial_write(const void *buffer, uint32_t size) | |||
return 0; | |||
} | |||
int usb_serial_room(void) | |||
{ | |||
uint32_t len; | |||
tx_noautoflush = 1; | |||
if (!tx_packet) { | |||
if (!usb_configuration || | |||
usb_tx_packet_count(CDC_TX_ENDPOINT) >= TX_PACKET_LIMIT || | |||
(tx_packet = usb_malloc()) == NULL) { | |||
tx_noautoflush = 0; | |||
return 0; | |||
} | |||
} | |||
len = CDC_TX_SIZE - tx_packet->index; | |||
tx_noautoflush = 0; | |||
return len; | |||
} | |||
void usb_serial_flush_output(void) | |||
{ | |||
if (!usb_configuration) return; |
@@ -48,6 +48,7 @@ int usb_serial_read(void *buffer, uint32_t size); | |||
void usb_serial_flush_input(void); | |||
int usb_serial_putchar(uint8_t c); | |||
int usb_serial_write(const void *buffer, uint32_t size); | |||
int usb_serial_room(void); | |||
void usb_serial_flush_output(void); | |||
extern uint32_t usb_cdc_line_coding[2]; | |||
extern volatile uint8_t usb_cdc_line_rtsdtr; | |||
@@ -78,6 +79,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 room() { return usb_serial_room(); } | |||
using Print::write; | |||
void send_now(void) { usb_serial_flush_output(); } | |||
uint32_t baud(void) { return usb_cdc_line_coding[0]; } | |||
@@ -124,6 +126,7 @@ public: | |||
size_t write(long n) { return 1; } | |||
size_t write(unsigned int n) { return 1; } | |||
size_t write(int n) { return 1; } | |||
int room() { return 0; } | |||
using Print::write; | |||
void send_now(void) { } | |||
uint32_t baud(void) { return 0; } |