PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Misc
libmstimer
libmstimer.c
1
/*
2
* @file libmstimer.c
3
*
4
* @author Andy Lindsay
5
*
6
* @copyright
7
* Copyright (C) Parallax, Inc. 2013. All Rights MIT Licensed.
8
*
9
* @brief Project and test harness for the mstimer library.
10
*/
11
12
#include "
simpletools.h
"
13
#include "
mstimer.h
"
14
15
int
main
()
16
{
17
mstime_start
();
18
int
dt =
CLKFREQ
;
19
int
t =
CNT
;
20
while
(1)
21
{
22
int
time =
mstime_get
();
23
print
(
"time = %d\n"
, time);
24
waitcnt
(t += dt);
25
}
26
}
27
mstimer.h
Tracks milliseconds elapsed in another cog. This is part of a tutorial on adding a Simple Library to ...
mstime_get
int mstime_get()
Get milliseconds since call to start.
Definition:
mstimer.c:36
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
mstime_start
int mstime_start()
Start the millisecond timer.
Definition:
mstimer.c:21
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
CLKFREQ
#define CLKFREQ
Returns the current clock frequency.
Definition:
propeller.h:46
waitcnt
#define waitcnt(a)
Wait until system counter reaches a value.
Definition:
propeller.h:176
CNT
#define CNT
The system clock count.
Definition:
propeller1.h:151
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17