This short tutorial describes how to get GPIO working. For this you need tool called gpioctl
.
make menucongfig
Utilities
select package gpioctl
and build carambola firmware (although you can do it directly on carambola typing opkg update; opkg install gpioctl
)gpioctl dirout 1; gpioctl dirout 2
gpioctl set 1; gpioctl set 2
gpioctl clear 1; gpioctl clear 2
gpioctl dirin 1; gpioctl dirin 2; gpioctl get 1; gpioctl get 2
Another method for controlling gpios using files instead of commands:
cd /sys/class/gpio echo 1 > export
this will make the virtual directory "gpio1" available in /sys/class/gpio/gpio1 inside "gpio1" you will find, among others:
Just write/read those file to do I/O. For example
echo out > direction echo 1 > value
will put the pin in output mode and high
echo in > direction cat value
will read the pin instead