Interface: tos.interfaces.Leds

interface Leds

Constants for manipulating LEDs.

Author:
Philip Levis
Date:
March 21, 2005

Commands
command uint8_t get() Get the current LED settings as a bitmask.
command void led0Off() Turn off LED 0.
command void led0On() Turn on LED 0.
command void led0Toggle() Toggle LED 0; if it was off, turn it on, if was on, turn it off.
command void led1Off() Turn off LED 1.
command void led1On() Turn on LED 1.
command void led1Toggle() Toggle LED 1; if it was off, turn it on, if was on, turn it off.
command void led2Off() Turn off LED 2.
command void led2On() Turn on LED 2.
command void led2Toggle() Toggle LED 2; if it was off, turn it on, if was on, turn it off.
command void set(uint8_t val) Set the current LED configuration using a bitmask.

Commands - Details

get

command uint8_t get()

Get the current LED settings as a bitmask. Each bit corresponds to whether an LED is on; bit 0 is LED 0, bit 1 is LED 1, etc. You can also use the enums LEDS_LED0, LEDS_LED1. For example, this expression will determine whether LED 2 is on:
 (call Leds.get() & LEDS_LED2) 
This command supports up to 8 LEDs; if a platform has fewer, then those LEDs should always be off (their bit is zero). Also see set().

Returns:
a bitmask describing which LEDs are on and which are off

led0Off

command void led0Off()

Turn off LED 0. The color of this LED depends on the platform.

led0On

command void led0On()

Turn on LED 0. The color of this LED depends on the platform.

led0Toggle

command void led0Toggle()

Toggle LED 0; if it was off, turn it on, if was on, turn it off. The color of this LED depends on the platform.

led1Off

command void led1Off()

Turn off LED 1. The color of this LED depends on the platform.

led1On

command void led1On()

Turn on LED 1. The color of this LED depends on the platform.

led1Toggle

command void led1Toggle()

Toggle LED 1; if it was off, turn it on, if was on, turn it off. The color of this LED depends on the platform.

led2Off

command void led2Off()

Turn off LED 2. The color of this LED depends on the platform.

led2On

command void led2On()

Turn on LED 2. The color of this LED depends on the platform.

led2Toggle

command void led2Toggle()

Toggle LED 2; if it was off, turn it on, if was on, turn it off. The color of this LED depends on the platform.

set

command void set(uint8_t val)

Set the current LED configuration using a bitmask. Each bit corresponds to whether an LED is on; bit 0 is LED 0, bit 1 is LED 1, etc. You can also use the enums LEDS_LED0, LEDS_LED1. For example, this statement will configure the LEDs so LED 0 and LED 2 are on:
 call Leds.set(LEDS_LED0 | LEDS_LED2); 
This statement will turn LED 1 on if it was not already:
call Leds.set(call Leds.get() | LEDS_LED1);

Parameters:
val - a bitmask describing the on/off settings of the LEDs