22 #include "USBDescriptor.h" 23 #include "USBDevice_Types.h" 25 #include "USBDevice.h" 26 #include "OperationList.h" 51 USBCDC(
bool connect_blocking =
true, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
69 USBCDC(
USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
100 bool send(uint8_t *buffer, uint32_t size);
110 void send_nb(uint8_t *buffer, uint32_t size, uint32_t *actual,
bool now =
true);
124 bool receive(uint8_t *buffer, uint32_t size, uint32_t *actual = NULL);
133 void receive_nb(uint8_t *buffer, uint32_t size, uint32_t *actual);
141 virtual const uint8_t *device_desc();
148 virtual const uint8_t *string_iproduct_desc();
155 virtual const uint8_t *string_iinterface_desc();
163 virtual const uint8_t *configuration_desc(uint8_t index);
174 virtual void line_coding_changed(
int baud,
int bits,
int parity,
int stop) {};
179 virtual void data_rx() {}
184 virtual void data_tx() {}
196 virtual void callback_set_configuration(uint8_t configuration);
197 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
201 void _change_terminal_connected(
bool connected);
203 void _send_isr_start();
206 void _receive_isr_start();
213 uint8_t _cdc_line_coding[7];
214 uint8_t _cdc_new_line_coding[7];
215 uint8_t _config_descriptor[75];
218 bool _terminal_connected;
221 bool _tx_in_progress;
222 uint8_t _tx_buffer[64];
227 bool _rx_in_progress;
228 uint8_t _rx_buffer[64];
virtual ~USBCDC()
Destroy this object.
void receive_nb(uint8_t *buffer, uint32_t size, uint32_t *actual)
Read from the receive buffer.
Abstract interface to physical USB hardware.
virtual void callback_request(const setup_packet_t *setup)
Called by USBDevice on Endpoint0 request.
bool ready()
Check if this class is ready.
virtual void callback_state_change(DeviceState new_state)
Called when USB changes state.
virtual void callback_reset()
Called by USBDevice layer on bus reset.
void send_nb(uint8_t *buffer, uint32_t size, uint32_t *actual, bool now=true)
Send what there is room for.
USBCDC(bool connect_blocking=true, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001)
Basic constructor.
virtual void callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
Called by USBDevice on data stage completion.
void wait_ready()
Block until the terminal is connected.