"); //-->
看到了一片文章讲如何控制gpio的,先记录一下:
GPIOs and the Kernel
General
Purpose Input/Outputs (GPIOs) are described in detail in Chapter 6 and
in my previous articles/videos. These software-controlled input/outputs
can be controlled from Linux user space using the GPIO Sysfs Interface
(using a Linux shell directly or from within an executable), which
enables you to activate a GPIO and set its state. For example, to
activate the LED in Figure 1 using sysfs and turn the LED on/off, you
can perform the following steps (as superuser):
root@beaglebone:/sys/class/gpio# ls
export gpiochip0 gpiochip32 gpiochip64 gpiochip96 unexport
root@beaglebone:/sys/class/gpio# echo 49 > export
root@beaglebone:/sys/class/gpio# ls
export gpio49 gpiochip0 gpiochip32 gpiochip64 gpiochip96 unexport
root@beaglebone:/sys/class/gpio# cd gpio49
root@beaglebone:/sys/class/gpio/gpio49# ls
active_low direction edge power subsystem uevent value
root@beaglebone:/sys/class/gpio/gpio49# echo out > direction
root@beaglebone:/sys/class/gpio/gpio49# echo 1 > value
root@beaglebone:/sys/class/gpio/gpio49# echo 0 > value
root@beaglebone:/sys/class/gpio/gpio49# cd ..
root@beaglebone:/sys/class/gpio# echo 49 > unexport
root@beaglebone:/sys/class/gpio# ls
export gpiochip0 gpiochip32 gpiochip64 gpiochip96 unexport
貌似没有C语言调用的源码,不过用这个试也可以了 ;
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。