USB Composite support
Dependents: mbed_cdc_hid_composite
Fork of USBDevice by
Diff: USBSerial/USBSerial.h
- Revision:
- 55:7c559fcb1d17
- Parent:
- 51:deafa44182d9
diff -r 461d954eee6b -r 7c559fcb1d17 USBSerial/USBSerial.h --- a/USBSerial/USBSerial.h Fri May 22 08:45:47 2015 +0100 +++ b/USBSerial/USBSerial.h Sun May 31 15:36:50 2015 +0000 @@ -56,8 +56,11 @@ * @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, bool connect_blocking = true): USBCDC(vendor_id, product_id, product_release, connect_blocking){ + + USBSerial(USBDevice *usb = new USBDevice(), bool connect_blocking = true, uint8_t ep_int_in = EPINT_IN, uint8_t ep_bulk_in = EPBULK_IN, uint8_t ep_bulk_out = EPBULK_OUT): + USBCDC(usb, ep_int_in, ep_bulk_in, ep_bulk_out, connect_blocking) { settingsChangedCallback = 0; + usb->set_ep_callback(ep_bulk_out, this, &USBSerial::EP_OUT_callback); }; @@ -145,13 +148,15 @@ } protected: - virtual bool EPBULK_OUT_callback(); + static bool EP_OUT_callback(void *self); + virtual void lineCodingChanged(int baud, int bits, int parity, int stop){ if (settingsChangedCallback) { settingsChangedCallback(baud, bits, parity, stop); } } + private: FunctionPointer rx; CircBuffer<uint8_t,128> buf;