slitaz-arm rev 163

Add pileds: a small tool to help using leds with SliTaz and the RPi
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 04 05:21:19 2014 +0200 (2014-05-04)
parents 3f264eb9c5a5
children 30194ae0cd16
files rpi/pileds sat-rpi
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rpi/pileds	Sun May 04 05:21:19 2014 +0200
     1.3 @@ -0,0 +1,57 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# PiLeds - Let play with leds has a kid :-)
     1.7 +# (C) 2014 SliTaz GNU/Linux - BSD License
     1.8 +#
     1.9 +. /lib/libtaz.sh
    1.10 +check_root
    1.11 +
    1.12 +usage() {
    1.13 +	cat << EOT
    1.14 +
    1.15 +$(boldify "Usage:") $(basename $0) [ledtype] [--option]
    1.16 +
    1.17 +$(boldify "Types:")
    1.18 +  act          Turn on/off the on board ACT green led
    1.19 +  7-clock      Adafruit 7-segment LED Backpack clock example
    1.20 +  #8x8          Adafruit 8x8 LED Matrix Backpack example
    1.21 +  
    1.22 +EOT
    1.23 +}
    1.24 +
    1.25 +load_modules() {
    1.26 +	modprobe i2c-bcm2708
    1.27 +	modprobe i2c-dev
    1.28 +}
    1.29 +
    1.30 +check_packages() {
    1.31 +	db="/var/lib/tazpkg/installed"
    1.32 +	for pkg in i2c-tools $@; do
    1.33 +		[ -f "$db/$pkg/receipt" ] || spk-add ${pkg}
    1.34 +	done
    1.35 +}
    1.36 +
    1.37 +case "$1" in
    1.38 +
    1.39 +	act) ;;
    1.40 +
    1.41 +	7-clock) 
    1.42 +		scripts="/usr/share/adafruit/LEDBackpack"
    1.43 +		load_modules 
    1.44 +		check_packages "python-rpi-adafruit-leds"
    1.45 +		if [ -f "${scripts}/ex_7segment_clock.py" ]; then
    1.46 +			python ${scripts}/ex_7segment_clock.py
    1.47 +			python /usr/lib/python2.7/Adafruit_LEDBackpack.py
    1.48 +		else
    1.49 +			echo "Missing: ${scripts}/ex_7segment_clock.py"
    1.50 +		fi ;;
    1.51 +	
    1.52 +	8x8)
    1.53 +		scripts="/usr/share/adafruit/LEDBackpack"
    1.54 +		#load_modules
    1.55 +		#check_packages "python-rpi-adafruit-leds"
    1.56 +		echo "TODO: $scripts" ;;
    1.57 +	
    1.58 +	*) usage ;;
    1.59 +	
    1.60 +esac && exit 0
     2.1 --- a/sat-rpi	Fri May 02 23:21:37 2014 +0200
     2.2 +++ b/sat-rpi	Sun May 04 05:21:19 2014 +0200
     2.3 @@ -174,17 +174,19 @@
     2.4  			status
     2.5  		fi
     2.6  		
     2.7 -		# TazBerry
     2.8 -		echo -n "Copying utility: TazBerry..."
     2.9 -		cp -f ${rpi}/tazberry ${rootfs}/usr/bin
    2.10 +		# TazBerry, Piboot, Pileds, ...
    2.11 +		for tool in tazberry piboot pileds
    2.12 +		do
    2.13 +			echo -n "Copying utility: $tool"
    2.14 +			cp -f ${rpi}/${tool} ${rootfs}/usr/bin
    2.15 +			status
    2.16 +		done
    2.17 +		
    2.18 +		# CGI Plugins
    2.19 +		echo -n "Copying CGI/adm plugins..."
    2.20  		cp -a ${rpi}/cgi-adm/* ${rootfs}/var/www/adm
    2.21  		status
    2.22  		
    2.23 -		# PiBoot
    2.24 -		echo -n "Copying bootloader: PiBoot..."
    2.25 -		cp -f ${rpi}/piboot ${rootfs}/sbin
    2.26 -		status
    2.27 -		
    2.28  		# Kernel at last
    2.29  		. $cache/linux-*-arm/receipt
    2.30  		kvers="$VERSION"
    2.31 @@ -225,7 +227,9 @@
    2.32  		# FBtft drivers for small touchscreens such PiTFT, PiScreen
    2.33  		if [ "$fbtft" ] && [ ! -d "${kernel}/drivers/video/fbtft" ]; then
    2.34  			cd ${kernel}/drivers/video
    2.35 -			git clone git://github.com/notro/fbtft.git
    2.36 +			#git clone git://github.com/notro/fbtft.git
    2.37 +			git clone https://github.com/adafruit/adafruit-rpi-fbtft
    2.38 +			mv adafruit-rpi-fbtft fbtft
    2.39  			cd ${kernel}
    2.40  			echo 'source "drivers/video/fbtft/Kconfig"' >> drivers/video/Kconfig
    2.41  			echo 'obj-y += fbtft/' >> drivers/video/Makefile