| 1 | #!/bin/sh |
| 2 | |
| 3 | if [ "`id -u`" != "0" ]; then |
| 4 | exec sudo "${0}" "${@}" |
| 5 | fi |
| 6 | |
| 7 | echo "calling COC bootloader..." |
| 8 | if test ! -d /sys/class/gpio/gpio17; then echo 17 > /sys/class/gpio/export; fi |
| 9 | if test ! -d /sys/class/gpio/gpio18; then echo 18 > /sys/class/gpio/export; fi |
| 10 | echo out > /sys/class/gpio/gpio17/direction |
| 11 | echo out > /sys/class/gpio/gpio18/direction |
| 12 | echo 0 > /sys/class/gpio/gpio18/value |
| 13 | echo 0 > /sys/class/gpio/gpio17/value |
| 14 | sleep 1 |
| 15 | echo 1 > /sys/class/gpio/gpio17/value |
| 16 | sleep 1 |
| 17 | echo 1 > /sys/class/gpio/gpio18/value |
| 18 | |
| 19 | avrdude -v -p atmega1284p -P /dev/ttyAMA0 -b 38400 -c avr109 -U flash:w:COC.radio_only.hex |