I have previously used lemakers modified wiring pi on a bananapro but have decided now that I have slackwarearm hard float up and running that I will just use sysfs pin numbers. Seemed a bit silly to compile and run a program that assigns a number to something that already has a number. I have attached a .png with the pin numbering. All sysfs pin numbers have been confirmed correct with the script that follows below. These pin numbers will not work on a bananapi but sysfs pin numbers for the bananapi could be calculated using the same method described for the mainline kernel at:
http://http://linux-sunxi.org/GPIO
Code:
#!/bin/bash
##############################################################
# /usr/local/bin/test-gpio.sh RM20160728
#
# Used to test GPIO sysfs numbering on a Lemaker Banana Pro
# as per: https://linux-sunxi.org/GPIO
# This script is run as root
# Usage: /path/test-gpio.sh [pin number] [1] on [2] off
# Refer to: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
# for usage in mainline kernels
##############################################################
POWER_PIN=$1
ON_OFF=$2
echo "$POWER_PIN" > /sys/class/gpio/export 2> /dev/null
case "$2" in
'1') # on
echo "$POWER_PIN" > /sys/class/gpio/export 2> /dev/null
echo "out" > /sys/class/gpio/gpio$POWER_PIN/direction
echo "1" > /sys/class/gpio/gpio$POWER_PIN/value
;;
'0') # off
echo "0" > /sys/class/gpio/gpio$POWER_PIN/value
echo "$POWER_PIN" > /sys/class/gpio/unexport 2> /dev/null
;;
esac