slitaz-arm view rpi/pileds @ rev 165
Add a clean command to pileds
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun May 04 06:00:37 2014 +0200 (2014-05-04) |
parents | 30194ae0cd16 |
children | 0eb0f35e2f0d |
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 ada-clean Clean: Adafruit 7-segment or 8x8 Matrix
19 $(boldify "Types:")
21 EOT
22 #8x8 Adafruit 8x8 LED Matrix Backpack example
23 }
25 load_modules() {
26 modprobe i2c-bcm2708
27 modprobe i2c-dev
28 }
30 check_packages() {
31 db="/var/lib/tazpkg/installed"
32 for pkg in i2c-tools $@; do
33 [ -f "$db/$pkg/receipt" ] || spk-add ${pkg}
34 done
35 }
37 adafruit_clean() {
38 python /usr/lib/python2.7/Adafruit_LEDBackpack.py
39 }
41 case "$1" in
43 act) ;;
45 7-clock)
46 scripts="/usr/share/adafruit/LEDBackpack"
47 load_modules
48 check_packages "python-rpi-adafruit"
49 if [ -f "${scripts}/ex_7segment_clock.py" ]; then
50 python ${scripts}/ex_7segment_clock.py
51 else
52 echo "Missing: ${scripts}/ex_7segment_clock.py"
53 fi ;;
55 8x8)
56 scripts="/usr/share/adafruit/LEDBackpack"
57 #load_modules
58 #check_packages "python-rpi-adafruit"
59 echo "TODO: $scripts" ;;
61 ada-clean)
62 ada_clean ;;
64 *) usage ;;
66 esac && exit 0