MCPcopy Index your code
hub / github.com/arduino/Arduino / touchForCDCReset

Method touchForCDCReset

arduino-core/src/processing/app/Serial.java:98–117  ·  view source on GitHub ↗
(String iname)

Source from the content-addressed store, hash-verified

96 }
97
98 public static boolean touchForCDCReset(String iname) throws SerialException {
99 SerialPort serialPort = new SerialPort(iname);
100 try {
101 serialPort.openPort();
102 serialPort.setParams(1200, 8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
103 serialPort.setDTR(false);
104 serialPort.closePort();
105 return true;
106 } catch (SerialPortException e) {
107 throw new SerialException(format(tr("Error touching serial port ''{0}''."), iname), e);
108 } finally {
109 if (serialPort.isOpened()) {
110 try {
111 serialPort.closePort();
112 } catch (SerialPortException e) {
113 // noop
114 }
115 }
116 }
117 }
118
119 protected Serial(String iname, int irate, char iparity, int idatabits, float istopbits, boolean setRTS, boolean setDTR) throws SerialException {
120 //if (port != null) port.close();

Callers 1

Calls 3

setDTRMethod · 0.80
trMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected