summaryrefslogtreecommitdiff
path: root/software/hhd70dongle
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-05-20 20:41:12 +0000
committerChristian Pointner <equinox@mur.at>2012-05-20 20:41:12 +0000
commit792d34f4e39b19bceeeb7dc3386ed824266ea807 (patch)
tree10e576646ec801abe0b89edeff34eb65b3e5d060 /software/hhd70dongle
parentrx fifo could have overflowed (diff)
updated avr utils from spreadspace (minor bugfixes)
git-svn-id: https://svn.spreadspace.org/mur.sat@459 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/hhd70dongle')
-rw-r--r--software/hhd70dongle/Makefile2
-rw-r--r--software/hhd70dongle/led.c23
-rw-r--r--software/hhd70dongle/led.h2
3 files changed, 21 insertions, 6 deletions
diff --git a/software/hhd70dongle/Makefile b/software/hhd70dongle/Makefile
index 65907fc..0f5441f 100644
--- a/software/hhd70dongle/Makefile
+++ b/software/hhd70dongle/Makefile
@@ -3,7 +3,7 @@
##
##
## Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org>
-##
+##
## This file is part of spreadspace teensy utils.
##
## spreadspace teensy utils is free software: you can redistribute it and/or modify
diff --git a/software/hhd70dongle/led.c b/software/hhd70dongle/led.c
index ced853f..c945564 100644
--- a/software/hhd70dongle/led.c
+++ b/software/hhd70dongle/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
@@ -23,12 +23,19 @@
#include "avr/io.h"
#include "led.h"
-#define LED_DIR 1
+#if defined(__BOARD_arduinoUno__)
+#define HAS_LED 0
+#else
+#define HAS_LED 1
+#endif
+
#if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__)
#define LED_DIR 0
+#else
+#define LED_DIR 1
#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 +47,7 @@
#define LED_PINNUM 6
#endif
-#if defined(__BOARD_arduino2009__)
+#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 +55,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/software/hhd70dongle/led.h b/software/hhd70dongle/led.h
index 0375828..12f00a8 100644
--- a/software/hhd70dongle/led.h
+++ b/software/hhd70dongle/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