slitaz-arm rev 189
Add Pibrella utility
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 15 21:40:05 2014 +0200 (2014-05-15) |
parents | ad488d58318b |
children | 968eda0ad1cf |
files | rpi/piborg/piborg rpi/pibrella sat-rpi |
line diff
1.1 --- a/rpi/piborg/piborg Thu May 15 18:57:11 2014 +0200 1.2 +++ b/rpi/piborg/piborg Thu May 15 21:40:05 2014 +0200 1.3 @@ -5,6 +5,11 @@ 1.4 . /lib/libtaz.sh 1.5 check_root 1.6 1.7 +# TurtleBorg.py must be installed manually or via spk 1.8 +if [ ! -x "/usr/bin/TurtleBorg.py" ]; then 1.9 + echo "Missing: TurtleBorg.py" && exit 1 1.10 +fi 1.11 + 1.12 usage() { 1.13 cat << EOT 1.14
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/rpi/pibrella Thu May 15 21:40:05 2014 +0200 2.3 @@ -0,0 +1,72 @@ 2.4 +#!/bin/sh 2.5 +# 2.6 +# Pibrella - SliTaz Raspberry Pibrella SHell utility 2.7 +# 2.8 +# (C) 2014 SliTaz GNU/Linux - BSD License 2.9 +# 2.10 +. /lib/libtaz.sh 2.11 +check_root 2.12 + 2.13 +sysfs="/sys/class/gpio" 2.14 + 2.15 +# Pibrella Pins 2.16 +led_red=27 2.17 +led_yellow=17 2.18 +led_green=4 2.19 + 2.20 +buzzer=18 2.21 + 2.22 +usage() { 2.23 + cat << EOT 2.24 + 2.25 +$(boldify 'Usage:') $(basename $0) [command] [color] [seconds|on|off] 2.26 + 2.27 +$(boldify 'Commands:') 2.28 + testsuite $(gettext 'Run a small testsuite on Pibrella') 2.29 + led $(gettext 'Turn on/off LEDs or on for N seconds') 2.30 + 2.31 +EOT 2.32 +} 2.33 + 2.34 +# Usage: export_pin NB --> librpigpio.sh 2.35 +export_pin() { 2.36 + if [ ! -d "${sysfs}/gpio${1}" ]; then 2.37 + echo ${1} > ${sysfs}/export 2.38 + fi 2.39 +} 2.40 + 2.41 +case "$1" in 2.42 + 2.43 + testsuite) 2.44 + # LEDs 2.45 + for pin in ${led_red} ${led_yellow} ${led_green} 2.46 + do 2.47 + export_pin ${pin} 2.48 + echo "out" > ${sysfs}/gpio${pin}/direction 2.49 + echo "1" > ${sysfs}/gpio${pin}/value 2.50 + sleep 2 2.51 + echo "0" > ${sysfs}/gpio${pin}/value 2.52 + done ;; 2.53 + 2.54 + led) 2.55 + case "$2" in 2.56 + r|red) pin=${led_red} ;; 2.57 + y|yellow) pin=${led_yellow} ;; 2.58 + g|green) pin= ${led_green} ;; 2.59 + esac 2.60 + case "$3" in 2.61 + on) echo "1" > ${sysfs}/gpio${pin}/value ;; 2.62 + off) echo "0" > ${sysfs}/gpio${pin}/value ;; 2.63 + *) 2.64 + sec="$3" 2.65 + [ "$sec" ] || sec=1 2.66 + echo "1" > ${sysfs}/gpio${pin}/value 2.67 + sleep ${sec} 2.68 + echo "0" > ${sysfs}/gpio${pin}/value ;; 2.69 + esac ;; 2.70 + 2.71 + *) 2.72 + usage ;; 2.73 + 2.74 +esac 2.75 +exit 0
3.1 --- a/sat-rpi Thu May 15 18:57:11 2014 +0200 3.2 +++ b/sat-rpi Thu May 15 21:40:05 2014 +0200 3.3 @@ -175,7 +175,8 @@ 3.4 fi 3.5 3.6 # TazBerry, Piboot, Pileds, ... 3.7 - for tool in tazberry piboot pileds raspicomm piface pitft-setup 3.8 + for tool in tazberry piboot pileds raspicomm piface pitft-setup \ 3.9 + pibrella piborg/piborg 3.10 do 3.11 echo -n "Copying utility: $tool" 3.12 cp -f ${rpi}/${tool} ${rootfs}/usr/sbin 3.13 @@ -241,8 +242,8 @@ 3.14 cd ${kernel} 3.15 export PATH=$PATH:/cross/${arch}/tools/bin 3.16 export HOST_SYSTEM=${arch}-slitaz-linux-gnueabi 3.17 - #make mrproper && 3.18 - #make ARCH=arm bcmrpi_defconfig 3.19 + make mrproper && 3.20 + make ARCH=arm bcmrpi_defconfig 3.21 if [ ! "$nopatch" ]; then 3.22 echo "Patching SliTaz RPi Linux .config" 3.23 patch -p0 -i ${data}/linux-rpi.patch || exit 1