当前位置: 代码迷 >> 综合 >> PX30-Android8.1-gpio控制
  详细解决方案

PX30-Android8.1-gpio控制

热度:69   发布时间:2024-02-06 23:02:30.0

关于096GPIO的使用说明:

1、板子的接口简述:

VCC ---->3.3V/5V,默认3.3V
gpio ---->gpio45    
gpio ---->gpio46   
gpio ---->gpio47    
GND---->GND

其中gpio电压为1.8V/3.3V,可做输入/输出,默认1.8V

2、串口设置gpio


```c```c
```c
echo 45  > /sys/class/gpio/export                    //导出需要控制的引脚
echo out > /sys/class/gpio/gpio45/direction   //设置引脚的输出echo 1 >  /sys/class/gpio/gpio45/value        //输出高电平
//echo 0 > /sys/class/gpio/gpio45/value echo 46  > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio46/direction echo 1 >  /sys/class/gpio/gpio46/value  
//echo 0 > /sys/class/gpio/gpio46/value echo 47  > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio47/direction echo 1 >  /sys/class/gpio/gpio47/value  
//echo 0 > /sys/class/gpio/gpio47/value 

3、代码设置px30_android-8.1\device\rockchip\rk3326\init.rk3326.rc

write /sys/class/gpio/export 52
write /sys/class/gpio/gpio52/direction out #gpio1 C4
write /sys/class/gpio/gpio52/value 1write /sys/class/gpio/export 45
write /sys/class/gpio/gpio45/direction out #gpio1 B5
write /sys/class/gpio/gpio45/value 1write /sys/class/gpio/export 46
write /sys/class/gpio/gpio46/direction out
write /sys/class/gpio/gpio46/value 1write /sys/class/gpio/export 47
write /sys/class/gpio/gpio47/direction out
write /sys/class/gpio/gpio47/value 1