Skip to content

Commit

Permalink
Use common timebase and delay code in all boards.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
huth committed Mar 21, 2011
1 parent 95de9a1 commit cf69a59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 1 addition & 7 deletions board-js2x/slof/OF.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <timebase.fs>

280 cp

Expand Down
9 changes: 7 additions & 2 deletions slof/fs/timebase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand Down

0 comments on commit cf69a59

Please sign in to comment.