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:
 CheBanca! La prima banca che ti dà gli interessi in anticipo.
* Fino al 4,70% sul Conto Deposito, zero spese e interessi subito. Aprilo!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7917&d=18-9
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to