Copyright © 2013 IBASE Technology Inc. All Rights Reserved.
57
IBASE Technology Inc.
5.2.
How to use GPIO in Linux
5.2.1.
GPIO Mapping Table
GPIO
Logical Number
Physical Number
0
40
1
41
2
42
3
43
4
44
5
45
6
46
7
47
8
201
9
202
5.2.2.
GPIO Sample Code
# GPIO example 1: Output (take GPIO 40 as example)
echo 32 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio40/direction
echo 0 > /sys/class/gpio/gpio40/value
echo 1 > /sys/class/gpio/gpio40/value
# GPIO example 2: Input (take GPIO 40 as example)
echo 32 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio40/direction
cat /sys/class/gpio/gpio40/value