Hi, I'm reading the Execution Model Chapter of TinyOS programming book
recently.
I've got some difficulties in understanding the execution model of the
example application Blink.
As stated in the book, code is either synchronous or asynchronous.
And execution might be either a task or an interrupt handler.
When the hardware boots successfully, Boot.booted event is signaled.
While event booted is defined as synchronous in the Interface Boot, then
Boot.booted can not be invoked by an interrupt handler.
Therefore, it can only be a task. Or there is a 3rd kind of execution
(besides task and interrupt handler)?
I hope that some one can help to explain the execution model of the
application Blink for me.
Thanks in advance.
===================================================
//BlinkAppC.nc
configuration BlinkAppC
{
}
implementation
{
components MainC, BlinkC, LedsC;
components new TimerMilliC() as Timer0;
components new TimerMilliC() as Timer1;
components new TimerMilliC() as Timer2;
BlinkC -> MainC.Boot;
BlinkC.Timer0 -> Timer0;
BlinkC.Timer1 -> Timer1;
BlinkC.Timer2 -> Timer2;
BlinkC.Leds -> LedsC;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//BlinkC.nc
#include "Timer.h"
module BlinkC @safe()
{
uses interface Timer<TMilli> as Timer0;
uses interface Timer<TMilli> as Timer1;
uses interface Timer<TMilli> as Timer2;
uses interface Leds;
uses interface Boot;
}
implementation
{
event void Boot.booted()
{
call Timer0.startPeriodic( 250 );
call Timer1.startPeriodic( 500 );
call Timer2.startPeriodic( 1000 );
}
event void Timer0.fired()
{
dbg("BlinkC", "Timer 0 fired @ %s.\n", sim_time_string());
call Leds.led0Toggle();
}
event void Timer1.fired()
{
dbg("BlinkC", "Timer 1 fired @ %s \n", sim_time_string());
call Leds.led1Toggle();
}
event void Timer2.fired()
{
dbg("BlinkC", "Timer 2 fired @ %s.\n", sim_time_string());
call Leds.led2Toggle();
}
}
=====================================================
--
Thanks & Best Regards,
Mc
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help