RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
GPIOInterface.java
1
package
robotCore;
2
3
import
com.pi4j.context.Context;
4
import
com.pi4j.io.gpio.digital.DigitalOutput;
5
import
com.pi4j.io.gpio.digital.DigitalState;
6
14
public
class
GPIOInterface {
15
private
static
final
int
RESET_PIN_BCM = 18;
// physical pin 12 (was RaspiPin.GPIO_01)
16
17
private
final
DigitalOutput
m_resetPin;
18
19
public
GPIOInterface() {
20
Context pi4j = Pi4JContext.get();
21
String
id
=
"reset"
;
22
23
// Pi4J requires unique IDs, so reuse the pin if it was already created.
24
if
(pi4j.registry().exists(
id
)) {
25
m_resetPin = pi4j.registry().get(
id
,
DigitalOutput
.class);
26
m_resetPin.high();
27
}
else
{
28
m_resetPin = pi4j.create(
DigitalOutput
.newConfigBuilder(pi4j)
29
.id(
id
)
30
.name(
"Reset"
)
31
.bcm(RESET_PIN_BCM)
32
.initial(DigitalState.HIGH)
33
.shutdown(DigitalState.HIGH)
34
.build());
35
}
36
}
37
38
public
void
setReset(
boolean
high) {
39
if
(high) {
40
m_resetPin.high();
41
}
else
{
42
m_resetPin.low();
43
}
44
}
45
}
robotCore.DigitalOutput
Controls the state of one Arduino digital pin.
Definition
DigitalOutput.java:12
robotCore
GPIOInterface.java
Generated by
1.18.0