Code example for UsbDeviceConnection

Methods: controlTransfer

0
    } 
 
    @Override 
    public boolean InitialiseConnection(UsbDeviceConnection connection) {
 
    	connection.controlTransfer(0x40, 0, 0, 0, null, 0, 0);// reset
    	connection.controlTransfer(0x40, 0, 1, 0, null, 0, 0);// clear Rx
    	connection.controlTransfer(0x40, 0, 2, 0, null, 0, 0);// clear Tx
    	connection.controlTransfer(0x40, 0x02, 0x0000, 0, null, 0, 0); // flow control none
    	 
        /* 
         * Calculate a Divisor at 48MHz 9600 : 0x4138 11400 : 0xc107 19200 : 0x809c 
         * 38400 : 0xc04e 57600 : 0x0034 115200 : 0x001a 230400 : 0x000d 
         */ 
    	connection.controlTransfer(0x40, 0x03, 0x0034, 0, null, 0, 0);
    	 
        connection.controlTransfer(0x40, 0x04, 0x0008, 0, null, 0, 0); // n/8/1
    	 
    	return true; 
    } 
}