On Mon, Oct 28, 2013 at 2:02 AM, Alaios <[email protected]> wrote:

> Hi I was looking in the nice tutorial here
>
> http://www.youtube.com/watch?v=x0g4uFr44rk
>
> and I was wondering why at 34:11 we have to declare one more variable for
> the conversion formula to work. I guess this is related to the way tinyos
> works internally.
>

Its not an advanced topic.   Rather it is a C variable scoping topic.

it also has nothing with making the conversion formula work.

It does have everything to do with C scoping of variables.

TempRead.readDone is an event that gets signalled by the h/w driver.  It is
basically a call out and you have to have some place to put what you
compute from the value the read gives you.  The value passed in by the
driver (when calling (signalling) readDone) is call local.  its either in
registers or on the stack.   Doesn't have a very long lifetime.

So one way is to define a module static, centiGrade.   That gets the
computation value.

That is what the tutorial guy is doing by defining the module static
centiGrade.   Because it is inside the implementation block of the module
its name will be munged by nesc to make sure it is program unique.




>
> Can someone shed light on such advanced topic?
>
> R
> Alex
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to