Difference between revisions of "Rock/wiringX"
(Created page with "{{rock_header}} {{Languages|rock/flash_the_image}} __TOC__ WiringX is a modular approach to several GPIO interfaces. For Rock/pro/lite, wiringX provides interface for GPIO, I...") |
|||
Line 3: | Line 3: | ||
__TOC__ | __TOC__ | ||
− | WiringX is a modular approach to several GPIO interfaces. For Rock | + | 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 [https://github.com/wiringX/wiringX github]: | ||
'''git clone https://github.com/wiringX/wiringX.git''' | '''git clone https://github.com/wiringX/wiringX.git''' | ||
'''cd wiringX''' | '''cd wiringX''' | ||
Line 11: | Line 13: | ||
'''unzip master.zip''' | '''unzip master.zip''' | ||
'''cd wiringX-master''' | '''cd wiringX-master''' | ||
− | Then, install wiringX follow the way on | + | Then, install wiringX follow the way on [https://github.com/wiringX/wiringX 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) [http://radxa.com/Rock/extension_header 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 == | == 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);''' | ||
+ | |||
+ | |||
+ | |||
== I2C == | == I2C == |
Revision as of 03:33, 9 June 2015
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);