Skip to content

Commit

Permalink
1. 修改 开放波特率自由设置
Browse files Browse the repository at this point in the history
  • Loading branch information
F1ReKing committed Dec 17, 2019
1 parent dd9ba4b commit cfab358
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void open() {
if (mSerialPortHelper == null) {
mSerialPortHelper = new SerialPortHelper();
mSerialPortHelper.setPort("/dev/ttyUSB0");
mSerialPortHelper.setBaudRate(BAUDRATE.getBaudrate(BAUDRATE.B115200));
mSerialPortHelper.setBaudRate(120);
mSerialPortHelper.setStopBits(STOPB.getStopBit(STOPB.B2));
mSerialPortHelper.setDataBits(DATAB.getDataBit(DATAB.CS8));
mSerialPortHelper.setParity(PARITY.getParity(PARITY.NONE));
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 2 additions & 1 deletion serialportlib/src/main/jni/SerialPort.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ JNIEXPORT jobject JNICALL Java_me_f1reking_serialportlib_SerialPortHelper_native

/* Check arguments */
{
speed = getBaudrate(baudrate);
// speed = getBaudrate(baudrate);
speed = baudrate;
if (speed == -1) {
/* TODO: throw an exception */
LOGE("Invalid baudrate");
Expand Down

0 comments on commit cfab358

Please sign in to comment.