On Sep 15, 2010, at 5:03 AM, Michiel Konstapel wrote:

>> I have some troubles implementing a parametrized interface of Timers.
> I
>> have used the code snippets from "Software design Patterns for  
>> Tinyos"
>> from Gay et al. and some hints online and from this mailing list.  
>> I am
>> attaching the complete code (it is basically the Blink application
> with
>> an array of 3 timers). When compiling, the error is:
>>
>> In component `BlinkC':
>> BlinkC.nc: In function `Boot.booted':
>> BlinkC.nc:51: Timers.startPeriodic not connected
>> BlinkC.nc:52: Timers.startPeriodic not connected
>> BlinkC.nc:53: Timers.startPeriodic not connected
>> make: *** [exe0] Error 1
>>
>> I found a hint on this mailing list from Phil Lewis that I need a
>> default implementation for the event, but this hint leads to yet
>> another compilation error, saying:
>>
>> In file included from BlinkAppC.nc:45:
>> In component `BlinkC':
>> BlinkC.nc:61: `fired' is defined, not used, in this component
>> BlinkC.nc:61: (default implementations are only for used commands or
>> events)
>> BlinkC.nc:61: conflicting types for `Timers.fired'
>> BlinkC.nc:56: previous declaration of `Timers.fired'
>> make: *** [exe0] Error 1
>
>
> You're close - you don't need a default implementation for the event,
> but for the startPeriodic command, because the compiler can't or  
> doesn't
> check you won't call startPeriodic() on a timer number that you didn't
> connect (since you only wire up 0, 1 and 2, and you might call
> Timers.startPeriodic[42] somewhere).
>
> If you add:
>
>       default command void Timers.startPeriodic[uint8_t id](uint32_t
> dt) {}
>
> to BlinkC, it should work.

Correct. A component needs defaults for functions it invokes that  
might not be wired.

Phil

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to