[Tinyos-devel] platforms with 4 leds
Matt Welsh
mdw at eecs.harvard.edu
Fri Jun 22 17:58:21 PDT 2007
I actually think that fail-silent on turning on/off LEDs that don't
exist on your target platform is quite reasonable (maybe a #warn
directive would be good though).
On Jun 22, 2007, at 8:47 PM, Philip Levis wrote:
> On Jun 22, 2007, at 3:20 PM, Cory Sharp wrote:
>
>> Just my $0.02, but I've been using the "int as a bitvector" for
>> working with LEDs and I like it very much. The interface looks
>> something like this:
>>
>> // directly set the leds: off=false, true=on
>> command void set( uint16_t value );
>>
>> // turn on leds where mask is true
>> command void on( uint16_t mask );
>>
>> // turn off leds where mask is true
>> command void off( uint16_t mask );
>>
>> // toggle leds where mask is true
>> command void toggle( uint16_t mask );
>>
>> Cory
>>
>
> Currently there's already a set/get, so having an extended Leds
> interface with further bitmask operations wouldn't be a big deal.
> The one thing that would be nice is to have standard enums for the
> values, so that you can detect if your system requires LEDs that do
> not exist. E.g.:
>
> enum {
> LED0 = 1 << 0,
> LED1 = 1 << 1,
> LED2 = 1 << 2
> };
>
> Bitwise LED operations seems useful and totally reasonable. I'm
> very wary of fail-silent interfaces, though (e.g., you can call
> Leds.set(LED4) and just nothing will happen). A user should know
> that an application may not work as intended when they compile it.
>
> Phil
> _______________________________________________
> Tinyos-devel mailing list
> Tinyos-devel at Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/
> tinyos-devel
More information about the Tinyos-devel
mailing list