summarylogtreecommitdiffstats
path: root/atomicpi-hold-xmos
blob: fb6618fa6211c175b3ad6eeee8f6177a6d924a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

. /usr/lib/atomicpi.sh

if [ "$1" = "--cleanup" ] || ! lsusb -d 20b1: ; then
    # If XMOS hasn't initialized, first pull the reset line low to
    # give it a nice voltage ramp.
    atomicpi_gpio_hardware && gpioset --mode=time --us=200000 $ATOMICPICHIP_XMOS_RESET=0
fi

if [ -z "$1" ]; then
    # Hold reset high
    if atomicpi_gpio_hardware; then
        exec gpioset --mode=signal $ATOMICPICHIP_XMOS_RESET=1
    else
        while true; do
            sleep 2147483647;
        done
    fi
fi