Title: FirePrime-RK3128 Android app use jni to control GPIO code [Print This Page] Author: Firefly Time: 10/12/2015 17:11 Title: FirePrime-RK3128 Android app use jni to control GPIO code Sharing by carlinluo
// The runtime will add "lib" on the front and ".o" on the end of
// the name supplied to loadLibrary.
System.loadLibrary("app");
}
public native int add(int a, int b);
public native int openGpioDev();
public native int closeGpioDev();
public native int getGpio(int num);
public native int releaseGpio(int num);
public native int setGpioState(int num,int state);
}
Copy the code
Wrote a simple app, you can control GPIO by the following method , DO remember to give permissions to driven node first.
adb root ->adb shell chmod 777 dev/luobogpio
public native int openGpioDev();
public native int closeGpioDev();
public native int getGpio(int num);
public native int releaseGpio(int num);
public native int setGpioState(int num,int state);
Welcome Firefly Open Source Community (https://bbs.t-firefly.com/)