Btw,
for you, is it better using threads to do blocking Reads or however simulate
them?
I think using ReadNow is a good solution.
Thanks again,
Antonio

----------------------------------------------------------------------------
---

Hi All,
I need a way to make a blocking Read from internal sensors in TinyOS. I'm
using Telosb Tmote-sky.

My friend found a way to simulate blocking Read and I would like to know
your opinion about it.

I wire my software to ReadNow<uint16_t> interface and Resource interface
from Msp430InternalVoltageC;
In the boot of the software I call Resource.request();
When a Timer fires, if Resource.request is granted, I call ReadNow.read();

So, I make a while on a bool value:
        while (!exit)
        atomic exit = !wait;

where wait = TRUE, exit = FALSE;

The readDone is so structured:

  async event void ReadNow.readDone(error_t result, uint16_t data) {
     if (result == SUCCESS) {
        reading = data;
          wait = FALSE;
     }
  }

This software works fine: when it exits from the while above, reading value
is correct. 
Now my question is: the software works fine luckily or my friend found a
good alternative to the blocking Read that doesn't exist in TinyOS?

Thanks a lot,
Antonio

 

 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Realizza i tuoi sogni con Carta Eureka. Fido fino a 3.000 euro, rate a partire 
da 20 euro e canone gratis il 1° anno. Scoprila!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7877&d=18-9
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to