From e1059a9b15ec52c0605e5128adc916f2169b9d1b Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Mon, 22 Jun 2009 12:35:39 -0400 Subject: [PATCH] updated to use the leds on the RedBee hardware and made it a little more general. Signed-off-by: Mariano Alvira --- include/led.h | 13 +++++++++++++ tests/blink-blue.c | 7 +++++-- tests/blink-green.c | 7 +++++-- tests/blink-red.c | 7 +++++-- tests/blink-white.c | 7 +++++-- tests/rftest-rx.c | 9 ++++++--- tests/rftest-tx.c | 8 +++++--- tests/tmr-ints.c | 3 ++- tests/tmr.c | 7 +++++-- 9 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 include/led.h diff --git a/include/led.h b/include/led.h new file mode 100644 index 000000000..ce2798a48 --- /dev/null +++ b/include/led.h @@ -0,0 +1,13 @@ +#ifndef LED_H +#define LED_H + +#define LED_RED ((1 << 23) | (1 << 8)) +#define LED_GREEN ((1 << 24) | (1 << 9)) +#define LED_BLUE ((1 << 25) | (1 << 10)) + +#define LED_YELLOW (LED_RED | LED_GREEN ) +#define LED_PURPLE (LED_RED | LED_BLUE) +#define LED_CYAN ( LED_GREEN | LED_BLUE) +#define LED_WHITE (LED_RED | LED_GREEN | LED_BLUE) + +#endif diff --git a/tests/blink-blue.c b/tests/blink-blue.c index c732d9193..06699279d 100644 --- a/tests/blink-blue.c +++ b/tests/blink-blue.c @@ -6,17 +6,20 @@ #include "embedded_types.h" #include "isr.h" +#include "led.h" + +#define LED_BITS LED_BLUE __attribute__ ((section ("startup"))) void main(void) { - *(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000400; + *(volatile uint32_t *)GPIO_PAD_DIR0 = LED_BITS; volatile uint32_t i; while(1) { - *(volatile uint32_t *)GPIO_DATA0 = 0x00000400; + *(volatile uint32_t *)GPIO_DATA0 = LED_BITS; for(i=0; i>15) == 0) { continue; } reg16(TMR0_SCTRL) = 0; /*clear bit 15, and all the others --- should be ok, but clearly not "the right thing to do" */