Skip to content

Commit 575edf0

Browse files
committed
I/O: Add @webref annotation
1 parent cd03e69 commit 575edf0

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed

java/libraries/io/src/processing/io/GPIO.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
import java.util.Map;
3232

3333

34+
/**
35+
* @webref
36+
*/
3437
public class GPIO {
3538

3639
// those constants are generally the same as in Arduino.h
@@ -99,6 +102,7 @@ public static void analogWrite(int pin, int value) {
99102
* @see noInterrupts
100103
* @see interrupts
101104
* @see releaseInterrupt
105+
* @webref
102106
*/
103107
public static void attachInterrupt(int pin, PApplet parent, String method, int mode) {
104108
if (irqThreads.containsKey(pin)) {
@@ -159,6 +163,7 @@ public void run() {
159163
* Board-specific classes, such as RPI, assign -1 to pins that carry power,
160164
* ground and the like.
161165
* @param pin GPIO pin
166+
* @webref
162167
*/
163168
protected static void checkValidPin(int pin) {
164169
if (pin < 0) {
@@ -176,6 +181,7 @@ protected static void checkValidPin(int pin) {
176181
* @return GPIO.HIGH (1) or GPIO.LOW (0)
177182
* @see pinMode
178183
* @see digitalWrite
184+
* @webref
179185
*/
180186
public static int digitalRead(int pin) {
181187
checkValidPin(pin);
@@ -211,6 +217,7 @@ public static int digitalRead(int pin) {
211217
* @param value GPIO.HIGH or GPIO.LOW
212218
* @see pinMode
213219
* @see digitalRead
220+
* @webref
214221
*/
215222
public static void digitalWrite(int pin, int value) {
216223
checkValidPin(pin);
@@ -250,6 +257,7 @@ public static void digitalWrite(int pin, int value) {
250257
* @param value true or false
251258
* @see pinMode
252259
* @see digitalRead
260+
* @webref
253261
*/
254262
public static void digitalWrite(int pin, boolean value) {
255263
if (value) {
@@ -269,6 +277,7 @@ public static void digitalWrite(int pin, boolean value) {
269277
* @param pin GPIO pin
270278
* @see enableInterrupt
271279
* @see waitForInterrupt
280+
* @webref
272281
*/
273282
public static void disableInterrupt(int pin) {
274283
enableInterrupt(pin, NONE);
@@ -284,6 +293,7 @@ public static void disableInterrupt(int pin) {
284293
* @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING
285294
* @see waitForInterrupt
286295
* @see disableInterrupt
296+
* @webref
287297
*/
288298
public static void enableInterrupt(int pin, int mode) {
289299
checkValidPin(pin);
@@ -322,6 +332,7 @@ public static void enableInterrupt(int pin, int mode) {
322332
* @see attachInterrupt
323333
* @see noInterrupts
324334
* @see releaseInterrupt
335+
* @webref
325336
*/
326337
public static void interrupts() {
327338
serveInterrupts = true;
@@ -338,6 +349,7 @@ public static void interrupts() {
338349
* @see attachInterrupt
339350
* @see interrupts
340351
* @see releaseInterrupt
352+
* @webref
341353
*/
342354
public static void noInterrupts() {
343355
serveInterrupts = false;
@@ -355,6 +367,7 @@ public static void noInterrupts() {
355367
* @see digitalRead
356368
* @see digitalWrite
357369
* @see releasePin
370+
* @webref
358371
*/
359372
public static void pinMode(int pin, int mode) {
360373
checkValidPin(pin);
@@ -416,6 +429,7 @@ public static void pinMode(int pin, int mode) {
416429
* @see attachInterrupt
417430
* @see noInterrupts
418431
* @see interrupts
432+
* @webref
419433
*/
420434
public static void releaseInterrupt(int pin) {
421435
Thread t = irqThreads.get(pin);
@@ -443,6 +457,7 @@ public static void releaseInterrupt(int pin) {
443457
* state even after the sketch has been closed.
444458
* @param pin GPIO pin
445459
* @see pinMode
460+
* @webref
446461
*/
447462
public static void releasePin(int pin) {
448463
checkValidPin(pin);
@@ -471,6 +486,7 @@ public static void releasePin(int pin) {
471486
* @return true if the interrupt occured, false if the timeout occured
472487
* @see enableInterrupt
473488
* @see disableInterrupt
489+
* @webref
474490
*/
475491
public static boolean waitForInterrupt(int pin, int timeout) {
476492
checkValidPin(pin);
@@ -501,6 +517,7 @@ public static boolean waitForInterrupt(int pin, int timeout) {
501517
* @parm pin GPIO pin
502518
* @see enableInterrupt
503519
* @see disableInterrupt
520+
* @webref
504521
*/
505522
public static void waitForInterrupt(int pin) {
506523
waitForInterrupt(pin, -1);

java/libraries/io/src/processing/io/I2C.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import java.util.Arrays;
3030

3131

32+
/**
33+
* @webref
34+
*/
3235
public class I2C {
3336

3437
protected String dev;
@@ -43,6 +46,7 @@ public class I2C {
4346
*
4447
* @param dev device name
4548
* @see list
49+
* @webref
4650
*/
4751
public I2C(String dev) {
4852
NativeInterface.loadLibrary();
@@ -72,6 +76,7 @@ public I2C(String dev) {
7276
* @see write
7377
* @see read
7478
* @see endTransmission
79+
* @webref
7580
*/
7681
public void beginTransmission(int slave) {
7782
// addresses 120 (0x78) to 127 are additionally reserved
@@ -87,6 +92,7 @@ public void beginTransmission(int slave) {
8792

8893
/**
8994
* Closes the I2C device
95+
* @webref
9096
*/
9197
public void close() {
9298
NativeInterface.closeDevice(handle);
@@ -109,6 +115,7 @@ protected void finalize() throws Throwable {
109115
* This executes any queued writes.
110116
* @see beginTransmission
111117
* @see write
118+
* @webref
112119
*/
113120
public void endTransmission() {
114121
if (!transmitting) {
@@ -132,6 +139,7 @@ public void endTransmission() {
132139
/**
133140
* Lists all available I2C devices
134141
* @return String array
142+
* @webref
135143
*/
136144
public static String[] list() {
137145
ArrayList<String> devs = new ArrayList<String>();
@@ -162,6 +170,7 @@ public static String[] list() {
162170
* @see beginTransmission
163171
* @see write
164172
* @see endTransmission
173+
* @webref
165174
*/
166175
public byte[] read(int len) {
167176
if (!transmitting) {
@@ -194,6 +203,7 @@ public byte[] read(int len) {
194203
* @see beginTransmission
195204
* @see read
196205
* @see endTransmission
206+
* @webref
197207
*/
198208
public void write(byte[] out) {
199209
if (!transmitting) {
@@ -221,6 +231,7 @@ public void write(byte[] out) {
221231
* @see beginTransmission
222232
* @see read
223233
* @see endTransmission
234+
* @webref
224235
*/
225236
public void write(String out) {
226237
write(out.getBytes());
@@ -237,6 +248,7 @@ public void write(String out) {
237248
* @see beginTransmission
238249
* @see read
239250
* @see endTransmission
251+
* @webref
240252
*/
241253
public void write(int out) {
242254
if (out < 0 || 255 < out) {

java/libraries/io/src/processing/io/LED.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
import java.util.Arrays;
3333

3434

35+
/**
36+
* @webref
37+
*/
3538
public class LED {
3639

3740
protected String dev;
@@ -44,6 +47,7 @@ public class LED {
4447
* Opens a LED device
4548
* @param dev device name
4649
* @see list
50+
* @webref
4751
*/
4852
public LED(String dev) {
4953
NativeInterface.loadLibrary();
@@ -98,6 +102,7 @@ public LED(String dev) {
98102
/**
99103
* Sets the brightness
100104
* @param bright 0.0 (off) to 1.0 (maximum)
105+
* @webref
101106
*/
102107
public void brightness(float bright) {
103108
String fn = "/sys/class/leds/" + dev + "/brightness";
@@ -117,6 +122,7 @@ public void brightness(float bright) {
117122
*
118123
* Without calling this function the LED will remain in the current
119124
* state even after the sketch has been closed.
125+
* @webref
120126
*/
121127
public void close() {
122128
// restore previous settings
@@ -137,6 +143,7 @@ public void close() {
137143
/**
138144
* Lists all available LED devices
139145
* @return String array
146+
* @webref
140147
*/
141148
public static String[] list() {
142149
ArrayList<String> devs = new ArrayList<String>();

java/libraries/io/src/processing/io/PWM.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
import java.util.Arrays;
3333

3434

35+
/**
36+
* @webref
37+
*/
3538
public class PWM {
3639

3740
int channel;
@@ -42,6 +45,7 @@ public class PWM {
4245
* Opens a PWM channel
4346
* @param channel PWM channel
4447
* @see list
48+
* @webref
4549
*/
4650
public PWM(String channel) {
4751
NativeInterface.loadLibrary();
@@ -82,6 +86,7 @@ public PWM(String channel) {
8286

8387
/**
8488
* Disables the PWM output
89+
* @webref
8590
*/
8691
public void clear() {
8792
String fn = String.format("/sys/class/pwm/%s/gpio%d/enable", chip, channel);
@@ -97,6 +102,7 @@ public void clear() {
97102
*
98103
* Without calling this function the channel will remain in the current
99104
* state even after the sketch has been closed.
105+
* @webref
100106
*/
101107
public void close() {
102108
// XXX: implicit clear()?
@@ -118,6 +124,7 @@ public void close() {
118124
/**
119125
* Lists all available PWM channels
120126
* @return String array
127+
* @webref
121128
*/
122129
public static String[] list() {
123130
ArrayList<String> devs = new ArrayList<String>();
@@ -148,6 +155,7 @@ public static String[] list() {
148155
* Enables the PWM output
149156
* @param period cycle period in Hz
150157
* @param duty duty cycle, 0.0 (always off) to 1.0 (always on)
158+
* @webref
151159
*/
152160
public void set(int period, float duty) {
153161
// set period
@@ -184,6 +192,7 @@ public void set(int period, float duty) {
184192
* the Arduino Uno, which have a frequency of 980 Hz.
185193
* It is recommended to use set(period, duty) instead.
186194
* @param duty duty cycle, 0.0 (always off) to 1.0 (always on)
195+
* @webref
187196
*/
188197
public void set(float duty) {
189198
set(1000, duty);

java/libraries/io/src/processing/io/RPI.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
package processing.io;
2424

2525

26+
/**
27+
* @webref
28+
*/
2629
public class RPI {
2730

2831
/*

java/libraries/io/src/processing/io/SPI.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
import java.util.Map;
3232

3333

34+
/**
35+
* @webref
36+
*/
3437
public class SPI {
3538

3639
/**
@@ -70,6 +73,7 @@ public class SPI {
7073
* Opens an SPI interface
7174
* @param dev device name
7275
* @see list
76+
* @webref
7377
*/
7478
public SPI(String dev) {
7579
NativeInterface.loadLibrary();
@@ -83,6 +87,7 @@ public SPI(String dev) {
8387

8488
/**
8589
* Closes the SPI interface
90+
* @webref
8691
*/
8792
public void close() {
8893
NativeInterface.closeDevice(handle);
@@ -102,6 +107,7 @@ protected void finalize() throws Throwable {
102107
/**
103108
* Lists all available SPI interfaces
104109
* @return String array
110+
* @webref
105111
*/
106112
public static String[] list() {
107113
ArrayList<String> devs = new ArrayList<String>();
@@ -126,6 +132,7 @@ public static String[] list() {
126132
* @param maxSpeed maximum transmission rate in Hz, 500000 (500 kHz) is a resonable default
127133
* @param dataOrder whether data is send with the first- or least significant bit first (SPI.MSBFIRST or SPI.LSBFIRST, the former is more common)
128134
* @param mode SPI.MODE0 to SPI.MODE3 (see https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Clock_polarity_and_phase)
135+
* @webref
129136
*/
130137
public void settings(int maxSpeed, int dataOrder, int mode) {
131138
this.maxSpeed = maxSpeed;
@@ -142,6 +149,7 @@ public void settings(int maxSpeed, int dataOrder, int mode) {
142149
* one byte being read in.
143150
* @param out bytes to send
144151
* @return bytes read in (array is the same length as out)
152+
* @webref
145153
*/
146154
public byte[] transfer(byte[] out) {
147155
// track the current setting per device across multiple instances
@@ -174,6 +182,7 @@ public byte[] transfer(byte[] out) {
174182
* one byte being read in.
175183
* @param out string to send
176184
* @return bytes read in (array is the same length as out)
185+
* @webref
177186
*/
178187
public byte[] transfer(String out) {
179188
return transfer(out.getBytes());
@@ -188,6 +197,7 @@ public byte[] transfer(String out) {
188197
* one byte being read in.
189198
* @param out single byte to send
190199
* @return bytes read in (array is the same length as out)
200+
* @webref
191201
*/
192202
public byte[] transfer(int out) {
193203
if (out < 0 || 255 < out) {

0 commit comments

Comments
 (0)