MCPcopy Index your code
hub / github.com/processing/processing / list

Method list

java/libraries/io/src/processing/io/I2C.java:141–161  ·  view source on GitHub ↗

Lists all available I2C interfaces @return String array @webref

()

Source from the content-addressed store, hash-verified

139 * @webref
140 */
141 public static String[] list() {
142 if (NativeInterface.isSimulated()) {
143 // as on the Raspberry Pi
144 return new String[]{ "i2c-1" };
145 }
146
147 ArrayList<String> devs = new ArrayList<String>();
148 File dir = new File("/dev");
149 File[] files = dir.listFiles();
150 if (files != null) {
151 for (File file : files) {
152 if (file.getName().startsWith("i2c-")) {
153 devs.add(file.getName());
154 }
155 }
156 }
157 // listFiles() does not guarantee ordering
158 String[] tmp = devs.toArray(new String[devs.size()]);
159 Arrays.sort(tmp);
160 return tmp;
161 }
162
163
164 /**

Callers

nothing calls this directly

Calls 7

isSimulatedMethod · 0.95
startsWithMethod · 0.80
listFilesMethod · 0.45
getNameMethod · 0.45
addMethod · 0.45
sizeMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected