summaryrefslogtreecommitdiff
path: root/blink
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-05-20 14:57:00 +0000
committerChristian Pointner <equinox@spreadspace.org>2012-05-20 14:57:00 +0000
commitfbd423f20cdd271268b1f27e82f168d5e4a435f1 (patch)
treea9d7eae2afd567089f81b6f31114b096ea33de27 /blink
parentgracefully ignore nonexisting or nonexecutable reset_func (diff)
added support for arduinoNG
git-svn-id: https://svn.spreadspace.org/avr/trunk@19 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'blink')
-rw-r--r--blink/Makefile6
-rw-r--r--blink/blink.c9
-rw-r--r--blink/led.c4
-rw-r--r--blink/led.h2
-rw-r--r--blink/util.c37
-rw-r--r--blink/util.h28
6 files changed, 75 insertions, 11 deletions
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