summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-05-20 15:57:23 +0000
committerChristian Pointner <equinox@spreadspace.org>2012-05-20 15:57:23 +0000
commitdc2c93c43950586099a30ea46cf33efd5cfe147c (patch)
treee19f95790af1c95826a84eb4e7efc2e8a8c11b8a
parentadded support for arduinoNG (diff)
added support for arduino2009v2, arduino10000, arduinoUno
git-svn-id: https://svn.spreadspace.org/avr/trunk@20 aa12f405-d877-488e-9caf-2d797e2a1cc7
-rw-r--r--blink/Makefile2
-rw-r--r--blink/led.c17
-rw-r--r--blink/util.c8
-rw-r--r--include.mk82
4 files changed, 72 insertions, 37 deletions
diff --git a/blink/Makefile b/blink/Makefile
index 6d9756d..75e423b 100644
--- a/blink/Makefile
+++ b/blink/Makefile
@@ -22,6 +22,6 @@
NAME := blink
OBJ := blink.o util.o led.o
-BOARD_TYPE := arduinoNG
+BOARD_TYPE := arduino2009
include ../include.mk
diff --git a/blink/led.c b/blink/led.c
index 0e9292e..ba4b681 100644
--- a/blink/led.c
+++ b/blink/led.c
@@ -23,12 +23,17 @@
#include "avr/io.h"
#include "led.h"
+#define HAS_LED 1
+#if defined(__BOARD_arduinoUno__)
+#define HAS_LED 0
+#endif
+
#define LED_DIR 1
#if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__)
#define LED_DIR 0
#endif
-#if defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__)
+#if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__)
#define LED_PORT PORTD
#define LED_DDR DDRD
#define LED_PINNUM 6
@@ -40,7 +45,7 @@
#define LED_PINNUM 6
#endif
-#if defined(__BOARD_arduino2009__) || defined(__BOARD_arduinoNG__)
+#if defined(__BOARD_arduino2009v2__) || defined(__BOARD_arduino2009__) || defined(__BOARD_arduino10000__) || defined(__BOARD_arduinoNG__)
#define LED_PORT PORTB
#define LED_DDR DDRB
#define LED_PINNUM 5
@@ -48,29 +53,37 @@
void led_init(void)
{
+#if HAS_LED == 1
led_off();
LED_DDR = 1<<LED_PINNUM;
+#endif
}
void led_on(void)
{
+#if HAS_LED == 1
#if LED_DIR == 1
LED_PORT |= 1<<LED_PINNUM;
#else
LED_PORT &= ~(1<<LED_PINNUM);
#endif
+#endif
}
void led_off(void)
{
+#if HAS_LED == 1
#if LED_DIR == 1
LED_PORT &= ~(1<<LED_PINNUM);
#else
LED_PORT |= 1<<LED_PINNUM;
#endif
+#endif
}
void led_toggle(void)
{
+#if HAS_LED == 1
LED_PORT ^= 1<<LED_PINNUM;
+#endif
}
diff --git a/blink/util.c b/blink/util.c
index 43e78ba..3b88dfc 100644
--- a/blink/util.c
+++ b/blink/util.c
@@ -23,12 +23,10 @@
#include "avr/io.h"
#include "util.h"
-#if defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || defined(__BOARD_hhd70dongle__) || defined(__BOARD_arduino2009__)
-#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
-#endif
-
-#if defined(__BOARD_arduinoNG__)
+#if defined(__AVR_ATmega8__)
#define CPU_PRESCALE(n)
+#else
+#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#endif
void cpu_init(void)
diff --git a/include.mk b/include.mk
index ed329b6..5e5aa89 100644
--- a/include.mk
+++ b/include.mk
@@ -21,45 +21,69 @@
##
ifeq ($(BOARD_TYPE),teensy1)
-MCU := at90usb162
-F_CPU := 16000000
-PROG := teensy
+ MCU := at90usb162
+ F_CPU := 16000000
+ PROG := teensy
endif
ifeq ($(BOARD_TYPE),teensy2)
-MCU := atmega32u4
-F_CPU := 16000000
-PROG := teensy
+ MCU := atmega32u4
+ F_CPU := 16000000
+ PROG := teensy
endif
-ifeq ($(BOARD_TYPE),teensypp1)
-MCU := at90usb646
-F_CPU := 16000000
-PROG := teensy
+ifeq ($(BOARD_TYPE),teensy1pp)
+ MCU := at90usb646
+ F_CPU := 16000000
+ PROG := teensy
endif
-ifeq ($(BOARD_TYPE),teensypp2)
-MCU := at90usb1286
-F_CPU := 16000000
-PROG := teensy
+ifeq ($(BOARD_TYPE),teensy2pp)
+ MCU := at90usb1286
+ F_CPU := 16000000
+ PROG := teensy
endif
ifeq ($(BOARD_TYPE),hhd70dongle)
-MCU := atmega32u4
-F_CPU := 16000000
-PROG := DFU
+ MCU := atmega32u4
+ F_CPU := 16000000
+ PROG := DFU
+endif
+ifeq ($(BOARD_TYPE),arduinoUno)
+ MCU := atmega328p
+ F_CPU := 16000000
+ PROG := avrdude
+ UPLOAD_RATE := 57600
+ PROG_TYPE := stk500v1
+ AVRDUDE_PORT := /dev/ttyUSB0
+endif
+ifeq ($(BOARD_TYPE),arduino2009v2)
+ MCU := atmega328p
+ F_CPU := 16000000
+ PROG := avrdude
+ UPLOAD_RATE := 57600
+ PROG_TYPE := stk500v1
+ AVRDUDE_PORT := /dev/ttyUSB0
endif
ifeq ($(BOARD_TYPE),arduino2009)
-MCU := atmega168
-F_CPU := 16000000
-PROG := avrdude
-UPLOAD_RATE := 19200
-PROG_TYPE := stk500v1
-AVRDUDE_PORT := /dev/ttyUSB0
+ MCU := atmega168
+ F_CPU := 16000000
+ PROG := avrdude
+ UPLOAD_RATE := 19200
+ PROG_TYPE := stk500v1
+ AVRDUDE_PORT := /dev/ttyUSB0
+endif
+ifeq ($(BOARD_TYPE),arduino10000)
+ MCU := atmega168
+ F_CPU := 16000000
+ PROG := avrdude
+ UPLOAD_RATE := 19200
+ PROG_TYPE := stk500v1
+ AVRDUDE_PORT := /dev/ttyUSB0
endif
ifeq ($(BOARD_TYPE),arduinoNG)
-MCU := atmega8
-F_CPU := 16000000
-PROG := avrdude
-UPLOAD_RATE := 19200
-PROG_TYPE := stk500v1
-AVRDUDE_PORT := /dev/ttyUSB0
+ MCU := atmega8
+ F_CPU := 16000000
+ PROG := avrdude
+ UPLOAD_RATE := 19200
+ PROG_TYPE := stk500v1
+ AVRDUDE_PORT := /dev/ttyUSB0
endif
CC = avr-gcc