Initial commit
[BABOOSHKA.TV] / leds.sh
1 #!/bin/bash
2
3 echo "leds on"
4
5 LEDS_CONTROL=/tmp/bbshk_leds
6 LED_BOOT=2
7 LED_VIDEO=0
8
9 # touch $LEDS_CONTROL
10 # gpio write $LED_BOOT 1
11
12 gpio mode 0 out         # II    green
13 gpio mode 2 out         # III   red
14
15 while [ 1 ]; do
16
17         LEDS_STATE=$(cat $LEDS_CONTROL)
18
19         case "$LEDS_STATE" in
20                 "BOOTCOMPLETE")
21                         gpio write $LED_BOOT 1
22                 ;;
23
24                 "NEWVIDEO")
25                         if [ -z $ONOFF ]; then 
26                                 gpio write $LED_VIDEO 0
27                                 ONOFF=1
28                         else 
29                                 gpio write $LED_VIDEO 1
30                                 ONOFF=''
31                         fi 
32                 ;;
33
34                 "VIDEOSTARTED")
35                         gpio write $LED_VIDEO 1
36                 ;;
37
38                 "VIDEOCOMPLETE")
39                         gpio write $LED_VIDEO 0
40                 ;;
41
42                 *) # booting
43                         echo $LEDS_STATE
44                         if [ -z $ONOFF ]; then 
45                                 gpio write $LED_BOOT 0
46                                 ONOFF=1
47                         else 
48                                 gpio write $LED_BOOT 1
49                                 ONOFF=''
50                         fi 
51                 ;;
52         esac 
53
54         sleep 0.5s
55 done
Contact me: dev (at) shalnoff (dot) com
PGP fingerprint: A6B8 3B23 6013 F18A 0C71 198B 83D8 C64D 917A 5717