Hi,
I have some TinyOS related questions!
Whats the difference between:
a.) signal event(...);
b.) atomic signal event(...);
What kind of code is more efficiency and what does the async event here mean?
a.)
async event void Int0.fired()
{
....
signal PHY.data_arrived();
}
event void PHY.data_arrived() {
uint16_t rcv_crc = 0;
uint16_t calc_crc = 0;
call PHY.extract(...); /// do memcpy, takes about 1-2ms
// calc checksum
rcv_crc = ....
calc_crc = call Crc.crc16(....);
// if checksum is correct we signal
if(rcv_crc == calc_crc)
{
atomic signal Radio.receive(...);
}
else
{
printf("crc wrong\n");
printfflush();
}
}
b.)
async event void Int0.fired()
{
....
signal PHY.data_arrived();
}
event void PHY.data_arrived() {
post task_data_arrived();
}
task void task_data_arrived() {
uint16_t rcv_crc = 0;
uint16_t calc_crc = 0;
call PHY.extract(...); /// do memcpy
// calc checksum
rcv_crc = ....
calc_crc = call Crc.crc16(....);
// if checksum is correct we signal
if(rcv_crc == calc_crc)
{
atomic signal Radio.receive(...);
}
else
{
printf("crc wrong\n");
printfflush();
}
}
--
NEU: FreePhone - kostenlos mobil telefonieren und surfen!
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help