|
1 | | -/* |
2 | | - / _____) _ | | |
3 | | -( (____ _____ ____ _| |_ _____ ____| |__ |
4 | | - \____ \| ___ | (_ _) ___ |/ ___) _ \ |
5 | | - _____) ) ____| | | || |_| ____( (___| | | | |
6 | | -(______/|_____)_|_|_| \__)_____)\____)_| |_| |
7 | | - (C)2013 Semtech |
8 | | -
|
9 | | -Description: MCU RTC timer and low power modes management |
10 | | -
|
11 | | -License: Revised BSD License, see LICENSE.TXT file include in the project |
12 | | -
|
13 | | -Maintainer: Miguel Luis and Gregory Cristian |
14 | | -*/ |
15 | | -#ifndef __RTC_BOARD_H__ |
16 | | -#define __RTC_BOARD_H__ |
17 | | - |
18 | | -/*! |
19 | | - * \brief Timer time variable definition |
20 | | - */ |
21 | | -#ifndef TimerTime_t |
22 | | -typedef uint32_t TimerTime_t; |
23 | | -#endif |
24 | | - |
25 | | -/*! |
26 | | - * \brief Structure holding the context date (saved before lunching a timeout) |
27 | | - */ |
28 | | -typedef struct |
29 | | -{ |
30 | | - uint8_t Date; |
31 | | - uint8_t Month; |
32 | | - uint8_t Year; |
33 | | -}DateContext_t; |
34 | | - |
35 | | -/*! |
36 | | - * \brief Structure holding the context Time (saved before lunching a timeout) |
37 | | - */ |
38 | | -typedef struct |
39 | | -{ |
40 | | - uint8_t Hours; |
41 | | - uint8_t Minutes; |
42 | | - uint8_t Seconds; |
43 | | - uint16_t Miliseconds; |
44 | | -}TimeContext_t; |
45 | | - |
46 | | - |
47 | | -/*! |
48 | | - * \brief Initializes the RTC timer |
49 | | - * |
50 | | - * \remark The timer is based on the RTC |
51 | | - */ |
52 | | -void RtcInit( void ); |
53 | | - |
54 | | -/*! |
55 | | - * \brief Start the RTC timer |
56 | | - * |
57 | | - * \remark The timer is based on the RTC Alarm running at 32.768KHz |
58 | | - * |
59 | | - * \param[IN] timeout Duration of the Timer |
60 | | - */ |
61 | | -void RtcSetTimeout( uint32_t timeout ); |
62 | | - |
63 | | -/*! |
64 | | - * \brief Get the RTC timer value |
65 | | - * |
66 | | - * \retval RTC Timer value |
67 | | - */ |
68 | | -TimerTime_t RtcGetTimerValue( void ); |
69 | | - |
70 | | -/*! |
71 | | - * \brief Get the RTC timer elapsed time since the last Alarm was set |
72 | | - * |
73 | | - * \retval RTC Elapsed time since the last alarm |
74 | | - */ |
75 | | -uint32_t RtcGetElapsedAlarmTime( void ); |
76 | | - |
77 | | -/*! |
78 | | - * \brief Compute the timeout time of a future event in time |
79 | | - * |
80 | | - * \param[IN] futureEventInTime value in time |
81 | | - * \retval time between now and the futureEventInTime |
82 | | - */ |
83 | | -TimerTime_t RtcComputeFutureEventTime( TimerTime_t futureEventInTime ); |
84 | | - |
85 | | -/*! |
86 | | - * \brief Compute the elapsed time since a fix event in time |
87 | | - * |
88 | | - * \param[IN] eventInTime value in time |
89 | | - * \retval elasped time since the eventInTime |
90 | | - */ |
91 | | -TimerTime_t RtcComputeElapsedTime( TimerTime_t eventInTime ); |
92 | | - |
93 | | -/*! |
94 | | - * \brief This function block the MCU from going into Low Power mode |
95 | | - * |
96 | | - * \param [IN] Status enable or disable |
97 | | - */ |
98 | | -void BlockLowPowerDuringTask ( bool Status ); |
99 | | - |
100 | | -/*! |
101 | | - * \brief Sets the MCU in low power STOP mode |
102 | | - */ |
103 | | -void RtcEnterLowPowerStopMode( void ); |
104 | | - |
105 | | -/*! |
106 | | - * \brief Restore the MCU to its normal operation mode |
107 | | - */ |
108 | | -void RtcRecoverMcuStatus( void ); |
109 | | - |
110 | | -/*! |
111 | | - * \brief Perfoms a standard blocking delay in the code execution |
112 | | - * |
113 | | - * \param [IN] delay Delay value in ms |
114 | | - */ |
115 | | -void RtcDelayMs ( uint32_t delay ); |
116 | | - |
117 | | -#endif // __RTC_BOARD_H__ |
| 1 | +/* |
| 2 | + / _____) _ | | |
| 3 | +( (____ _____ ____ _| |_ _____ ____| |__ |
| 4 | + \____ \| ___ | (_ _) ___ |/ ___) _ \ |
| 5 | + _____) ) ____| | | || |_| ____( (___| | | | |
| 6 | +(______/|_____)_|_|_| \__)_____)\____)_| |_| |
| 7 | + (C)2013 Semtech |
| 8 | +
|
| 9 | +Description: MCU RTC timer and low power modes management |
| 10 | +
|
| 11 | +License: Revised BSD License, see LICENSE.TXT file include in the project |
| 12 | +
|
| 13 | +Maintainer: Miguel Luis and Gregory Cristian |
| 14 | +*/ |
| 15 | +#ifndef __RTC_BOARD_H__ |
| 16 | +#define __RTC_BOARD_H__ |
| 17 | + |
| 18 | +/*! |
| 19 | + * \brief Timer time variable definition |
| 20 | + */ |
| 21 | +#ifndef TimerTime_t |
| 22 | +typedef uint32_t TimerTime_t; |
| 23 | +#endif |
| 24 | + |
| 25 | +/*! |
| 26 | + * \brief Structure holding the context date (saved before lunching a timeout) |
| 27 | + */ |
| 28 | +typedef struct |
| 29 | +{ |
| 30 | + uint8_t Date; |
| 31 | + uint8_t Month; |
| 32 | + uint8_t Year; |
| 33 | +}DateContext_t; |
| 34 | + |
| 35 | +/*! |
| 36 | + * \brief Structure holding the context Time (saved before lunching a timeout) |
| 37 | + */ |
| 38 | +typedef struct |
| 39 | +{ |
| 40 | + uint8_t Hours; |
| 41 | + uint8_t Minutes; |
| 42 | + uint8_t Seconds; |
| 43 | + uint16_t Miliseconds; |
| 44 | +}TimeContext_t; |
| 45 | + |
| 46 | + |
| 47 | +/*! |
| 48 | + * \brief Initializes the RTC timer |
| 49 | + * |
| 50 | + * \remark The timer is based on the RTC |
| 51 | + */ |
| 52 | +void RtcInit( void ); |
| 53 | + |
| 54 | +/*! |
| 55 | + * \brief Start the RTC timer |
| 56 | + * |
| 57 | + * \remark The timer is based on the RTC Alarm running at 32.768KHz |
| 58 | + * |
| 59 | + * \param[IN] timeout Duration of the Timer |
| 60 | + */ |
| 61 | +void RtcSetTimeout( uint32_t timeout ); |
| 62 | + |
| 63 | +/*! |
| 64 | + * \brief Get the RTC timer value |
| 65 | + * |
| 66 | + * \retval RTC Timer value |
| 67 | + */ |
| 68 | +TimerTime_t RtcGetTimerValue( void ); |
| 69 | + |
| 70 | +/*! |
| 71 | + * \brief Get the RTC timer elapsed time since the last Alarm was set |
| 72 | + * |
| 73 | + * \retval RTC Elapsed time since the last alarm |
| 74 | + */ |
| 75 | +uint32_t RtcGetElapsedAlarmTime( void ); |
| 76 | + |
| 77 | +/*! |
| 78 | + * \brief Compute the timeout time of a future event in time |
| 79 | + * |
| 80 | + * \param[IN] futureEventInTime value in time |
| 81 | + * \retval time between now and the futureEventInTime |
| 82 | + */ |
| 83 | +TimerTime_t RtcComputeFutureEventTime( TimerTime_t futureEventInTime ); |
| 84 | + |
| 85 | +/*! |
| 86 | + * \brief Compute the elapsed time since a fix event in time |
| 87 | + * |
| 88 | + * \param[IN] eventInTime value in time |
| 89 | + * \retval elasped time since the eventInTime |
| 90 | + */ |
| 91 | +TimerTime_t RtcComputeElapsedTime( TimerTime_t eventInTime ); |
| 92 | + |
| 93 | +/*! |
| 94 | + * \brief This function block the MCU from going into Low Power mode |
| 95 | + * |
| 96 | + * \param [IN] Status enable or disable |
| 97 | + */ |
| 98 | +void BlockLowPowerDuringTask ( bool Status ); |
| 99 | + |
| 100 | +/*! |
| 101 | + * \brief Sets the MCU in low power STOP mode |
| 102 | + */ |
| 103 | +void RtcEnterLowPowerStopMode( void ); |
| 104 | + |
| 105 | +/*! |
| 106 | + * \brief Restore the MCU to its normal operation mode |
| 107 | + */ |
| 108 | +void RtcRecoverMcuStatus( void ); |
| 109 | + |
| 110 | +#endif // __RTC_BOARD_H__ |
0 commit comments