slitaz-arm view rpi/pileds @ rev 164

Small update to pileds
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 04 05:35:01 2014 +0200 (2014-05-04)
parents 6d06acbad1c5
children e90abb253448
line source
1 #!/bin/sh
2 #
3 # PiLeds - Let play with leds has a kid :-)
4 # (C) 2014 SliTaz GNU/Linux - BSD License
5 #
6 . /lib/libtaz.sh
7 check_root
9 usage() {
10 cat << EOT
12 $(boldify "Usage:") $(basename $0) [ledtype] [--option]
14 $(boldify "Types:")
15 act Turn on/off the on board ACT green led
16 7-clock Adafruit 7-segment LED Backpack clock example
17 #8x8 Adafruit 8x8 LED Matrix Backpack example
19 EOT
20 }
22 load_modules() {
23 modprobe i2c-bcm2708
24 modprobe i2c-dev
25 }
27 check_packages() {
28 db="/var/lib/tazpkg/installed"
29 for pkg in i2c-tools $@; do
30 [ -f "$db/$pkg/receipt" ] || spk-add ${pkg}
31 done
32 }
34 case "$1" in
36 act) ;;
38 7-clock)
39 scripts="/usr/share/adafruit/LEDBackpack"
40 load_modules
41 check_packages "python-rpi-adafruit"
42 if [ -f "${scripts}/ex_7segment_clock.py" ]; then
43 python ${scripts}/ex_7segment_clock.py
44 python /usr/lib/python2.7/Adafruit_LEDBackpack.py
45 else
46 echo "Missing: ${scripts}/ex_7segment_clock.py"
47 fi ;;
49 8x8)
50 scripts="/usr/share/adafruit/LEDBackpack"
51 #load_modules
52 #check_packages "python-rpi-adafruit"
53 echo "TODO: $scripts" ;;
55 *) usage ;;
57 esac && exit 0