Skip to content

Commit

Permalink
Merge pull request #261 from winy57/contribution
Browse files Browse the repository at this point in the history
Added setBreak method for CP21012 devices
  • Loading branch information
felHR85 authored Jul 11, 2019
2 parents b967da3 + f4889f0 commit 85c69b5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CP2102SerialDevice extends UsbSerialDevice
private static final int CP210x_SET_BAUDDIV = 0x01;
private static final int CP210x_SET_LINE_CTL = 0x03;
private static final int CP210x_GET_LINE_CTL = 0x04;
private static final int CP210X_SET_BREAK = 0x05;
private static final int CP210x_SET_MHS = 0x07;
private static final int CP210x_SET_BAUDRATE = 0x1E;
private static final int CP210x_SET_FLOW = 0x13;
Expand All @@ -31,6 +32,9 @@ public class CP2102SerialDevice extends UsbSerialDevice
private static final int CP210x_REQTYPE_HOST2DEVICE = 0x41;
private static final int CP210x_REQTYPE_DEVICE2HOST = 0xC1;

private static final int CP210x_BREAK_ON = 0x0001;
private static final int CP210x_BREAK_OFF = 0x0000;

private static final int CP210x_MHS_RTS_ON = 0x202;
private static final int CP210x_MHS_RTS_OFF = 0x200;
private static final int CP210x_MHS_DTR_ON = 0x101;
Expand Down Expand Up @@ -329,7 +333,11 @@ public void setFlowControl(int flowControl)
@Override
public void setBreak(boolean state)
{
//TODO Auto-generated method stub
if (state) {
setControlCommand(CP210X_SET_BREAK, CP210x_BREAK_ON, null);
} else {
setControlCommand(CP210X_SET_BREAK, CP210x_BREAK_OFF, null);
}
}

@Override
Expand Down

0 comments on commit 85c69b5

Please sign in to comment.