22 #include "USBDescriptor.h" 23 #include "USBDevice_Types.h" 25 #include "USBDevice.h" 26 #include "OperationList.h" 45 USBCDC(
bool connect_blocking =
true, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
63 USBCDC(
USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
94 bool send(uint8_t *buffer, uint32_t size);
104 void send_nb(uint8_t *buffer, uint32_t size, uint32_t *actual,
bool now =
true);
118 bool receive(uint8_t *buffer, uint32_t size, uint32_t *actual = NULL);
127 void receive_nb(uint8_t *buffer, uint32_t size, uint32_t *actual);
135 virtual const uint8_t *device_desc();
142 virtual const uint8_t *string_iproduct_desc();
149 virtual const uint8_t *string_iinterface_desc();
157 virtual const uint8_t *configuration_desc(uint8_t index);
168 virtual void line_coding_changed(
int baud,
int bits,
int parity,
int stop) {};
173 virtual void data_rx() {}
178 virtual void data_tx() {}
190 virtual void callback_set_configuration(uint8_t configuration);
191 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
195 void _change_terminal_connected(
bool connected);
197 void _send_isr_start();
200 void _receive_isr_start();
207 uint8_t _cdc_line_coding[7];
208 uint8_t _cdc_new_line_coding[7];
209 uint8_t _config_descriptor[75];
212 bool _terminal_connected;
215 bool _tx_in_progress;
216 uint8_t _tx_buffer[64];
221 bool _rx_in_progress;
222 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.