From 0ee27fba07feaeacaa4840dcc767ebc5bb760e0f Mon Sep 17 00:00:00 2001 From: Felipe Herranz Date: Thu, 27 Aug 2015 17:28:32 +0200 Subject: [PATCH] Added the last supported chipset family --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6cbcdbd..f2e5e57 100644 --- a/README.md +++ b/README.md @@ -8,30 +8,30 @@ Devices Supported -------------------------------------- [CP210X devices](http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx) Default: 9600,8,1,None,flow off -[Bluegiga BLED112 Dongle](https://www.bluegiga.com/en-US/products/bluetooth-4.0-modules/bled112-bluetooth-smart-dongle/) Default 115200,8,1,None,flow off +[CDC devices](https://en.wikipedia.org/wiki/USB_communications_device_class) Default 115200,8,1,None,flow off [FTDI devices](http://www.ftdichip.com/FTProducts.htm) Default: 9600,8,1,None,flow off [PL2303 devices](http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41) Default 9600,8,1,None,flow off +[CH34x devices](https://www.olimex.com/Products/Breadboarding/BB-CH340T/resources/CH340DS1.PDF) Default 9600,8,1,None,flow off + How to use it? -------------------------------------- -Instantiate a new object of the desired device you want to handle +Instantiate a new object of the UsbSerialDevice class ~~~ UsbDevice device; UsbDeviceConnection usbConnection; ... -CP2102SerialDevice cp2102 = new CP2102SerialDevice(device, usbConnection); -// Factory method, auto detect current device connected, return null if is not supported -// UsbSerialDevice serial = UsbSerialDevice.createUsbSerialDevice(device, usbConnection); +UsbSerialDevice serial = UsbSerialDevice.createUsbSerialDevice(device, usbConnection); ~~~ Open the device and set it up as desired ~~~~ -cp2102.open(); -cp2102.setBaudRate(115200); -cp2102.setDataBits(UsbSerialInterface.DATA_BITS_8); -cp2102.setParity(UsbSerialInterface.PARITY_ODD); +serial.open(); +serial.setBaudRate(115200); +serial.setDataBits(UsbSerialInterface.DATA_BITS_8); +serial.setParity(UsbSerialInterface.PARITY_ODD); ~~~~ There is no need to be polling if you want to perform a bulk transaction to a IN endpoint. Define a simply callback @@ -49,17 +49,17 @@ private UsbSerialInterface.UsbReadCallback mCallback = new UsbSerialInterface.Us And pass a reference of it ~~~ -cp2102.read(mCallback); +serial.read(mCallback); ~~~ Write something ~~~ -cp2102.write("DATA".getBytes()); // Async-like operation now! :) +serial.write("DATA".getBytes()); // Async-like operation now! :) ~~~ Close the device: ~~~ -cp2102.close(); +serial.close(); ~~~ In Android usb api, when a usb device has been close it must be reopened