Contiki 3.x
system-timer.h
Go to the documentation of this file.
1 /** @file hal/micro/system-timer.h
2  * @brief Header file for system_timer APIs
3  *
4  *
5  * <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
6 
7  */
8 
9 /**
10  * @addtogroup stm32w-cpu
11  * @{ */
12 
13 /** @defgroup system_timer
14  * @brief Functions that provide access to the system clock.
15  *
16  * A single system tick (as returned by ::halCommonGetInt16uMillisecondTick() and
17  * ::halCommonGetInt32uMillisecondTick() ) is approximately 1 millisecond.
18  *
19  * - When used with a 32.768kHz crystal, the system tick is 0.976 milliseconds.
20  *
21  * - When used with a 3.6864MHz crystal, the system tick is 1.111 milliseconds.
22  *
23  * A single quarter-second tick (as returned by
24  * ::halCommonGetInt16uQuarterSecondTick() ) is approximately 0.25 seconds.
25  *
26  * The values used by the time support functions will wrap after an interval.
27  * The length of the interval depends on the length of the tick and the number
28  * of bits in the value. However, there is no issue when comparing time deltas
29  * of less than half this interval with a subtraction, if all data types are the
30  * same.
31  *
32  * See system-timer.h for source code.
33  *@{
34  */
35 
36 #ifndef SYSTEM_TIMER_H_
37 #define SYSTEM_TIMER_H_
38 
39 /**
40  * @brief Initializes the system tick.
41  *
42  * @return Time to update the async registers after RTC is started (units of 100
43  * microseconds).
44  */
45 uint16_t halInternalStartSystemTimer(void);
46 
47 
48 /**
49  * @brief Returns the current system time in system ticks, as a 16-bit
50  * value.
51  *
52  * @return The least significant 16 bits of the current system time, in system
53  * ticks.
54  */
56 
57 /**
58  * @brief Returns the current system time in system ticks, as a 32-bit
59  * value.
60  *
61  * nostackusage
62  *
63  * @return The least significant 32 bits of the current system time, in
64  * system ticks.
65  */
67 
68 /**
69  * @brief Returns the current system time in quarter second ticks, as a
70  * 16-bit value.
71  *
72  * nostackusage
73  *
74  * @return The least significant 16 bits of the current system time, in system
75  * ticks multiplied by 256.
76  */
78 
79 #endif //SYSTEM_TIMER_H_
80 
81 /**@} //END addtogroup
82  */
83 /** @} */
84 
85 
86 
uint16_t halCommonGetInt16uMillisecondTick(void)
Returns the current system time in system ticks, as a 16-bit value.
Definition: system-timer.c:35
uint32_t halCommonGetInt32uMillisecondTick(void)
Returns the current system time in system ticks, as a 32-bit value.
Definition: system-timer.c:50
uint16_t halInternalStartSystemTimer(void)
Initializes the system tick.
Definition: micro-common.c:74
uint16_t halCommonGetInt16uQuarterSecondTick(void)
Returns the current system time in quarter second ticks, as a 16-bit value.
Definition: system-timer.c:40