1 | /*
|
---|
2 | Copyright (c) 2014 Arduino. All right reserved.
|
---|
3 |
|
---|
4 | This library is free software; you can redistribute it and/or
|
---|
5 | modify it under the terms of the GNU Lesser General Public
|
---|
6 | License as published by the Free Software Foundation; either
|
---|
7 | version 2.1 of the License, or (at your option) any later version.
|
---|
8 |
|
---|
9 | This library is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
12 | See the GNU Lesser General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU Lesser General Public
|
---|
15 | License along with this library; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef _DELAY_
|
---|
20 | #define _DELAY_
|
---|
21 |
|
---|
22 | #ifdef __cplusplus
|
---|
23 | extern "C" {
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | #include <stdint.h>
|
---|
27 | #include "variant.h"
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * \brief Returns the number of milliseconds since the Arduino board began running the current program.
|
---|
31 | *
|
---|
32 | * This number will overflow (go back to zero), after approximately 50 days.
|
---|
33 | *
|
---|
34 | * \return Number of milliseconds since the program started (uint32_t)
|
---|
35 | */
|
---|
36 | extern uint32_t millis( void ) ;
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * \brief Returns the number of microseconds since the Arduino board began running the current program.
|
---|
40 | *
|
---|
41 | * This number will overflow (go back to zero), after approximately 70 minutes. On 16 MHz Arduino boards
|
---|
42 | * (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is
|
---|
43 | * always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution
|
---|
44 | * of eight microseconds.
|
---|
45 | *
|
---|
46 | * \note There are 1,000 microseconds in a millisecond and 1,000,000 microseconds in a second.
|
---|
47 | */
|
---|
48 | extern uint32_t micros( void ) ;
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * \brief Pauses the program for the amount of time (in miliseconds) specified as parameter.
|
---|
52 | * (There are 1000 milliseconds in a second.)
|
---|
53 | *
|
---|
54 | * \param dwMs the number of milliseconds to pause (uint32_t)
|
---|
55 | */
|
---|
56 | extern void delay( uint32_t dwMs ) ;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * \brief Pauses the program for the amount of time (in microseconds) specified as parameter.
|
---|
60 | *
|
---|
61 | * \param dwUs the number of microseconds to pause (uint32_t)
|
---|
62 | */
|
---|
63 |
|
---|
64 | extern void delayMicroseconds(uint32_t usec);
|
---|
65 |
|
---|
66 | #ifdef __cplusplus
|
---|
67 | }
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | #endif /* _DELAY_ */
|
---|