天天看点

PX30-Android8.1-gpio控制

PX30-Android8.1-gpio控制

1、板子的接口简述:

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

其中

gpio

电压为

1.8V/3.3V

,可做输入/输出,默认

1.8V

2、代码设置

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 1

write /sys/class/gpio/export 45
write /sys/class/gpio/gpio45/direction out #gpio1 B5
write /sys/class/gpio/gpio45/value 1

write /sys/class/gpio/export 46
write /sys/class/gpio/gpio46/direction out
write /sys/class/gpio/gpio46/value 1

write /sys/class/gpio/export 47
write /sys/class/gpio/gpio47/direction out
write /sys/class/gpio/gpio47/value 1	
           

3、串口设置

gpio

,也可以用

ADB

来设置

```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  
           

继续阅读