Skip to content

Commit 4d583ab

Browse files
committed
I/O: Remove GPIO.delay(), GPIO.delayMicroseconds()
Ben pointed out that there already is a delay in PApplet. Note: functions still need to be deleted from processing-docs.
1 parent 4c94d1e commit 4d583ab

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

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

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -167,54 +167,6 @@ protected static void checkValidPin(int pin) {
167167
}
168168

169169

170-
/**
171-
* Pauses the execution of the sketch
172-
*
173-
* Calling this function will have an influence on the framerate
174-
* the sketch is going to achieve.
175-
* @param ms milliseconds to pause
176-
*/
177-
public static void delay(int ms) {
178-
try {
179-
Thread.sleep(ms);
180-
} catch (InterruptedException e) {
181-
}
182-
}
183-
184-
185-
/**
186-
* Pauses the execution of the sketch
187-
*
188-
* Note: Both the operating system, as well as Processing, are not what is
189-
* called "hard real-time" systems. In other words: there are many factors,
190-
* outside of the control of the programmer, which can influence the execution
191-
* of the program in minute ways. Those are generally not an issue, or even
192-
* noticeable using a desktop operating system, but they can be a factor, when
193-
* the timing of a particular sequence of events is critical. For example, one
194-
* might to wait a very specific number amount of time after receiving an
195-
* interrupt before changing the state of an output pin. When programming with
196-
* micro-controllers, as found on the Arduino Uno, there very little between
197-
* your code and the actual hardware, and multiple executions of the same
198-
* sketch will probably match each other almost to the very tick of a clock
199-
* (which happens at the speed of 16 MHz). Systems running full-fledged
200-
* desktop operating systems, such as Linux, are generally multi-tasking,
201-
* which means that the operating system allocates small slices of time to
202-
* the many different processes that run concurrently. The effect of this is
203-
* often offset by the sheer clock speeds that such computers run. But
204-
* regardless: if you require your sketch to adhere to a very specific timing,
205-
* you might be disappointed.
206-
* @param us microseconds to pause
207-
*/
208-
public static void delayMicroseconds(int us) {
209-
int ms = (int)(us / 1000);
210-
int ns = (us - (ms * 1000)) * 1000;
211-
try {
212-
Thread.sleep(ms, ns);
213-
} catch (InterruptedException e) {
214-
}
215-
}
216-
217-
218170
/**
219171
* Returns the value of an input pin
220172
*

0 commit comments

Comments
 (0)