Reincarnate the sensinode/cc2430 port
This commit is contained in:
parent
c78b5bad5c
commit
b7674c3636
114 changed files with 10044 additions and 3068 deletions
|
@ -6,14 +6,22 @@
|
|||
|
||||
/*
|
||||
* Sensinode v1.0 HW products have 2 red LEDs, LED1 is mapped to the Contiki
|
||||
* LEDS_RED and LED2 is mapped to LEDS_GREEN.
|
||||
* LEDS_GREEN and LED2 is mapped to LEDS_RED.
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
#ifdef MODEL_N740
|
||||
/*
|
||||
* We don't need explicit led initialisation for N740s. They are controlled
|
||||
* by the ser/par chip which is initalised already
|
||||
*/
|
||||
return;
|
||||
#else
|
||||
P0DIR |= 0x30;
|
||||
#endif
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
|
@ -21,29 +29,62 @@ leds_arch_get(void)
|
|||
{
|
||||
unsigned char l = 0;
|
||||
|
||||
if(LED1_PIN) {
|
||||
l |= LEDS_RED;
|
||||
}
|
||||
if(LED2_PIN) {
|
||||
#ifdef MODEL_N740
|
||||
/* Read the current ser-par chip status */
|
||||
uint8_t ser_par;
|
||||
ser_par = n740_ser_par_get();
|
||||
/* Check bits 7 & 8, ignore the rest */
|
||||
if(ser_par & N740_SER_PAR_LED_GREEN) {
|
||||
l |= LEDS_GREEN;
|
||||
}
|
||||
if(ser_par & N740_SER_PAR_LED_RED) {
|
||||
l |= LEDS_RED;
|
||||
}
|
||||
#else
|
||||
if(LED1_PIN) {
|
||||
l |= LEDS_GREEN;
|
||||
}
|
||||
if(LED2_PIN) {
|
||||
l |= LEDS_RED;
|
||||
}
|
||||
#endif
|
||||
return l;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(unsigned char leds)
|
||||
{
|
||||
#ifdef MODEL_N740
|
||||
/* Read the current ser-par chip status - we want to change bits 7 & 8 but
|
||||
* the remaining bit values should be retained */
|
||||
uint8_t ser_par;
|
||||
ser_par = n740_ser_par_get();
|
||||
if(leds & LEDS_GREEN) {
|
||||
ser_par |= N740_SER_PAR_LED_GREEN; /* Set bit 7 */
|
||||
} else {
|
||||
ser_par &= ~N740_SER_PAR_LED_GREEN; /* Unset bit 7 */
|
||||
}
|
||||
|
||||
if(leds & LEDS_RED) {
|
||||
ser_par |= N740_SER_PAR_LED_RED; /* Set bit 8 */
|
||||
} else {
|
||||
ser_par &= ~N740_SER_PAR_LED_RED; /* Unset bit 8 */
|
||||
}
|
||||
|
||||
/* Write the new status back to the chip */
|
||||
n740_ser_par_set(ser_par);
|
||||
#else
|
||||
if(leds & LEDS_GREEN) {
|
||||
LED1_PIN = 1;
|
||||
} else {
|
||||
LED1_PIN = 0;
|
||||
}
|
||||
|
||||
if(leds & LEDS_GREEN) {
|
||||
if(leds & LEDS_RED) {
|
||||
LED2_PIN = 1;
|
||||
} else {
|
||||
LED2_PIN = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue