summaryrefslogtreecommitdiff
path: root/recipes/robostix-module/files/robostix.init
blob: 9bbd1d9e7ccc40f505e24156f2ef8dd1612dc2f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# Start the robostix
#

start() {
        echo "Starting robostix..."

        # Make sure ttyS2 is setup
        echo "AF2 in"  > /proc/gpio/GPIO46
        echo "AF1 out" > /proc/gpio/GPIO47

        # Turn on the robostix '245
        echo "GPIO out clear" > /proc/gpio/GPIO72

        # Turn on the robostix Power
        echo "GPIO out set" > /proc/gpio/GPIO70

        # load driver
        /sbin/modprobe robostix

        # Take the robostix out of reset
        echo "GPIO out set" > /proc/gpio/GPIO73

}
stop() {
        echo "Stopping robostix..."

        # Put the robostix into reset
        echo "GPIO out clear" > /proc/gpio/GPIO73 
}
restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?