- public AvrDrone(SerialPort sp) throws IOException, UnsupportedCommOperationException, InterruptedException, DeviceException {
- this.sp = sp;
- sp.setSerialPortParams(115200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
- sp.setFlowControlMode(sp.FLOWCONTROL_RTSCTS_OUT);
- sp.setInputBufferSize(1024);
- //sp.setFlowControlMode(sp.FLOWCONTROL_NONE);
- this.out = new DataOutputStream(sp.getOutputStream());
- this.in = new DataInputStream(sp.getInputStream());
- Log.debug(this, "consuming any leftover data on the serial port");
- while(in.available() > 0) in.read();
- reset();