chiark / gitweb /
fairphone-case: add DemoLeft and DemoSelectAdhocLeftRight
[reprap-play.git] / write-firmware
1 #!/bin/bash
2 set -e
3
4 usage () { echo 'usage: write-firmware FILE [PORT]'; }
5
6 home=/home/reprap/play
7 ourfile="$home/Marlin.hex"
8
9 infile="$1"
10
11 case $# in
12 1)   shift; port=/dev/ttyUSB0 ;;
13 2)   shift; port="$1"; shift ;;
14 *)   usage >&2; exit 1;;
15 esac
16
17 ad () {
18    avrdude -b 38400 -v -P $port -p atmega644P -c arduino "$@"
19 }
20
21 cp -v -- "$infile" "$ourfile"
22
23 ad "$@"
24 ad "$@" -U flash:w:$ourfile