Skip to content

libraries/USBSerial: Allow the USB connection to be non-blocking #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/USBDevice/USBSerial/USBCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ static uint8_t cdc_line_coding[7]= {0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08};

#define MAX_CDC_REPORT_SIZE MAX_PACKET_SIZE_EPBULK

USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) {
USBCDC::USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking): USBDevice(vendor_id, product_id, product_release) {
terminal_connected = false;
USBDevice::connect();
USBDevice::connect(connect_blocking);
}

bool USBCDC::USBCallback_request(void) {
Expand Down
3 changes: 2 additions & 1 deletion libraries/USBDevice/USBSerial/USBCDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class USBCDC: public USBDevice {
* @param vendor_id Your vendor_id
* @param product_id Your product_id
* @param product_release Your preoduct_release
* @param connect_blocking define if the connection must be blocked if USB not plugged in
*/
USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking);

protected:

Expand Down
3 changes: 2 additions & 1 deletion libraries/USBDevice/USBSerial/USBSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class USBSerial: public USBCDC, public Stream {
* @param vendor_id Your vendor_id (default: 0x1f00)
* @param product_id Your product_id (default: 0x2012)
* @param product_release Your preoduct_release (default: 0x0001)
* @param connect_blocking define if the connection must be blocked if USB not plugged in
*
*/
USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001): USBCDC(vendor_id, product_id, product_release), buf(128){
USBSerial(uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001, bool connect_blocking = true): USBCDC(vendor_id, product_id, product_release, connect_blocking), buf(128){
settingsChangedCallback = 0;
};

Expand Down