[Tinyos-help] Time counting
Chad Metcalf
metcalfc at gmail.com
Thu Jan 4 14:21:59 PST 2007
My apologies for the initial mis-send.
On 1/4/07, Michael Newman <mnewman at dragonnorth.com> wrote:
> The first thing I did was to read the documentation.
>
> The 2.0 Source code documentation link on page
> http://www.tinyos.net/tinyos-2.x/doc/ is broken, it points to
> http://www.tinyos.net/tinyos-2.x/doc/html/nesdoc/ which gets a 404 error.
> The 2.0 TEP is quite clear, I never got there. The 2.0 Tutorial and the
> example code in Blink is wrong, leading you down the same path that I
> followed.
The best documentation is the source code itself. Timer.h and Timer.nc
point to TEP 102 for additional details. As for the tutorial being
wrong, if you think so contact the author, explain your reasoning and
submit a patch. Its an open source effort. People should be happy that
people take time to get tutorials done in the first place.
> I suggest having both interfaces, there is no cost in space or time it all
> gets resolved at compile time. The following would be equivalent calls:
>
> call Timer.startMS(TIMER_REPEAT, 1000);
> call Timer.startBinaryMS(TIMER_REPEAT, 1024);
>
> You can debate which way to implemented the current start interface, for
> compatibility it should match startBinaryMS, to match the 1.1 documentation
> and existing examples it should match startMS.
>
> call Timer.start(TIMER_REPEAT, 1024);
>
This seems like it would create more confusion then it would solve.
Better to clarify the interface then to add convenience methods that
are more apt to cause bugs. From the TEP:
"All precisions presented in this TEP are in "binary" units with
respect to one second. That is, one second contains 1024 binary
milliseconds, 32768 32kHz ticks, or 1048576 microseconds."
So clarify the interface and don't stray. For those who can stand
binary time units...
#define MSTOBMS(x) ( (int) (x * 1.024))
Just my two cents...
Chad
--
Chad @ Home
More information about the Tinyos-help
mailing list