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" */