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

Method list

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

Lists all available SPI interfaces @return String array @webref

()

Source from the content-addressed store, hash-verified

119 * @webref
120 */
121 public static String[] list() {
122 if (NativeInterface.isSimulated()) {
123 // as on the Raspberry Pi
124 return new String[]{ "spidev0.0", "spidev0.1" };
125 }
126
127 ArrayList<String> devs = new ArrayList<String>();
128 File dir = new File("/dev");
129 File[] files = dir.listFiles();
130 if (files != null) {
131 for (File file : files) {
132 if (file.getName().startsWith("spidev")) {
133 devs.add(file.getName());
134 }
135 }
136 }
137 // listFiles() does not guarantee ordering
138 String[] tmp = devs.toArray(new String[devs.size()]);
139 Arrays.sort(tmp);
140 return tmp;
141 }
142
143
144 /**

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