The operation of Gpio in an embedded device is the most basic operation. The general practice is to write a separate driver, and most of the examples on the web are like this. In fact, there is a generic Gpio operating interface under Linux, that is, I want to introduce the "/sys/class/gpio" way.
First, see if there is a "/sys/class/gpio" folder in the system. If not, please add Device drivers-> GPIO support->/sys/class/gpio/When compiling the kernel ... (Sysfs interface).
The test is as follows:
1, obtain the GPIO information, and in the terminal, typed the following command:
[[email protected" GPIO]#  CD/ sys/
class
/gpio
If you want to operate GPIOD19, first you know that your chip discipline is 0-31 sort. So GPIOD0 is 3*32=96,gpiod19=96+19=115
2, enter the following command
[[email protected] gpio]# echo > Export  
Now we have the IO we want to manipulate
3, test
If we want to use this discipline to control the LEDs, then we need to set it to output
is set to high or low level.
Or
View the pin level
Operation Successful!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Linux Quick-Action IO port