3 Commits
Author SHA1 Message Date
Marcus Handte 4375bdd5fe Version 1.0.1
SmartBotKit/serial/master This commit looks good
2019-05-23 15:21:09 +02:00
Marcus Handte 61f24738b4 Add workaround for rplidar.
SmartBotKit/serial/master This commit looks good
2019-05-23 15:18:11 +02:00
handte 71e1c20512 Update to version 1.0.1-SNAPSHOT
SmartBotKit/serial/master This commit looks good
2019-05-16 10:01:21 +02:00
7 changed files with 17 additions and 13 deletions
+2 -2
View File
@@ -21,8 +21,8 @@ control. In addition, the library contains the following extensions:
## Versions
- Latest development version: **1.0.0-SNAPSHOT**
- Latest production version: **none**
- Latest development version: **1.0.2-SNAPSHOT**
- Latest production version: **1.0.1**
## Usage
+1 -1
View File
@@ -7,7 +7,7 @@
<packaging>pom</packaging>
<name>SmartBotKit Serial</name>
<description>SmartBotKit Serial Communication Library</description>
<version>1.0.0</version>
<version>1.0.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.android>4.4.2_r4</version.android>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>serial</artifactId>
<groupId>com.smartbotkit</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
<relativePath>..</relativePath>
</parent>
<artifactId>serial-android</artifactId>
@@ -100,9 +100,9 @@ public class CP210XSerialPort extends AbstractSerialPort {
initConnection();
try {
throwIfNegative(sendControlTransfer(IFC_ENABLE, UART_ENABLE, null), "Failed to enable uart (error: %d).");
throwIfNegative(initBaudRate(), "Failed to set baud rate (error: %d).");
throwIfNegative(initParameters(), "Failed to set parameters (error: %d).");
throwIfNegative(initFlowControl(), "Failed to set flow control (error: %d).");
throwIfNegative(initBaudRate(), "Failed to set baud rate (error: %d).");
} catch (IOException e) {
close();
throw e;
@@ -116,8 +116,10 @@ public class CP210XSerialPort extends AbstractSerialPort {
* @throws IOException Thrown if something fails.
*/
protected int initParameters() throws IOException {
int config = getStopBits() | getDataBits() | getParity();
return sendControlTransfer(SET_LINE_CTL, config, null);
int value = getLineCtl();
value &= ~0x05F3;
value &= getStopBits() | getDataBits() | getParity();
return sendControlTransfer(SET_LINE_CTL, value, null);
}
/**
@@ -195,7 +197,11 @@ public class CP210XSerialPort extends AbstractSerialPort {
(byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x00
};
return sendControlTransfer(SET_FLOW, 0, dataOff);
// work-around for RPLidar, don't set the flow control if it is off
// TODO: check Linux driver to figure out how this should be done properly
// see https://github.com/torvalds/linux/blob/master/drivers/usb/serial/cp210x.c
//return sendControlTransfer(SET_FLOW, 0, dataOff);
return 0;
case DSR_DTR:
byte[] dataDSRDTR = new byte[]{
(byte) 0x11, (byte) 0x00, (byte) 0x00, (byte) 0x00,
@@ -228,8 +234,6 @@ public class CP210XSerialPort extends AbstractSerialPort {
return Math.min(res, sendControlTransfer(SET_FLOW, 0, dataXONXOFF));
}
throw new IOException("Unsupported flow control configuration.");
}
/**
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>serial</artifactId>
<groupId>com.smartbotkit</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
<relativePath>..</relativePath>
</parent>
<artifactId>serial-core</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>serial</artifactId>
<groupId>com.smartbotkit</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
<relativePath>..</relativePath>
</parent>
<artifactId>serial-rxtx</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>serial</artifactId>
<groupId>com.smartbotkit</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
<relativePath>..</relativePath>
</parent>
<artifactId>serial-test</artifactId>