diff options
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | blink/Makefile | 6 | ||||
-rw-r--r-- | blink/blink.c | 9 | ||||
-rw-r--r-- | blink/led.c | 4 | ||||
-rw-r--r-- | blink/led.h | 2 | ||||
-rw-r--r-- | blink/util.c | 37 | ||||
-rw-r--r-- | blink/util.h | 28 | ||||
-rw-r--r-- | include.mk | 10 |
8 files changed, 85 insertions, 13 deletions
@@ -3,7 +3,7 @@ * * * Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org> - * + * * This file is part of spreadspace avr utils. * * spreadspace avr utils is free software: you can redistribute it and/or modify diff --git a/blink/Makefile b/blink/Makefile index d598f2f..6d9756d 100644 --- a/blink/Makefile +++ b/blink/Makefile @@ -3,7 +3,7 @@ ##
##
## Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org>
-##
+##
## This file is part of spreadspace avr utils.
##
## spreadspace avr utils is free software: you can redistribute it and/or modify
@@ -21,7 +21,7 @@ ##
NAME := blink
-OBJ := blink.o led.o
-BOARD_TYPE := teensy2
+OBJ := blink.o util.o led.o
+BOARD_TYPE := arduinoNG
include ../include.mk
diff --git a/blink/blink.c b/blink/blink.c index 86a60f0..94c7bfb 100644 --- a/blink/blink.c +++ b/blink/blink.c @@ -3,7 +3,7 @@ *
*
* Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org>
- *
+ *
* This file is part of spreadspace avr utils.
*
* spreadspace avr utils is free software: you can redistribute it and/or modify
@@ -23,13 +23,12 @@ #include "avr/io.h"
#include "util/delay.h"
+#include "util.h"
#include "led.h"
-#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
-
int main(void)
-{
- CPU_PRESCALE(0);
+{
+ cpu_init();
led_init();
for(;;) {
diff --git a/blink/led.c b/blink/led.c index ced853f..0e9292e 100644 --- a/blink/led.c +++ b/blink/led.c @@ -3,7 +3,7 @@ * * * Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org> - * + * * This file is part of spreadspace avr utils. * * spreadspace avr utils is free software: you can redistribute it and/or modify @@ -40,7 +40,7 @@ #define LED_PINNUM 6 #endif -#if defined(__BOARD_arduino2009__) +#if defined(__BOARD_arduino2009__) || defined(__BOARD_arduinoNG__) #define LED_PORT PORTB #define LED_DDR DDRB #define LED_PINNUM 5 diff --git a/blink/led.h b/blink/led.h index 0375828..12f00a8 100644 --- a/blink/led.h +++ b/blink/led.h @@ -3,7 +3,7 @@ * * * Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org> - * + * * This file is part of spreadspace avr utils. * * spreadspace avr utils is free software: you can redistribute it and/or modify diff --git a/blink/util.c b/blink/util.c new file mode 100644 index 0000000..43e78ba --- /dev/null +++ b/blink/util.c @@ -0,0 +1,37 @@ +/* + * spreadspace avr utils + * + * + * Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org> + * + * This file is part of spreadspace avr utils. + * + * spreadspace avr utils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * spreadspace avr utils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. + */ + +#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__) +#define CPU_PRESCALE(n) +#endif + +void cpu_init(void) +{ + CPU_PRESCALE(0); +} diff --git a/blink/util.h b/blink/util.h new file mode 100644 index 0000000..15204b1 --- /dev/null +++ b/blink/util.h @@ -0,0 +1,28 @@ +/* + * spreadspace avr utils + * + * + * Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org> + * + * This file is part of spreadspace avr utils. + * + * spreadspace avr utils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * spreadspace avr utils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SPREADSPACE_util_h_INCLUDED +#define SPREADSPACE_util_h_INCLUDED + +void cpu_init(void); + +#endif @@ -3,7 +3,7 @@ ## ## ## Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org> -## +## ## This file is part of spreadspace avr utils. ## ## spreadspace avr utils is free software: you can redistribute it and/or modify @@ -53,6 +53,14 @@ 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 +endif CC = avr-gcc OBJCOPY = avr-objcopy |