#!/bin/bash
# script to program 328p device using AVRDUDE and a hex file
if [ "$1" == "" ]; then
  echo Missing argument 
  exit 1;
fi 
# if ends in .hex use full argument
# otherwise add the .hex
ext=${1:${#1}-4}
if [ "$ext" == ".hex" ]; then
  /usr/bin/avrdude -c gpio -p m328p $1 -Uflash:w:$1
else
  /usr/bin/avrdude -c gpio -p m328p $1.hex -Uflash:w:$1.hex
fi

