Hardware Reference
In-Depth Information
Table 10-5. /sys/class/gpio/gpioX Objects
Object
Type
R/W
Values
Description
direction
File
R/W
in
Input pin
out
Output pin
high
Output & high
low
Output & low
value
File
R/W
0 or 1
Read or write
edge
File
R/W
None
No edge
Rising
Rising edge
Falling
Falling edge
Both
Rising or falling
active_low
File
R/W
0
Normal sense
1
Active low
uevent
File
subsystem
Symlink
Symlink to self
power
Directory
R
The values used for direction are worth expanding on:
Value
Description
in
GPIO becomes an input port.
out
GPIO becomes an output port (with some prior state).
high
GPIO becomes output, but in a 1 state (high).
low
GPIO becomes output, but in a 0 state (low).
The high and low options look like convenience frills, but they're not. Consider
configuring an output and setting it to 1:
# echo out >/sys/class/gpio/gpio7/direction
# echo 1 >/sys/class/gpio/gpio7/value
Some time will pass before the execution of the second command takes place to
establish the correct output level. If the GPIO output state was previously left in a zero
state, the GPIO 7 pin will reflect a 0 (low) until the second command completes. For
electronic devices operating in nanosecond time frames, this can be a problem.
 
Search WWH ::




Custom Search