Answer the question
In order to leave comments, you need to log in
Connection settings are not set at startup in Physicaloid, what's the problem?
There is a code that, when switching to a RadioButton, assigns different values to the driver:
rgBaudrate.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb0:
mPhysicaloid.setBaudrate(9600);
break;
case R.id.rb1:
UartConfig uartConfig = new UartConfig(19200, UartConfig.DATA_BITS8, UartConfig.STOP_BITS1, UartConfig.PARITY_NONE, false, false);
mPhysicaloid.setConfig(uartConfig);
break;
default:
tvAppend(tvRead, "no set");
break;
}
}
});
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutorial5);
btOpen = (Button) findViewById(R.id.btOpen);
btClose = (Button) findViewById(R.id.btClose);
btWrite = (Button) findViewById(R.id.btWrite);
etWrite = (EditText) findViewById(R.id.etWrite);
tvRead = (TextView) findViewById(R.id.tvRead);
rgBaudrate = (RadioGroup) findViewById(R.id.rgBaudrate);
rb0 = (RadioButton) findViewById(R.id.rb0);
rb1 = (RadioButton) findViewById(R.id.rb1);
setEnabledUi(false);
mPhysicaloid = new Physicaloid(this);
UartConfig uartConfig = new UartConfig(19200, UartConfig.DATA_BITS8, UartConfig.STOP_BITS1, UartConfig.PARITY_NONE, false, false);
mPhysicaloid.setConfig(uartConfig);
UartConfig uartConfig = new UartConfig(19200, UartConfig.DATA_BITS8, UartConfig.STOP_BITS1, UartConfig.PARITY_NONE, false, false);
mPhysicaloid.setConfig(uartConfig);
Answer the question
In order to leave comments, you need to log in
Can be configured before the first USB access in the openDevice() method ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question