summarylogtreecommitdiffstats
path: root/atomicpi-hold-xmos
diff options
context:
space:
mode:
authorLeo P2020-01-14 15:44:43 -0500
committerLeo P2020-01-14 15:44:43 -0500
commitce76a12c0df524549800a3881a8118befa4159ad (patch)
treefb9fe4d95a0322e8ed75a25d5f22732dd4361a98 /atomicpi-hold-xmos
downloadaur-ce76a12c0df524549800a3881a8118befa4159ad.tar.gz
atomic pi utils
Diffstat (limited to 'atomicpi-hold-xmos')
-rwxr-xr-xatomicpi-hold-xmos20
1 files changed, 20 insertions, 0 deletions
diff --git a/atomicpi-hold-xmos b/atomicpi-hold-xmos
new file mode 100755
index 000000000000..fb6618fa6211
--- /dev/null
+++ b/atomicpi-hold-xmos
@@ -0,0 +1,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