In the body of your ReadNow.readDone() event you would want to post a
task that then signaled your Read,readDone() event.  Your application
wouldn't receive the results at exactly 2 kHz (because of the delay in
posting the task and the scheduler actually running it), but the
samples should be gathered accurately at 2khz through the use of
ReadNow.

In general, signaling synchronous events from async code is done
through the posting of a task.

Kevin

On 8/21/07, Ákos Maróy <[EMAIL PROTECTED]> wrote:
> Philip Levis wrote:
> > The TinyOS programming manual covers this topic (async).
>
> thanks :) I read the programming guide, but I'm still lost.
>
> I managed to create a component (see attached), that basically uses the
> decorator pattern to query an underlying Read component at specified
> intervals, and at a specified number of times. It will return an
> aggregate (the evarage of the readings).
>
> I'm calling this with parameters:
>
> interval:  16  (2kHz)
> noSamples: 20
>
>
> the unerlying component is an AdcReadClient on INPUT_CHANNEL_A2 (msp430).
>
> the readings I get sort of indicate that not all things are happening at
> 2kHz though. so I tried to replace the underlying sensor with a ReadNow
> sensor (AdcReadNowClient). for that, I have to change the uses lines to
> ReadNow instead of Read, and make the Sensor.readDone() event async.
>
> but then I get s range of compilation issues - like I can't seem to
> signal Read.readDone() from the async ReadNow.readDone() event, for example.
>
> I did read the documentation, maybe I'm just not clever enough - but how
> do I make this work?
>
>
> Akos
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>


-- 
~Kevin

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to