From cf69a59a3edefc3bea57cceea2cbedd25c7b680d Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 25 Feb 2011 15:31:15 +0100 Subject: Use common timebase and delay code in all boards. There is a file called timebase.fs in the common code folder already, so there is no need to duplicate the delay functions in the board directories, too. Signed-off-by: Thomas Huth --- board-js2x/slof/OF.fs | 8 +------- slof/fs/timebase.fs | 9 +++++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/board-js2x/slof/OF.fs b/board-js2x/slof/OF.fs index 908b268..894f43a 100644 --- a/board-js2x/slof/OF.fs +++ b/board-js2x/slof/OF.fs @@ -207,13 +207,7 @@ d# 14318378 VALUE tb-frequency \ default value - needed for "ms" to work #include "helper.fs" 260 cp -: tb@ BEGIN tbu@ tbl@ tbu@ rot over <> WHILE 2drop REPEAT - 20 lshift swap ffffffff and or ; -: milliseconds tb@ d# 1000 * tb-frequency / ; -: ms milliseconds + BEGIN milliseconds over >= UNTIL drop ; -: get-msecs ( -- n ) milliseconds ; -\ : usecs tb@ d# 1000000 * tb-frequency / ; -: us 999 + 1000 / ms ; +#include 280 cp diff --git a/slof/fs/timebase.fs b/slof/fs/timebase.fs index 863f694..00a0bd2 100644 --- a/slof/fs/timebase.fs +++ b/slof/fs/timebase.fs @@ -11,8 +11,13 @@ \ ****************************************************************************/ \ Define all timebase related words -: milliseconds ( -- ms ) tbl@ d# 1000 * tb-frequency / ; -: microseconds ( -- us ) tbl@ d# 1000000 * tb-frequency / ; +: tb@ ( -- tb ) + BEGIN tbu@ tbl@ tbu@ rot over <> WHILE 2drop REPEAT + 20 lshift swap ffffffff and or +; + +: milliseconds ( -- ms ) tb@ d# 1000 * tb-frequency / ; +: microseconds ( -- us ) tb@ d# 1000000 * tb-frequency / ; : ms ( ms-to-wait -- ) milliseconds + BEGIN milliseconds over >= UNTIL drop ; : get-msecs ( -- n ) milliseconds ; -- cgit v1.1