Hi,
I'd always assumed that events can preempt events.
For example, in the below code, the event AMSend.sendDone should preempt
Timer1.fired (as Timer1.fired runs for a long time).
However, this is not happening.
Things do not change when I move the code inside Timer1.fired to a task, and
post this task from Timer1.fired.
So, do events preempt other events?
One more question:
Section 1.2.1 of the TinyOS programming book (2nd edition), mentions
"Low-level interrupt code".
How can I find the interrupt code that is related certain events such as
Timer.fired, AMSend.sendDone, and Sensor.readDone.
Thanks.
event void Boot.booted() {call AMControl.start(); }
event void AMControl.startDone(error_t err) {if (err == SUCCESS) {call
Timer0.startPeriodic(900); call Timer1.startPeriodic(1000); } else {call
AMControl.start();} }
event void AMControl.stopDone(error_t err) { }
event void Timer0.fired()
{
if (!busy)
{
BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)(call
Packet.getPayload(&pkt, NULL));
btrpkt->nodeid = TOS_NODE_ID;
btrpkt->counter = counter;
if (call AMSend.send(AM_BROADCAST_ADDR, &pkt,
sizeof(BlinkToRadioMsg)) == SUCCESS) {busy = TRUE;}
}
}
event void AMSend.sendDone(message_t* msg, error_t error) { if (&pkt ==
msg) {busy = FALSE;}}
event void Sensor.readDone(error_t result, uint16_t data) {}
event void Timer1.fired()
{
t=269;p=40;
for (t=0;t<100;t++){for (i=0;i<10000;i++){n+=p;n=0;n*=p+5;}}call
Leds.led0Toggle();
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help