mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-31 20:52:13 +01:00
per-board generic option in config file boards.txt for disabling control of dtr+rts from IDE, allowing board specific use of these lines for example for reset or programming mode. Currently used by esp8266/Arduino.
This commit is contained in:
parent
c7b412ca3f
commit
125846f55d
@ -64,27 +64,35 @@ public class Serial implements SerialPortEventListener {
|
|||||||
PreferencesData.getInteger("serial.debug_rate", 9600),
|
PreferencesData.getInteger("serial.debug_rate", 9600),
|
||||||
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
||||||
PreferencesData.getInteger("serial.databits", 8),
|
PreferencesData.getInteger("serial.databits", 8),
|
||||||
PreferencesData.getFloat("serial.stopbits", 1));
|
PreferencesData.getFloat("serial.stopbits", 1),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Serial(int irate) throws SerialException {
|
public Serial(int irate) throws SerialException {
|
||||||
this(PreferencesData.get("serial.port"), irate,
|
this(PreferencesData.get("serial.port"), irate,
|
||||||
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
||||||
PreferencesData.getInteger("serial.databits", 8),
|
PreferencesData.getInteger("serial.databits", 8),
|
||||||
PreferencesData.getFloat("serial.stopbits", 1));
|
PreferencesData.getFloat("serial.stopbits", 1),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Serial(String iname, int irate) throws SerialException {
|
public Serial(String iname, int irate) throws SerialException {
|
||||||
this(iname, irate, PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
this(iname, irate, PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
||||||
PreferencesData.getInteger("serial.databits", 8),
|
PreferencesData.getInteger("serial.databits", 8),
|
||||||
PreferencesData.getFloat("serial.stopbits", 1));
|
PreferencesData.getFloat("serial.stopbits", 1),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Serial(String iname) throws SerialException {
|
public Serial(String iname) throws SerialException {
|
||||||
this(iname, PreferencesData.getInteger("serial.debug_rate", 9600),
|
this(iname, PreferencesData.getInteger("serial.debug_rate", 9600),
|
||||||
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
|
||||||
PreferencesData.getInteger("serial.databits", 8),
|
PreferencesData.getInteger("serial.databits", 8),
|
||||||
PreferencesData.getFloat("serial.stopbits", 1));
|
PreferencesData.getFloat("serial.stopbits", 1),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
|
||||||
|
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean touchForCDCReset(String iname) throws SerialException {
|
public static boolean touchForCDCReset(String iname) throws SerialException {
|
||||||
@ -108,7 +116,7 @@ public class Serial implements SerialPortEventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Serial(String iname, int irate, char iparity, int idatabits, float istopbits) throws SerialException {
|
private Serial(String iname, int irate, char iparity, int idatabits, float istopbits, boolean setRTS, boolean setDTR) throws SerialException {
|
||||||
//if (port != null) port.close();
|
//if (port != null) port.close();
|
||||||
//this.parent = parent;
|
//this.parent = parent;
|
||||||
//parent.attach(this);
|
//parent.attach(this);
|
||||||
@ -126,7 +134,7 @@ public class Serial implements SerialPortEventListener {
|
|||||||
try {
|
try {
|
||||||
port = new SerialPort(iname);
|
port = new SerialPort(iname);
|
||||||
port.openPort();
|
port.openPort();
|
||||||
boolean res = port.setParams(irate, idatabits, stopbits, parity, true, true);
|
boolean res = port.setParams(irate, idatabits, stopbits, parity, setRTS, setDTR);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
System.err.println(format(tr("Error while setting serial port parameters: {0} {1} {2} {3}"),
|
System.err.println(format(tr("Error while setting serial port parameters: {0} {1} {2} {3}"),
|
||||||
irate, iparity, idatabits, istopbits));
|
irate, iparity, idatabits, istopbits));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user