Support Isochronous transfer additionally
Dependents: USBHostC270_example_GR-PEACH USBHostDac_example USBHostDac_Audio_in_out
Fork of USBHost_custom by
Diff: USBHostSerial/USBHostSerial.h
- Revision:
- 36:f8c0979c2814
- Parent:
- 24:868cbfe611a7
- Child:
- 38:dd168a3e4194
--- a/USBHostSerial/USBHostSerial.h Fri Apr 29 01:16:38 2016 +0100 +++ b/USBHostSerial/USBHostSerial.h Mon Jan 23 06:05:50 2017 +0000 @@ -51,12 +51,18 @@ void connect(USBHost* _host, USBDeviceConnected * _dev, uint8_t _serial_intf, USBEndpoint* _bulk_in, USBEndpoint* _bulk_out); + bool connected(); + /** * Check the number of bytes available. * * @returns the number of bytes available */ +#if(1) + uint32_t available(); +#else uint8_t available(); +#endif /** * Attach a member function to call when a packet is received. @@ -105,7 +111,7 @@ */ void format(int bits = 8, Parity parity = USBHostSerialPort::None, int stop_bits = 1); virtual int writeBuf(const char* b, int s); - virtual int readBuf(char* b, int s); + virtual int readBuf(char* b, int s, int timeout = -1); protected: virtual int _getc(); @@ -122,7 +128,8 @@ void init(); - MtxCircBuffer<uint8_t, 128> circ_buf; +// MtxCircBuffer<uint8_t, 128> circ_buf; + MtxCircBuffer<uint8_t, (1024 * 32)> circ_buf; uint8_t buf[64]; @@ -141,6 +148,7 @@ FunctionPointer tx; uint8_t serial_intf; + bool dev_connected; }; #if (USBHOST_SERIAL <= 1) @@ -164,7 +172,7 @@ * * @returns true if a serial device is connected */ - bool connected(); +// bool connected(); protected: USBHost* host; @@ -177,8 +185,6 @@ virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used -private: - bool dev_connected; }; #else // (USBHOST_SERIAL > 1) @@ -221,8 +227,6 @@ virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used -private: - bool dev_connected; }; #endif // (USBHOST_SERIAL <= 1)