gr55xx_hal_bod.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_hal_bod.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of ADC HAL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup HAL_DRIVER HAL Driver
43 * @{
44 */
45
46 /** @defgroup HAL_BOD BOD
47 * @brief BOD HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_BOD_H__
53 #define __GR55xx_HAL_BOD_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_bod.h"
61 #include "gr55xx_hal_def.h"
62 #include <stdbool.h>
63
64 /* Exported types ------------------------------------------------------------*/
65
66
67 /** @addtogroup HAL_BOD_TYPEDEFS Structures
68 * @{
69 */
70 /**
71 * @brief BOD init structure definition
72 */
73 typedef ll_bod_init_t bod_init_t;
74 /**
75 * @brief BOD handle Structure definition
76 */
77 typedef struct _bod_handle
78 {
79 bod_init_t init; /**< BOD configuration parameters */
80 __IO hal_lock_t lock; /**< Locking object */
81 } bod_handle_t;
82 /** @} */
83
84 /**
85 * @defgroup HAL_BOD_MACRO Defines
86 * @{
87 */
88 /* Exported constants --------------------------------------------------------*/
89 /** @defgroup BOD_Exported_Constants BOD Exported Constants
90 * @{
91 */
92
93 /** @defgroup BOD_HAL_ENABLE BOD ENABLE
94 * @{
95 */
96 #define HAL_BOD_ENABLE LL_BOD_ENABLE /**< BOD enable */
97 #define HAL_BOD_DISABLE LL_BOD_DISABLE /**< BOD disable */
98 /** @} */
99
100 /** @defgroup BOD2_HAL_ENABLE BOD2 ENABLE
101 * @{
102 */
103 #define HAL_BOD2_ENABLE LL_BOD2_ENABLE /**< BOD2 enable */
104 #define HAL_BOD2_DISABLE LL_BOD2_DISABLE /**< BOD2 disable */
105 /** @} */
106
107 /** @defgroup BOD_HAL_STATIC_ENABLE BOD STATIC ENABLE
108 * @{
109 */
110 #define HAL_BOD_STATIC_ENABLE LL_BOD_STATIC_ENABLE /**< BOD STATIC enable */
111 #define HAL_BOD_STATIC_DISABLE LL_BOD_STATIC_DISABLE /**< BOD STATIC disable */
112 /** @} */
113
114 /** @defgroup BOD2_HAL_LEVEL BOD2 LVEVL
115 * @{
116 */
117 #define HAL_BOD2_LEVEL_0 LL_BOD2_LEVEL_0 /**< BOD2 Level 0 */
118 #define HAL_BOD2_LEVEL_1 LL_BOD2_LEVEL_1 /**< BOD2 Level 1 */
119 #define HAL_BOD2_LEVEL_2 LL_BOD2_LEVEL_2 /**< BOD2 Level 2 */
120 #define HAL_BOD2_LEVEL_3 LL_BOD2_LEVEL_3 /**< BOD2 Level 3 */
121 #define HAL_BOD2_LEVEL_4 LL_BOD2_LEVEL_4 /**< BOD2 Level 4 */
122 #define HAL_BOD2_LEVEL_5 LL_BOD2_LEVEL_5 /**< BOD2 Level 5 */
123 #define HAL_BOD2_LEVEL_6 LL_BOD2_LEVEL_6 /**< BOD2 Level 6 */
124 #define HAL_BOD2_LEVEL_7 LL_BOD2_LEVEL_7 /**< BOD2 Level 7 */
125 /** @} */
126 /** @} */
127 /** @} */
128
129 /* Exported functions --------------------------------------------------------*/
130 /** @addtogroup HAL_BOD_DRIVER_FUNCTIONS Functions
131 * @{
132 */
133
134 /** @addtogroup BOD_Exported_Functions_Group1 Initialization and de-initialization Functions
135 * @brief Initialization and Configuration functions
136 * @{
137 */
138 /* Exported functions --------------------------------------------------------*/
139
140 /**
141 ****************************************************************************************
142 * @brief Initialize the BOD according to the specified parameters
143 * in the bod_init_t and initialize the associated handle.
144 *
145 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
146 * the specified BOD module.
147 *
148 * @retval ::HAL_OK: Operation is OK.
149 * @retval ::HAL_ERROR: Parameter error or operation not supported.
150 * @retval ::HAL_BUSY: Driver is busy.
151 * @retval ::HAL_TIMEOUT: Timeout occurred.
152 ****************************************************************************************
153 */
154 hal_status_t hal_bod_init(bod_handle_t *p_bod);
155
156 /**
157 ****************************************************************************************
158 * @brief De-initialize the BOD peripheral.
159 *
160 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
161 * the specified BOD module.
162 *
163 * @retval ::HAL_OK: Operation is OK.
164 * @retval ::HAL_ERROR: Parameter error or operation not supported.
165 * @retval ::HAL_BUSY: Driver is busy.
166 * @retval ::HAL_TIMEOUT: Timeout occurred.
167 ****************************************************************************************
168 */
169 hal_status_t hal_bod_deinit(bod_handle_t *p_bod);
170
171 /**
172 ****************************************************************************************
173 * @brief Initialize the BOD MSP.
174 *
175 * @note This function should not be modified. When the callback is needed,
176 * the hal_bod_msp_init could be implemented in the user file
177 *
178 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
179 * the specified BOD module.
180 ****************************************************************************************
181 */
182 void hal_bod_msp_init(bod_handle_t *p_bod);
183
184 /**
185 ****************************************************************************************
186 * @brief De-initialize the BOD MSP.
187 *
188 * @note This function should not be modified. When the callback is needed,
189 * the hal_bod_msp_deinit could be implemented in the user file
190 *
191 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
192 * the specified BOD module.
193 ****************************************************************************************
194 */
195 void hal_bod_msp_deinit(bod_handle_t *p_bod);
196
197 /**
198 ****************************************************************************************
199 * @brief BOD fall edge callback.
200 *
201 * @note This function should not be modified. When the callback is needed,
202 * the hal_bod_fedge_callback can be implemented in the user file.
203 *
204 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
205 * the specified BOD module.
206 ****************************************************************************************
207 */
208 void hal_bod_fedge_callback(bod_handle_t *p_bod);
209
210 /**
211 ****************************************************************************************
212 * @brief Handle BOD fall edge interrupt request.
213 *
214 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
215 * the specified BOD module.
216 ****************************************************************************************
217 */
218 void hal_bod_fedge_irq_handler(bod_handle_t *p_bod);
219
220 /**
221 ****************************************************************************************
222 * @brief enable bod
223 *
224 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
225 * the specified BOD module.
226 * @param[in] enable: bod enable flag. the value can be HAL_BOD_ENABLE or HAL_BOD_DISABLE
227 *
228 * @retval ::HAL_OK: Operation is OK.
229 * @retval ::HAL_ERROR: Parameter error or operation not supported.
230 * @retval ::HAL_BUSY: Driver is busy.
231 * @retval ::HAL_TIMEOUT: Timeout occurred.
232 ****************************************************************************************
233 */
234 hal_status_t hal_bod_enable(bod_handle_t *p_bod, uint8_t enable);
235
236 /**
237 ****************************************************************************************
238 * @brief enable bod2
239 *
240 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
241 * the specified BOD module.
242 * @param[in] enable: bod2 enable flag. the value can be HAL_BOD2_ENABLE or HAL_BOD2_DISABLE
243 *
244 * @retval ::HAL_OK: Operation is OK.
245 * @retval ::HAL_ERROR: Parameter error or operation not supported.
246 * @retval ::HAL_BUSY: Driver is busy.
247 * @retval ::HAL_TIMEOUT: Timeout occurred.
248 ****************************************************************************************
249 */
250 hal_status_t hal_bod2_enable(bod_handle_t *p_bod, uint8_t enable);
251
252 /**
253 ****************************************************************************************
254 * @brief Set BOD2 control level.
255 *
256 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
257 * the specified BOD module.
258 * @param[in] level: the level of bod2 control.the value range between 0x0 ~ 0xF
259 *
260 * @retval ::HAL_OK: Operation is OK.
261 * @retval ::HAL_ERROR: Parameter error or operation not supported.
262 * @retval ::HAL_BUSY: Driver is busy.
263 * @retval ::HAL_TIMEOUT: Timeout occurred.
264 ****************************************************************************************
265 */
266 hal_status_t hal_bod2_set_level(bod_handle_t *p_bod, uint8_t level);
267
268 /**
269 ****************************************************************************************
270 * @brief enable/disable static mode
271 *
272 * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for
273 * the specified BOD module.
274 * @param[in] enable: static enable flag. the value can be HAL_BOD_STATIC_ENABLE or HAL_BOD_STATIC_DISABLE
275 *
276 * @retval ::HAL_OK: Operation is OK.
277 * @retval ::HAL_ERROR: Parameter error or operation not supported.
278 * @retval ::HAL_BUSY: Driver is busy.
279 * @retval ::HAL_TIMEOUT: Timeout occurred.
280 ****************************************************************************************
281 */
282 hal_status_t hal_bod_static_mode_enable(bod_handle_t *p_bod, uint8_t enable);
283 /** @} */
284
285 /** @} */
286
287 #ifdef __cplusplus
288 }
289 #endif
290
291 #endif /* __GR55xx_HAL_BOD_H__ */
292
293 /** @} */
294
295 /** @} */
296
297 /** @} */
_bod_handle
BOD handle Structure definition.
Definition: gr55xx_hal_bod.h:78
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
bod_init_t
ll_bod_init_t bod_init_t
BOD init structure definition.
Definition: gr55xx_hal_bod.h:73
bod_handle_t
struct _bod_handle bod_handle_t
BOD handle Structure definition.
hal_bod_deinit
hal_status_t hal_bod_deinit(bod_handle_t *p_bod)
De-initialize the BOD peripheral.
hal_bod_init
hal_status_t hal_bod_init(bod_handle_t *p_bod)
Initialize the BOD according to the specified parameters in the bod_init_t and initialize the associa...
hal_bod_enable
hal_status_t hal_bod_enable(bod_handle_t *p_bod, uint8_t enable)
enable bod
hal_bod2_enable
hal_status_t hal_bod2_enable(bod_handle_t *p_bod, uint8_t enable)
enable bod2
_ll_bod_init
LL BOD init Structure definition.
Definition: gr55xx_ll_bod.h:75
hal_bod2_set_level
hal_status_t hal_bod2_set_level(bod_handle_t *p_bod, uint8_t level)
Set BOD2 control level.
hal_bod_static_mode_enable
hal_status_t hal_bod_static_mode_enable(bod_handle_t *p_bod, uint8_t enable)
enable/disable static mode
gr55xx_ll_bod.h
Header file containing functions prototypes of CALENDAR LL library.
_bod_handle::init
bod_init_t init
BOD configuration parameters
Definition: gr55xx_hal_bod.h:79
hal_bod_fedge_irq_handler
void hal_bod_fedge_irq_handler(bod_handle_t *p_bod)
Handle BOD fall edge interrupt request.
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
hal_bod_fedge_callback
void hal_bod_fedge_callback(bod_handle_t *p_bod)
BOD fall edge callback.
hal_bod_msp_deinit
void hal_bod_msp_deinit(bod_handle_t *p_bod)
De-initialize the BOD MSP.
_bod_handle::lock
__IO hal_lock_t lock
Locking object
Definition: gr55xx_hal_bod.h:80
hal_bod_msp_init
void hal_bod_msp_init(bod_handle_t *p_bod)
Initialize the BOD MSP.
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.