-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathS2LP_Timer.h
142 lines (114 loc) · 3.83 KB
/
S2LP_Timer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/**
* @file S2LP_Timer.h
* @author ST Microelectronics
* @version 1.3.0
* @date June, 2019
* @brief Configuration and management of S2-LP Timers.
* @details
*
* This module provides API to configure the S2-LP timing mechanisms.
* They allow the user to set the timer registers using raw values or
* compute them since the desired timer value is expressed in ms.
* Moreover the management of the S2-LP LDCR mode can be done using
* these API.
*
* <b>Example:</b>
* @code
* ...
*
* S2LPTimerSetRxTimeoutMs(50.0);
* S2LPTimerSetWakeUpTimerUs(150000);
*
* // IRQ configuration for RX_TIMEOUT and WAKEUP_TIMEOUT
* ...
*
* S2LPTimerLdcrMode(S_ENABLE);
*
* ...
*
* @endcode
*
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* THIS SOURCE CODE IS PROTECTED BY A LICENSE.
* FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED
* IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
*
* <h2><center>© COPYRIGHT 2019 STMicroelectronics</center></h2>
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __S2LP1_TIMER_H
#define __S2LP1_TIMER_H
/* Includes ------------------------------------------------------------------*/
#include "S2LP_Regs.h"
#include "S2LP_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup S2LP_Libraries
* @{
*/
/**
* @defgroup S2LP_Timer Timer
* @brief Configuration and management of S2LP Timers.
* @details See the file <i>@ref S2LP_Timer.h</i> for more details.
* @{
*/
/**
* @defgroup Timer_Exported_Types Timer Exported Types
* @{
*/
/**
* @brief All the possible RX timeout stop conditions enumeration.
*/
typedef enum {
NO_TIMEOUT_STOP = 0x00, /*!< Timeout never stopped */
PQI_ABOVE_THRESHOLD = 0x01, /*!< Timeout stopped on PQI above threshold */
SQI_ABOVE_THRESHOLD = 0x02, /*!< Timeout stopped on SQI above threshold */
SQI_AND_PQI_ABOVE_THRESHOLD = 0x03, /*!< Timeout stopped on both SQI and PQI above threshold */
RSSI_ABOVE_THRESHOLD = 0x04, /*!< Timeout stopped on RSSI above threshold */
RSSI_AND_PQI_ABOVE_THRESHOLD = 0x05, /*!< Timeout stopped on both RSSI and PQI above threshold */
RSSI_AND_SQI_ABOVE_THRESHOLD = 0x06, /*!< Timeout stopped on both RSSI and SQI above threshold */
ALL_ABOVE_THRESHOLD = 0x07, /*!< Timeout stopped only if RSSI, SQI and PQI are above threshold */
TIMEOUT_ALWAYS_STOPPED = 0x08, /*!< Timeout always stopped (default) */
SQI_OR_PQI_ABOVE_THRESHOLD = 0x0B, /*!< Timeout stopped if one between SQI or PQI are above threshold */
RSSI_OR_PQI_ABOVE_THRESHOLD = 0x0D, /*!< Timeout stopped if one between RSSI or PQI are above threshold */
RSSI_OR_SQI_ABOVE_THRESHOLD = 0x0E, /*!< Timeout stopped if one between RSSI or SQI are above threshold */
ANY_ABOVE_THRESHOLD = 0x0F /*!< Timeout stopped if one among RSSI, SQI or SQI are above threshold */
} RxTimeoutStopCondition;
/**
* @}
*/
/**
* @defgroup Timer_Exported_Constants Timer Exported Constants
* @{
*/
/**
* @}
*/
/**
* @defgroup Timer_Exported_Macros Timer Exported Macros
* @{
*/
#define SET_INFINITE_RX_TIMEOUT() S2LPTimerSetRxTimerCounter(0)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
/******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/