removed obsolete leds_[color]() functions, replaced by leds_{on,off}()

allow LEDS_[COLOR] to be configured by platform-conf
This commit is contained in:
Fredrik Osterlind 2011-03-03 17:48:32 +01:00
parent bb86392ea0
commit dd7cec737d
5 changed files with 22 additions and 31 deletions

View file

@ -121,7 +121,3 @@ leds_invert(unsigned char ledv) {
show_leds(ledv); show_leds(ledv);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void leds_green(int o) { o?leds_on(LEDS_GREEN):leds_off(LEDS_GREEN); }
void leds_yellow(int o) { o?leds_on(LEDS_YELLOW):leds_off(LEDS_YELLOW); }
void leds_red(int o) { o?leds_on(LEDS_RED):leds_off(LEDS_RED); }
/*---------------------------------------------------------------------------*/

View file

@ -55,11 +55,18 @@ void leds_init(void);
*/ */
void leds_blink(void); void leds_blink(void);
#ifndef LEDS_GREEN
#define LEDS_GREEN 1 #define LEDS_GREEN 1
#define LEDS_YELLOW 2 #endif /* LEDS_GREEN */
#define LEDS_RED 4 #ifndef LEDS_YELLOW
#define LEDS_BLUE LEDS_YELLOW /* Tmote Sky is colorblind? */ #define LEDS_YELLOW 2
#define leds_blue leds_yellow #endif /* LEDS_YELLOW */
#ifndef LEDS_RED
#define LEDS_RED 4
#endif /* LEDS_RED */
#ifndef LEDS_BLUE
#define LEDS_BLUE LEDS_YELLOW
#endif /* LEDS_BLUE */
#ifdef LEDS_CONF_ALL #ifdef LEDS_CONF_ALL
#define LEDS_ALL LEDS_CONF_ALL #define LEDS_ALL LEDS_CONF_ALL
@ -76,18 +83,6 @@ void leds_off(unsigned char leds);
void leds_toggle(unsigned char leds); void leds_toggle(unsigned char leds);
void leds_invert(unsigned char leds); void leds_invert(unsigned char leds);
void leds_green(int onoroff);
void leds_red(int onoroff);
void leds_yellow(int onoroff);
#define LEDS_ON 1
#define LEDS_OFF 0
/** /**
* Leds implementation * Leds implementation
*/ */

View file

@ -111,7 +111,7 @@ loader_arch_load(unsigned short startaddr)
/* If the checksum was wrong, we beep. The number of beeps indicate /* If the checksum was wrong, we beep. The number of beeps indicate
the numerival value of the calculated checksum. */ the numerival value of the calculated checksum. */
if(sum != 0xff) { if(sum != 0xff) {
leds_red(LEDS_ON); leds_on(LEDS_RED);
for(i = 0; i < (sum >> 4); ++i) { for(i = 0; i < (sum >> 4); ++i) {
beep_beep(200); beep_beep(200);
@ -131,23 +131,23 @@ loader_arch_load(unsigned short startaddr)
} }
} }
leds_red(LEDS_OFF); leds_off(LEDS_RED);
return; return;
} else { } else {
leds_green(LEDS_ON); leds_on(LEDS_GREEN);
for(i = 0; i < 4; ++i) { for(i = 0; i < 4; ++i) {
beep_beep(200); beep_beep(200);
for(j = 0; j < 2; ++j) { for(j = 0; j < 2; ++j) {
clock_delay(60000); clock_delay(60000);
} }
} }
leds_green(LEDS_OFF); leds_off(LEDS_GREEN);
} }
leds_yellow(LEDS_ON); leds_on(LEDS_YELLOW);
startaddr += 2; startaddr += 2;
/* Read the size of the code segment from the next two bytes in EEPROM. */ /* Read the size of the code segment from the next two bytes in EEPROM. */
@ -185,9 +185,9 @@ loader_arch_load(unsigned short startaddr)
flash_done(); flash_done();
leds_yellow(LEDS_OFF); leds_off(LEDS_YELLOW);
leds_green(LEDS_ON); leds_on(LEDS_GREEN);
/* Read the size of the code segment from the first two bytes in EEPROM. */ /* Read the size of the code segment from the first two bytes in EEPROM. */
eeprom_read(startaddr + 2 + codelen, (char *)&datalen, 2); eeprom_read(startaddr + 2 + codelen, (char *)&datalen, 2);
@ -205,7 +205,7 @@ loader_arch_load(unsigned short startaddr)
clock_delay(20000); clock_delay(20000);
} }
leds_green(LEDS_OFF); leds_off(LEDS_GREEN);
/* Execute the loaded program. */ /* Execute the loaded program. */
init = ((void (*)(void *))FLASHADDR); init = ((void (*)(void *))FLASHADDR);

View file

@ -251,7 +251,7 @@ interrupt(TIMERB1_VECTOR) Timer_B1 (void) {
// reenable interrupt for falling edge // reenable interrupt for falling edge
P1IFG &= ~(0x04); P1IFG &= ~(0x04);
P1IE |= 0x04; // enable interrupt for recir RC5 P1IE |= 0x04; // enable interrupt for recir RC5
leds_red(LEDS_OFF); leds_off(LEDS_RED);
} }
ir_pos++; ir_pos++;
@ -280,7 +280,7 @@ ir_irq(void)
TBCCTL1 |= CCIE; // CCR0 interrupt enabled, interrupt occurs when timer equals CCR0 TBCCTL1 |= CCIE; // CCR0 interrupt enabled, interrupt occurs when timer equals CCR0
P1IE &= ~0x04; // disable interrupt for P12 ( ReceiveIR ) P1IE &= ~0x04; // disable interrupt for P12 ( ReceiveIR )
leds_red(LEDS_ON); leds_on(LEDS_RED);
//GREENON; //GREENON;
} }

View file

@ -159,7 +159,7 @@ contiki_main(int flag)
uip_fw_default(&meshif); uip_fw_default(&meshif);
} }
leds_green(LEDS_ON); leds_on(LEDS_GREEN);
rtimer_init(); rtimer_init();