PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
libArduino
libPropelleruino
wiring.c
Go to the documentation of this file.
1
9
#include <
Arduino.h
>
10
11
static
const
int
Ms = 1000;
12
13
// returns uptime in milliseconds. It is defined in terms
14
// of microseconds to handle all the hard stuff in one place.
15
unsigned
long
millis(
void
)
16
{
17
return
micros() / Ms;
18
}
19
20
// returns uptime in microseconds. Uses the CNT register and
21
// tracks rollover.
22
unsigned
long
micros(
void
)
23
{
24
25
// Time = CNT / (CLKFREQ / Ms)
26
// cycles / (cycles / sec)
27
}
28
29
void
delay(
unsigned
long
Time)
30
{
31
// Guard against zero or negative wait times which locks the processor.
32
Time = max(1, Time);
33
34
waitcnt
( (Time * (
CLKFREQ
/ Ms)) +
CNT
);
35
}
36
37
void
delayMicroseconds(uint16_t Time)
38
{
39
// Guard against zero or negative wait times which locks the processor.
40
Time = max(1, Time);
41
42
waitcnt
( microsecondsToClockCycles(Time) +
CNT
);
43
}
Arduino.h
Provides Arduino types and functions on the Propeller.
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:01 for PropWare by
1.8.17