Rock/wiringX
Contents
WiringX is a modular approach to several GPIO interfaces. Till now, it supports five platforms: Raspberry Pi, Hummingboard, BananaPi, Radxa Rock and MIPS CI20 Creator. For Radxa Rock(pro/lite), wiringX provides interfaces for GPIO, I2C, SPI and ISR. You can easily use these function on Rock through wiringX.
Firstly, you can get wiringX from github:
git clone https://github.com/wiringX/wiringX.git cd wiringX
or
wget https://github.com/wiringX/wiringX/archive/master.zip unzip master.zip cd wiringX-master
Then, install wiringX follow the way on github.
When you compile you source code, add the static lib like:
gcc -o test test.c /usr/local/lib/libwiringX.a ./test
WiringX is running on your board!
Pin Number Defined in WiringX
You can find pin numbers for Radxa Rock(pro/lite) here. However, only those pins that can be used as GPIO are valid in wiringX. Thus, for J8, totally 21 pins can be used (number defined as 0-20) and for J12/15, 8 pins can be used (number 25-32). Besides, 3 onboard LEDs can be used on pin number 33-35.
GPIO
WiringX provide digitalread and digitalwrite to a pin, after you set it as input/output using pinMode: wiringXSetup(); pinMode(0, OUTPUT); digitalWrite(0, HIGH);