mirror of
https://github.com/processing/processing4.git
synced 2026-06-08 08:31:28 +02:00
Fixed indentation, and removed unnecessary templates from the doclet
This commit is contained in:
@@ -86,22 +86,22 @@ public class I2C {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transmission to an attached device.<br/>
|
||||
* <br/>
|
||||
* This function expects the address in the lower 7 bits, the same way as in
|
||||
* Arduino's Wire library, and as shown in the output of the i2cdetect tool. If
|
||||
* the address provided in a datasheet is greater than 127 (hex 0x7f) or there
|
||||
* are separate addresses for read and write operations listed, which vary
|
||||
* exactly by one, then you want to shift the this number by one bit to the
|
||||
* right before passing it as an argument to this function.
|
||||
*
|
||||
* @see write
|
||||
* @see read
|
||||
* @see endTransmission
|
||||
* @webref
|
||||
* @webBrief Begins a transmission to an attached device
|
||||
*/
|
||||
/**
|
||||
* Begins a transmission to an attached device.<br/>
|
||||
* <br/>
|
||||
* This function expects the address in the lower 7 bits, the same way as in
|
||||
* Arduino's Wire library, and as shown in the output of the i2cdetect tool. If
|
||||
* the address provided in a datasheet is greater than 127 (hex 0x7f) or there
|
||||
* are separate addresses for read and write operations listed, which vary
|
||||
* exactly by one, then you want to shift the this number by one bit to the
|
||||
* right before passing it as an argument to this function.
|
||||
*
|
||||
* @see write
|
||||
* @see read
|
||||
* @see endTransmission
|
||||
* @webref
|
||||
* @webBrief Begins a transmission to an attached device
|
||||
*/
|
||||
public void beginTransmission(int slave) {
|
||||
// addresses 120 (0x78) to 127 are additionally reserved
|
||||
if (0x78 <= slave) {
|
||||
@@ -114,18 +114,18 @@ public class I2C {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the I2C device<br/>
|
||||
* </br>
|
||||
* It is normally not necessary to explicitly close I2C interfaces, as they are
|
||||
* closed automatically by the operating system when the sketch exits.</br>
|
||||
* </br>
|
||||
* Note: It is possible to have two or more object using the same interface at a
|
||||
* time.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Closes the I2C device.
|
||||
*/
|
||||
/**
|
||||
* Closes the I2C device<br/>
|
||||
* </br>
|
||||
* It is normally not necessary to explicitly close I2C interfaces, as they are
|
||||
* closed automatically by the operating system when the sketch exits.</br>
|
||||
* </br>
|
||||
* Note: It is possible to have two or more object using the same interface at a
|
||||
* time.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Closes the I2C device.
|
||||
*/
|
||||
public void close() {
|
||||
if (NativeInterface.isSimulated()) {
|
||||
return;
|
||||
@@ -145,18 +145,18 @@ public class I2C {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ends the current transmissions<br/>
|
||||
* <br/>
|
||||
* This executes any queued writes. <a href="I2C_read_.html">Read()</a>
|
||||
* implicitly ends the current transmission as well, hence calling
|
||||
* endTransmission() afterwards is not necessary.
|
||||
*
|
||||
* @see beginTransmission
|
||||
* @see write
|
||||
* @webref
|
||||
* @webBrief Ends the current transmissions.
|
||||
*/
|
||||
/**
|
||||
* Ends the current transmissions<br/>
|
||||
* <br/>
|
||||
* This executes any queued writes. <a href="I2C_read_.html">Read()</a>
|
||||
* implicitly ends the current transmission as well, hence calling
|
||||
* endTransmission() afterwards is not necessary.
|
||||
*
|
||||
* @see beginTransmission
|
||||
* @see write
|
||||
* @webref
|
||||
* @webBrief Ends the current transmissions.
|
||||
*/
|
||||
public void endTransmission() {
|
||||
if (!transmitting) {
|
||||
// silently ignore this case
|
||||
@@ -209,22 +209,22 @@ public class I2C {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read bytes from the attached device<br/>
|
||||
* <br/>
|
||||
* You must call beginTransmission() before calling this function. This function
|
||||
* also ends the current transmission and sends any data that was queued using
|
||||
* write() before. It is not necessary to call
|
||||
* <a href="I2C_endTransmission_.html">endTransmission()</a> after read().
|
||||
*
|
||||
* @param len number of bytes to read
|
||||
* @return bytes read from device
|
||||
* @see beginTransmission
|
||||
* @see write
|
||||
* @see endTransmission
|
||||
* @webref
|
||||
* @webBrief Read bytes from the attached device.
|
||||
*/
|
||||
/**
|
||||
* Read bytes from the attached device<br/>
|
||||
* <br/>
|
||||
* You must call beginTransmission() before calling this function. This function
|
||||
* also ends the current transmission and sends any data that was queued using
|
||||
* write() before. It is not necessary to call
|
||||
* <a href="I2C_endTransmission_.html">endTransmission()</a> after read().
|
||||
*
|
||||
* @param len number of bytes to read
|
||||
* @return bytes read from device
|
||||
* @see beginTransmission
|
||||
* @see write
|
||||
* @see endTransmission
|
||||
* @webref
|
||||
* @webBrief Read bytes from the attached device.
|
||||
*/
|
||||
public byte[] read(int len) {
|
||||
if (!transmitting) {
|
||||
throw new RuntimeException("beginTransmisson has not been called");
|
||||
@@ -250,19 +250,19 @@ public class I2C {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add bytes to be written to the device<br/>
|
||||
* <br/>
|
||||
* You must call beginTransmission() before calling this function. The actual
|
||||
* writing takes part when read() or endTransmission() is being called.
|
||||
*
|
||||
* @param out bytes to be written
|
||||
* @see beginTransmission
|
||||
* @see read
|
||||
* @see endTransmission
|
||||
* @webref
|
||||
* @webBrief Add bytes to be written to the device.
|
||||
*/
|
||||
/**
|
||||
* Add bytes to be written to the device<br/>
|
||||
* <br/>
|
||||
* You must call beginTransmission() before calling this function. The actual
|
||||
* writing takes part when read() or endTransmission() is being called.
|
||||
*
|
||||
* @param out bytes to be written
|
||||
* @see beginTransmission
|
||||
* @see read
|
||||
* @see endTransmission
|
||||
* @webref
|
||||
* @webBrief Add bytes to be written to the device.
|
||||
*/
|
||||
public void write(byte[] out) {
|
||||
if (!transmitting) {
|
||||
throw new RuntimeException("beginTransmisson has not been called");
|
||||
|
||||
@@ -139,15 +139,15 @@ public class LED {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restores the previous state<br/>
|
||||
* <br/>
|
||||
* Without calling this function the LED will remain in the current state even
|
||||
* after the sketch has been closed.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Restores the previous state
|
||||
*/
|
||||
/**
|
||||
* Restores the previous state<br/>
|
||||
* <br/>
|
||||
* Without calling this function the LED will remain in the current state even
|
||||
* after the sketch has been closed.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Restores the previous state
|
||||
*/
|
||||
public void close() {
|
||||
if (NativeInterface.isSimulated()) {
|
||||
return;
|
||||
|
||||
@@ -110,15 +110,15 @@ public class PWM {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gives ownership of a channel back to the operating system<br/>
|
||||
* <br/>
|
||||
* Without calling this function the channel will remain in the current state
|
||||
* even after the sketch has been closed.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Gives ownership of a channel back to the operating system
|
||||
*/
|
||||
/**
|
||||
* Gives ownership of a channel back to the operating system<br/>
|
||||
* <br/>
|
||||
* Without calling this function the channel will remain in the current state
|
||||
* even after the sketch has been closed.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Gives ownership of a channel back to the operating system
|
||||
*/
|
||||
public void close() {
|
||||
if (NativeInterface.isSimulated()) {
|
||||
return;
|
||||
@@ -175,16 +175,16 @@ public class PWM {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enables the PWM output<br/>
|
||||
* <br/>
|
||||
* When no period is specified, a default 1 kHz (1000 Hz) is used.
|
||||
*
|
||||
* @param period cycle period in Hz
|
||||
* @param duty duty cycle, 0.0 (always off) to 1.0 (always on)
|
||||
* @webref
|
||||
* @webBrief Enables the PWM output
|
||||
*/
|
||||
/**
|
||||
* Enables the PWM output<br/>
|
||||
* <br/>
|
||||
* When no period is specified, a default 1 kHz (1000 Hz) is used.
|
||||
*
|
||||
* @param period cycle period in Hz
|
||||
* @param duty duty cycle, 0.0 (always off) to 1.0 (always on)
|
||||
* @webref
|
||||
* @webBrief Enables the PWM output
|
||||
*/
|
||||
public void set(int period, float duty) {
|
||||
if (NativeInterface.isSimulated()) {
|
||||
return;
|
||||
|
||||
@@ -113,18 +113,18 @@ public class SPI {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the SPI interface</br>
|
||||
* </br>
|
||||
* It is normally not necessary to explicitly close SPI interfaces, as they are
|
||||
* closed automatically by the operating system when the sketch exits.</br>
|
||||
* </br>
|
||||
* Note: It is possible to have two or more objects using the same interface at
|
||||
* a time.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Closes the SPI interface
|
||||
*/
|
||||
/**
|
||||
* Closes the SPI interface</br>
|
||||
* </br>
|
||||
* It is normally not necessary to explicitly close SPI interfaces, as they are
|
||||
* closed automatically by the operating system when the sketch exits.</br>
|
||||
* </br>
|
||||
* Note: It is possible to have two or more objects using the same interface at
|
||||
* a time.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Closes the SPI interface
|
||||
*/
|
||||
public void close() {
|
||||
if (NativeInterface.isSimulated()) {
|
||||
return;
|
||||
@@ -173,22 +173,22 @@ public class SPI {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configures the SPI interface<br/>
|
||||
* <br/>
|
||||
* The default setting is: 500000, SPI.MSBFIRST, SPI.MODE0
|
||||
*
|
||||
* @param maxSpeed maximum transmission rate in Hz, 500000 (500 kHz) is a
|
||||
* resonable default
|
||||
* @param dataOrder whether data is send with the first- or least-significant
|
||||
* bit first (SPI.MSBFIRST or SPI.LSBFIRST, the former is more
|
||||
* common)
|
||||
* @param mode <a href=
|
||||
* "https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Clock_polarity_and_phase">SPI.MODE0
|
||||
* to SPI.MODE3</a>
|
||||
* @webref
|
||||
* @webBrief Configures the SPI interface
|
||||
*/
|
||||
/**
|
||||
* Configures the SPI interface<br/>
|
||||
* <br/>
|
||||
* The default setting is: 500000, SPI.MSBFIRST, SPI.MODE0
|
||||
*
|
||||
* @param maxSpeed maximum transmission rate in Hz, 500000 (500 kHz) is a
|
||||
* resonable default
|
||||
* @param dataOrder whether data is send with the first- or least-significant
|
||||
* bit first (SPI.MSBFIRST or SPI.LSBFIRST, the former is more
|
||||
* common)
|
||||
* @param mode <a href=
|
||||
* "https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Clock_polarity_and_phase">SPI.MODE0
|
||||
* to SPI.MODE3</a>
|
||||
* @webref
|
||||
* @webBrief Configures the SPI interface
|
||||
*/
|
||||
public void settings(int maxSpeed, int dataOrder, int mode) {
|
||||
this.maxSpeed = maxSpeed;
|
||||
this.dataOrder = dataOrder;
|
||||
@@ -196,17 +196,17 @@ public class SPI {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transfers data over the SPI bus<br/>
|
||||
* <br/>
|
||||
* With SPI, data is simultaneously being exchanged between the master device
|
||||
* and the slave device. For every byte that is being sent out, there's also one
|
||||
* byte being read in.
|
||||
*
|
||||
* @param out bytes to send
|
||||
* @return bytes read in (array is the same length as out)
|
||||
* @webref Transfers data over the SPI bus
|
||||
*/
|
||||
/**
|
||||
* Transfers data over the SPI bus<br/>
|
||||
* <br/>
|
||||
* With SPI, data is simultaneously being exchanged between the master device
|
||||
* and the slave device. For every byte that is being sent out, there's also one
|
||||
* byte being read in.
|
||||
*
|
||||
* @param out bytes to send
|
||||
* @return bytes read in (array is the same length as out)
|
||||
* @webref Transfers data over the SPI bus
|
||||
*/
|
||||
public byte[] transfer(byte[] out) {
|
||||
if (NativeInterface.isSimulated()) {
|
||||
return new byte[out.length];
|
||||
|
||||
@@ -81,20 +81,20 @@ public class SoftwareServo {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attaches a servo motor to a GPIO pin<br/>
|
||||
* <br/>
|
||||
* You must call this function before calling write(). Note that the servo motor
|
||||
* will only be instructed to move after the first time write() is called.<br/>
|
||||
* <br/>
|
||||
* The optional parameters minPulse and maxPulse control the minimum and maximum
|
||||
* pulse width durations. The default values, identical to those of Arduino's
|
||||
* Servo class, should be compatible with most servo motors.
|
||||
*
|
||||
* @param pin GPIO pin
|
||||
* @webref
|
||||
* @webBrief Attaches a servo motor to a GPIO pin
|
||||
*/
|
||||
/**
|
||||
* Attaches a servo motor to a GPIO pin<br/>
|
||||
* <br/>
|
||||
* You must call this function before calling write(). Note that the servo motor
|
||||
* will only be instructed to move after the first time write() is called.<br/>
|
||||
* <br/>
|
||||
* The optional parameters minPulse and maxPulse control the minimum and maximum
|
||||
* pulse width durations. The default values, identical to those of Arduino's
|
||||
* Servo class, should be compatible with most servo motors.
|
||||
*
|
||||
* @param pin GPIO pin
|
||||
* @webref
|
||||
* @webBrief Attaches a servo motor to a GPIO pin
|
||||
*/
|
||||
public void attach(int pin) {
|
||||
detach();
|
||||
this.pin = pin;
|
||||
@@ -117,19 +117,19 @@ public class SoftwareServo {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Moves a servo motor to a given orientation<br/>
|
||||
* <br/>
|
||||
* If you are using this class in combination with a continuous rotation servo,
|
||||
* different angles will result in the servo rotating forward or backward at
|
||||
* different speeds. For regular servo motors, this will instruct the servo to
|
||||
* rotate to and hold a specific angle.
|
||||
*
|
||||
* @param angle angle in degrees (controls speed and direction on
|
||||
* continuous-rotation servos)
|
||||
* @webref
|
||||
* @webBrief Moves a servo motor to a given orientation
|
||||
*/
|
||||
/**
|
||||
* Moves a servo motor to a given orientation<br/>
|
||||
* <br/>
|
||||
* If you are using this class in combination with a continuous rotation servo,
|
||||
* different angles will result in the servo rotating forward or backward at
|
||||
* different speeds. For regular servo motors, this will instruct the servo to
|
||||
* rotate to and hold a specific angle.
|
||||
*
|
||||
* @param angle angle in degrees (controls speed and direction on
|
||||
* continuous-rotation servos)
|
||||
* @webref
|
||||
* @webBrief Moves a servo motor to a given orientation
|
||||
*/
|
||||
public void write(float angle) {
|
||||
if (attached() == false) {
|
||||
System.err.println("You need to call attach(pin) before write(angle).");
|
||||
@@ -173,15 +173,15 @@ public class SoftwareServo {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detatches a servo motor from a GPIO pin<br/>
|
||||
* <br/>
|
||||
* Calling this method will stop the servo from moving or trying to hold the
|
||||
* current orientation.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Detatches a servo motor from a GPIO pin
|
||||
*/
|
||||
/**
|
||||
* Detatches a servo motor from a GPIO pin<br/>
|
||||
* <br/>
|
||||
* Calling this method will stop the servo from moving or trying to hold the
|
||||
* current orientation.
|
||||
*
|
||||
* @webref
|
||||
* @webBrief Detatches a servo motor from a GPIO pin
|
||||
*/
|
||||
public void detach() {
|
||||
if (0 <= handle) {
|
||||
// stop thread
|
||||
|
||||
Reference in New Issue
Block a user