slitaz-arm annotate 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 |
rev | line source |
---|---|
pankso@163 | 1 #!/bin/sh |
pankso@163 | 2 # |
pankso@163 | 3 # PiLeds - Let play with leds has a kid :-) |
pankso@163 | 4 # (C) 2014 SliTaz GNU/Linux - BSD License |
pankso@163 | 5 # |
pankso@163 | 6 . /lib/libtaz.sh |
pankso@163 | 7 check_root |
pankso@163 | 8 |
pankso@163 | 9 usage() { |
pankso@163 | 10 cat << EOT |
pankso@163 | 11 |
pankso@163 | 12 $(boldify "Usage:") $(basename $0) [ledtype] [--option] |
pankso@163 | 13 |
pankso@163 | 14 $(boldify "Types:") |
pankso@163 | 15 act Turn on/off the on board ACT green led |
pankso@163 | 16 7-clock Adafruit 7-segment LED Backpack clock example |
pankso@165 | 17 ada-clean Clean: Adafruit 7-segment or 8x8 Matrix |
pankso@165 | 18 |
pankso@165 | 19 $(boldify "Types:") |
pankso@165 | 20 |
pankso@163 | 21 EOT |
pankso@165 | 22 #8x8 Adafruit 8x8 LED Matrix Backpack example |
pankso@163 | 23 } |
pankso@163 | 24 |
pankso@163 | 25 load_modules() { |
pankso@163 | 26 modprobe i2c-bcm2708 |
pankso@163 | 27 modprobe i2c-dev |
pankso@163 | 28 } |
pankso@163 | 29 |
pankso@163 | 30 check_packages() { |
pankso@163 | 31 db="/var/lib/tazpkg/installed" |
pankso@163 | 32 for pkg in i2c-tools $@; do |
pankso@163 | 33 [ -f "$db/$pkg/receipt" ] || spk-add ${pkg} |
pankso@163 | 34 done |
pankso@163 | 35 } |
pankso@163 | 36 |
pankso@165 | 37 adafruit_clean() { |
pankso@165 | 38 python /usr/lib/python2.7/Adafruit_LEDBackpack.py |
pankso@165 | 39 } |
pankso@165 | 40 |
pankso@163 | 41 case "$1" in |
pankso@163 | 42 |
pankso@163 | 43 act) ;; |
pankso@163 | 44 |
pankso@163 | 45 7-clock) |
pankso@163 | 46 scripts="/usr/share/adafruit/LEDBackpack" |
pankso@163 | 47 load_modules |
pankso@164 | 48 check_packages "python-rpi-adafruit" |
pankso@163 | 49 if [ -f "${scripts}/ex_7segment_clock.py" ]; then |
pankso@163 | 50 python ${scripts}/ex_7segment_clock.py |
pankso@163 | 51 else |
pankso@163 | 52 echo "Missing: ${scripts}/ex_7segment_clock.py" |
pankso@163 | 53 fi ;; |
pankso@163 | 54 |
pankso@163 | 55 8x8) |
pankso@163 | 56 scripts="/usr/share/adafruit/LEDBackpack" |
pankso@163 | 57 #load_modules |
pankso@164 | 58 #check_packages "python-rpi-adafruit" |
pankso@163 | 59 echo "TODO: $scripts" ;; |
pankso@165 | 60 |
pankso@165 | 61 ada-clean) |
pankso@165 | 62 ada_clean ;; |
pankso@163 | 63 |
pankso@163 | 64 *) usage ;; |
pankso@163 | 65 |
pankso@163 | 66 esac && exit 0 |