GeezerVison is showing github.com — I/O: Add @webref annotation · jekyllwrite/processing@63706ee
File treeExpand file treeCollapse file tree Open diff view settings java/libraries/io/src/processing/io
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/GPIO.java +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 31 | 31 | import java.util.Map; | 32 | 32 |
| 33 | 33 |
| | 34 | +/** | | 35 | + * @webref | | 36 | + */ | 34 | 37 | public class GPIO { | 35 | 38 |
| 36 | 39 | // those constants are generally the same as in Arduino.h | @@ -99,6 +102,7 @@ public static void analogWrite(int pin, int value) { | 99 | 102 | * @see noInterrupts | 100 | 103 | * @see interrupts | 101 | 104 | * @see releaseInterrupt | | 105 | + * @webref | 102 | 106 | */ | 103 | 107 | public static void attachInterrupt(int pin, PApplet parent, String method, int mode) { | 104 | 108 | if (irqThreads.containsKey(pin)) { | @@ -159,6 +163,7 @@ public void run() { | 159 | 163 | * Board-specific classes, such as RPI, assign -1 to pins that carry power, | 160 | 164 | * ground and the like. | 161 | 165 | * @param pin GPIO pin | | 166 | + * @webref | 162 | 167 | */ | 163 | 168 | protected static void checkValidPin(int pin) { | 164 | 169 | if (pin < 0) { | @@ -176,6 +181,7 @@ protected static void checkValidPin(int pin) { | 176 | 181 | * @return GPIO.HIGH (1) or GPIO.LOW (0) | 177 | 182 | * @see pinMode | 178 | 183 | * @see digitalWrite | | 184 | + * @webref | 179 | 185 | */ | 180 | 186 | public static int digitalRead(int pin) { | 181 | 187 | checkValidPin(pin); | @@ -211,6 +217,7 @@ public static int digitalRead(int pin) { | 211 | 217 | * @param value GPIO.HIGH or GPIO.LOW | 212 | 218 | * @see pinMode | 213 | 219 | * @see digitalRead | | 220 | + * @webref | 214 | 221 | */ | 215 | 222 | public static void digitalWrite(int pin, int value) { | 216 | 223 | checkValidPin(pin); | @@ -250,6 +257,7 @@ public static void digitalWrite(int pin, int value) { | 250 | 257 | * @param value true or false | 251 | 258 | * @see pinMode | 252 | 259 | * @see digitalRead | | 260 | + * @webref | 253 | 261 | */ | 254 | 262 | public static void digitalWrite(int pin, boolean value) { | 255 | 263 | if (value) { | @@ -269,6 +277,7 @@ public static void digitalWrite(int pin, boolean value) { | 269 | 277 | * @param pin GPIO pin | 270 | 278 | * @see enableInterrupt | 271 | 279 | * @see waitForInterrupt | | 280 | + * @webref | 272 | 281 | */ | 273 | 282 | public static void disableInterrupt(int pin) { | 274 | 283 | enableInterrupt(pin, NONE); | @@ -284,6 +293,7 @@ public static void disableInterrupt(int pin) { | 284 | 293 | * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING | 285 | 294 | * @see waitForInterrupt | 286 | 295 | * @see disableInterrupt | | 296 | + * @webref | 287 | 297 | */ | 288 | 298 | public static void enableInterrupt(int pin, int mode) { | 289 | 299 | checkValidPin(pin); | @@ -322,6 +332,7 @@ public static void enableInterrupt(int pin, int mode) { | 322 | 332 | * @see attachInterrupt | 323 | 333 | * @see noInterrupts | 324 | 334 | * @see releaseInterrupt | | 335 | + * @webref | 325 | 336 | */ | 326 | 337 | public static void interrupts() { | 327 | 338 | serveInterrupts = true; | @@ -338,6 +349,7 @@ public static void interrupts() { | 338 | 349 | * @see attachInterrupt | 339 | 350 | * @see interrupts | 340 | 351 | * @see releaseInterrupt | | 352 | + * @webref | 341 | 353 | */ | 342 | 354 | public static void noInterrupts() { | 343 | 355 | serveInterrupts = false; | @@ -355,6 +367,7 @@ public static void noInterrupts() { | 355 | 367 | * @see digitalRead | 356 | 368 | * @see digitalWrite | 357 | 369 | * @see releasePin | | 370 | + * @webref | 358 | 371 | */ | 359 | 372 | public static void pinMode(int pin, int mode) { | 360 | 373 | checkValidPin(pin); | @@ -416,6 +429,7 @@ public static void pinMode(int pin, int mode) { | 416 | 429 | * @see attachInterrupt | 417 | 430 | * @see noInterrupts | 418 | 431 | * @see interrupts | | 432 | + * @webref | 419 | 433 | */ | 420 | 434 | public static void releaseInterrupt(int pin) { | 421 | 435 | Thread t = irqThreads.get(pin); | @@ -443,6 +457,7 @@ public static void releaseInterrupt(int pin) { | 443 | 457 | * state even after the sketch has been closed. | 444 | 458 | * @param pin GPIO pin | 445 | 459 | * @see pinMode | | 460 | + * @webref | 446 | 461 | */ | 447 | 462 | public static void releasePin(int pin) { | 448 | 463 | checkValidPin(pin); | @@ -471,6 +486,7 @@ public static void releasePin(int pin) { | 471 | 486 | * @return true if the interrupt occured, false if the timeout occured | 472 | 487 | * @see enableInterrupt | 473 | 488 | * @see disableInterrupt | | 489 | + * @webref | 474 | 490 | */ | 475 | 491 | public static boolean waitForInterrupt(int pin, int timeout) { | 476 | 492 | checkValidPin(pin); | @@ -501,6 +517,7 @@ public static boolean waitForInterrupt(int pin, int timeout) { | 501 | 517 | * @parm pin GPIO pin | 502 | 518 | * @see enableInterrupt | 503 | 519 | * @see disableInterrupt | | 520 | + * @webref | 504 | 521 | */ | 505 | 522 | public static void waitForInterrupt(int pin) { | 506 | 523 | waitForInterrupt(pin, -1); | |
Collapse file Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/I2C.java +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | import java.util.Arrays; | 30 | 30 |
| 31 | 31 |
| | 32 | +/** | | 33 | + * @webref | | 34 | + */ | 32 | 35 | public class I2C { | 33 | 36 |
| 34 | 37 | protected String dev; | @@ -43,6 +46,7 @@ public class I2C { | 43 | 46 | * | 44 | 47 | * @param dev device name | 45 | 48 | * @see list | | 49 | + * @webref | 46 | 50 | */ | 47 | 51 | public I2C(String dev) { | 48 | 52 | NativeInterface.loadLibrary(); | @@ -72,6 +76,7 @@ public I2C(String dev) { | 72 | 76 | * @see write | 73 | 77 | * @see read | 74 | 78 | * @see endTransmission | | 79 | + * @webref | 75 | 80 | */ | 76 | 81 | public void beginTransmission(int slave) { | 77 | 82 | // addresses 120 (0x78) to 127 are additionally reserved | @@ -87,6 +92,7 @@ public void beginTransmission(int slave) { | 87 | 92 |
| 88 | 93 | /** | 89 | 94 | * Closes the I2C device | | 95 | + * @webref | 90 | 96 | */ | 91 | 97 | public void close() { | 92 | 98 | NativeInterface.closeDevice(handle); | @@ -109,6 +115,7 @@ protected void finalize() throws Throwable { | 109 | 115 | * This executes any queued writes. | 110 | 116 | * @see beginTransmission | 111 | 117 | * @see write | | 118 | + * @webref | 112 | 119 | */ | 113 | 120 | public void endTransmission() { | 114 | 121 | if (!transmitting) { | @@ -132,6 +139,7 @@ public void endTransmission() { | 132 | 139 | /** | 133 | 140 | * Lists all available I2C devices | 134 | 141 | * @return String array | | 142 | + * @webref | 135 | 143 | */ | 136 | 144 | public static String[] list() { | 137 | 145 | ArrayList<String> devs = new ArrayList<String>(); | @@ -162,6 +170,7 @@ public static String[] list() { | 162 | 170 | * @see beginTransmission | 163 | 171 | * @see write | 164 | 172 | * @see endTransmission | | 173 | + * @webref | 165 | 174 | */ | 166 | 175 | public byte[] read(int len) { | 167 | 176 | if (!transmitting) { | @@ -194,6 +203,7 @@ public byte[] read(int len) { | 194 | 203 | * @see beginTransmission | 195 | 204 | * @see read | 196 | 205 | * @see endTransmission | | 206 | + * @webref | 197 | 207 | */ | 198 | 208 | public void write(byte[] out) { | 199 | 209 | if (!transmitting) { | @@ -221,6 +231,7 @@ public void write(byte[] out) { | 221 | 231 | * @see beginTransmission | 222 | 232 | * @see read | 223 | 233 | * @see endTransmission | | 234 | + * @webref | 224 | 235 | */ | 225 | 236 | public void write(String out) { | 226 | 237 | write(out.getBytes()); | @@ -237,6 +248,7 @@ public void write(String out) { | 237 | 248 | * @see beginTransmission | 238 | 249 | * @see read | 239 | 250 | * @see endTransmission | | 251 | + * @webref | 240 | 252 | */ | 241 | 253 | public void write(int out) { | 242 | 254 | if (out < 0 || 255 < out) { | |
Collapse file Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/LED.java +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 32 | 32 | import java.util.Arrays; | 33 | 33 |
| 34 | 34 |
| | 35 | +/** | | 36 | + * @webref | | 37 | + */ | 35 | 38 | public class LED { | 36 | 39 |
| 37 | 40 | protected String dev; | @@ -44,6 +47,7 @@ public class LED { | 44 | 47 | * Opens a LED device | 45 | 48 | * @param dev device name | 46 | 49 | * @see list | | 50 | + * @webref | 47 | 51 | */ | 48 | 52 | public LED(String dev) { | 49 | 53 | NativeInterface.loadLibrary(); | @@ -98,6 +102,7 @@ public LED(String dev) { | 98 | 102 | /** | 99 | 103 | * Sets the brightness | 100 | 104 | * @param bright 0.0 (off) to 1.0 (maximum) | | 105 | + * @webref | 101 | 106 | */ | 102 | 107 | public void brightness(float bright) { | 103 | 108 | String fn = "/sys/class/leds/" + dev + "/brightness"; | @@ -117,6 +122,7 @@ public void brightness(float bright) { | 117 | 122 | * | 118 | 123 | * Without calling this function the LED will remain in the current | 119 | 124 | * state even after the sketch has been closed. | | 125 | + * @webref | 120 | 126 | */ | 121 | 127 | public void close() { | 122 | 128 | // restore previous settings | @@ -137,6 +143,7 @@ public void close() { | 137 | 143 | /** | 138 | 144 | * Lists all available LED devices | 139 | 145 | * @return String array | | 146 | + * @webref | 140 | 147 | */ | 141 | 148 | public static String[] list() { | 142 | 149 | ArrayList<String> devs = new ArrayList<String>(); | |
Collapse file Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/PWM.java +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 32 | 32 | import java.util.Arrays; | 33 | 33 |
| 34 | 34 |
| | 35 | +/** | | 36 | + * @webref | | 37 | + */ | 35 | 38 | public class PWM { | 36 | 39 |
| 37 | 40 | int channel; | @@ -42,6 +45,7 @@ public class PWM { | 42 | 45 | * Opens a PWM channel | 43 | 46 | * @param channel PWM channel | 44 | 47 | * @see list | | 48 | + * @webref | 45 | 49 | */ | 46 | 50 | public PWM(String channel) { | 47 | 51 | NativeInterface.loadLibrary(); | @@ -82,6 +86,7 @@ public PWM(String channel) { | 82 | 86 |
| 83 | 87 | /** | 84 | 88 | * Disables the PWM output | | 89 | + * @webref | 85 | 90 | */ | 86 | 91 | public void clear() { | 87 | 92 | String fn = String.format("/sys/class/pwm/%s/gpio%d/enable", chip, channel); | @@ -97,6 +102,7 @@ public void clear() { | 97 | 102 | * | 98 | 103 | * Without calling this function the channel will remain in the current | 99 | 104 | * state even after the sketch has been closed. | | 105 | + * @webref | 100 | 106 | */ | 101 | 107 | public void close() { | 102 | 108 | // XXX: implicit clear()? | @@ -118,6 +124,7 @@ public void close() { | 118 | 124 | /** | 119 | 125 | * Lists all available PWM channels | 120 | 126 | * @return String array | | 127 | + * @webref | 121 | 128 | */ | 122 | 129 | public static String[] list() { | 123 | 130 | ArrayList<String> devs = new ArrayList<String>(); | @@ -148,6 +155,7 @@ public static String[] list() { | 148 | 155 | * Enables the PWM output | 149 | 156 | * @param period cycle period in Hz | 150 | 157 | * @param duty duty cycle, 0.0 (always off) to 1.0 (always on) | | 158 | + * @webref | 151 | 159 | */ | 152 | 160 | public void set(int period, float duty) { | 153 | 161 | // set period | @@ -184,6 +192,7 @@ public void set(int period, float duty) { | 184 | 192 | * the Arduino Uno, which have a frequency of 980 Hz. | 185 | 193 | * It is recommended to use set(period, duty) instead. | 186 | 194 | * @param duty duty cycle, 0.0 (always off) to 1.0 (always on) | | 195 | + * @webref | 187 | 196 | */ | 188 | 197 | public void set(float duty) { | 189 | 198 | set(1000, duty); | |
Collapse file Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/RPI.java +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 23 | 23 | package processing.io; | 24 | 24 |
| 25 | 25 |
| | 26 | +/** | | 27 | + * @webref | | 28 | + */ | 26 | 29 | public class RPI { | 27 | 30 |
| 28 | 31 | /* | |
Collapse file Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/SPI.java +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 31 | 31 | import java.util.Map; | 32 | 32 |
| 33 | 33 |
| | 34 | +/** | | 35 | + * @webref | | 36 | + */ | 34 | 37 | public class SPI { | 35 | 38 |
| 36 | 39 | /** | @@ -70,6 +73,7 @@ public class SPI { | 70 | 73 | * Opens an SPI interface | 71 | 74 | * @param dev device name | 72 | 75 | * @see list | | 76 | + * @webref | 73 | 77 | */ | 74 | 78 | public SPI(String dev) { | 75 | 79 | NativeInterface.loadLibrary(); | @@ -83,6 +87,7 @@ public SPI(String dev) { | 83 | 87 |
| 84 | 88 | /** | 85 | 89 | * Closes the SPI interface | | 90 | + * @webref | 86 | 91 | */ | 87 | 92 | public void close() { | 88 | 93 | NativeInterface.closeDevice(handle); | @@ -102,6 +107,7 @@ protected void finalize() throws Throwable { | 102 | 107 | /** | 103 | 108 | * Lists all available SPI interfaces | 104 | 109 | * @return String array | | 110 | + * @webref | 105 | 111 | */ | 106 | 112 | public static String[] list() { | 107 | 113 | ArrayList<String> devs = new ArrayList<String>(); | @@ -126,6 +132,7 @@ public static String[] list() { | 126 | 132 | * @param maxSpeed maximum transmission rate in Hz, 500000 (500 kHz) is a resonable default | 127 | 133 | * @param dataOrder whether data is send with the first- or least significant bit first (SPI.MSBFIRST or SPI.LSBFIRST, the former is more common) | 128 | 134 | * @param mode SPI.MODE0 to SPI.MODE3 (see https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Clock_polarity_and_phase) | | 135 | + * @webref | 129 | 136 | */ | 130 | 137 | public void settings(int maxSpeed, int dataOrder, int mode) { | 131 | 138 | this.maxSpeed = maxSpeed; | @@ -142,6 +149,7 @@ public void settings(int maxSpeed, int dataOrder, int mode) { | 142 | 149 | * one byte being read in. | 143 | 150 | * @param out bytes to send | 144 | 151 | * @return bytes read in (array is the same length as out) | | 152 | + * @webref | 145 | 153 | */ | 146 | 154 | public byte[] transfer(byte[] out) { | 147 | 155 | // track the current setting per device across multiple instances | @@ -174,6 +182,7 @@ public byte[] transfer(byte[] out) { | 174 | 182 | * one byte being read in. | 175 | 183 | * @param out string to send | 176 | 184 | * @return bytes read in (array is the same length as out) | | 185 | + * @webref | 177 | 186 | */ | 178 | 187 | public byte[] transfer(String out) { | 179 | 188 | return transfer(out.getBytes()); | @@ -188,6 +197,7 @@ public byte[] transfer(String out) { | 188 | 197 | * one byte being read in. | 189 | 198 | * @param out single byte to send | 190 | 199 | * @return bytes read in (array is the same length as out) | | 200 | + * @webref | 191 | 201 | */ | 192 | 202 | public byte[] transfer(int out) { | 193 | 203 | if (out < 0 || 255 < out) { | |
|