summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blink/Makefile4
-rw-r--r--blink/led.c6
-rw-r--r--include.mk34
3 files changed, 38 insertions, 6 deletions
diff --git a/blink/Makefile b/blink/Makefile
index d598f2f..9ac5f8b 100644
--- a/blink/Makefile
+++ b/blink/Makefile
@@ -22,6 +22,8 @@
NAME := blink
OBJ := blink.o led.o
-BOARD_TYPE := teensy2
+BOARD_TYPE := arduino2009
include ../include.mk
+
+#AVRDUDE_PORT := /dev/arduino
diff --git a/blink/led.c b/blink/led.c
index 997edf0..ced853f 100644
--- a/blink/led.c
+++ b/blink/led.c
@@ -40,6 +40,12 @@
#define LED_PINNUM 6
#endif
+#if defined(__BOARD_arduino2009__)
+#define LED_PORT PORTB
+#define LED_DDR DDRB
+#define LED_PINNUM 5
+#endif
+
void led_init(void)
{
led_off();
diff --git a/include.mk b/include.mk
index f548e6d..fac4154 100644
--- a/include.mk
+++ b/include.mk
@@ -45,12 +45,21 @@ MCU := atmega32u4
F_CPU := 16000000
PROG := DFU
endif
+ifeq ($(BOARD_TYPE),arduino2009)
+MCU := atmega168
+F_CPU := 16000000
+PROG := avrdude
+UPLOAD_RATE := 19200
+PROG_TYPE := stk500v1
+AVRDUDE_PORT := /dev/ttyUSB0
+endif
CC = avr-gcc
OBJCOPY = avr-objcopy
DFU = dfu-programmer
teensy = teensy_loader_cli
+avrdude = avrdude
## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)
@@ -125,7 +134,7 @@ define DFU/run
$(DFU) $(MCU) start
endef
-### teensy-Programmer
+### teensy-loader
define teensy/erase
endef
@@ -139,15 +148,30 @@ endef
define teensy/run
endef
+### avrdude
+define avrdude/erase
+ $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -e
+endef
+
+define avrdude/program
+ $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -D -U flash:w:$1
+endef
+
+define avrdude/reset
+endef
+
+define avrdude/run
+endef
+
### Program Targets
erase:
- $(call $(PROG)/$@, )
+ $(call $(PROG)/$@,)
program: $(HEXFILE) erase
- $(call $(PROG)/$@, $(HEXFILE))
+ $(call $(PROG)/$@,$(HEXFILE))
reset:
- $(call $(PROG)/$@, )
+ $(call $(PROG)/$@,)
run:
- $(call $(PROG)/$@, )
+ $(call $(PROG)/$@,)