gr55xx_hal_pwm.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_hal_pwm.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of PWM 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_PWM PWM
47 * @brief PWM HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_PWM_H__
53 #define __GR55xx_HAL_PWM_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_hal_def.h"
61 #include "gr55xx_ll_pwm.h"
62
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_PWM_ENUMERATIONS Enumerations
65 * @{
66 */
67
68 /** @defgroup HAL_PWM_state HAL PWM state
69 * @{
70 */
71
72 /**
73 * @brief HAL PWM State Enumerations definition
74 */
75 typedef enum
76 {
77 HAL_PWM_STATE_RESET = 0x00, /**< Peripheral is not initialized or disabled */
78 HAL_PWM_STATE_READY = 0x01, /**< Peripheral is initialized and ready for use */
79 HAL_PWM_STATE_BUSY = 0x02, /**< An internal process is ongoing */
80 HAL_PWM_STATE_ERROR = 0x04 /**< Reception process is ongoing */
81 } hal_pwm_state_t;
82 /** @} */
83
84 /** @defgroup HAL_PWM_active_channel HAL PWM active channel
85 * @{
86 */
87
88 /**
89 * @brief HAL PWM active channel Enumerations definition
90 */
91 typedef enum
92 {
93 HAL_PWM_ACTIVE_CHANNEL_A = 0x01, /**< The active channel is A */
94 HAL_PWM_ACTIVE_CHANNEL_B = 0x02, /**< The active channel is B */
95 HAL_PWM_ACTIVE_CHANNEL_C = 0x04, /**< The active channel is C */
96 HAL_PWM_ACTIVE_CHANNEL_ALL = 0x07, /**< The active channels are ALL */
97 HAL_PWM_ACTIVE_CHANNEL_CLEARED = 0x00 /**< All active channels are cleared */
98 } hal_pwm_active_channel_t;
99 /** @} */
100
101 /** @} */
102
103 /** @addtogroup HAL_PWM_STRUCTURES Structures
104 * @{
105 */
106
107 /** @defgroup PWM_Configuration PWM Configuration
108 * @{
109 */
110
111 /**
112 * @brief PWM Channel init Structure definition
113 */
114 typedef struct
115 {
116 uint8_t duty; /**< Specifies the duty in PWM output mode.
117 This parameter must be a number between 0 ~ 100.*/
118
119 uint8_t drive_polarity; /**< Specifies the drive polarity in PWM output mode.
120 This parameter can be a value of @ref PWM_Drive_Polarity.*/
121
122 uint32_t fstoplvl; /**< Specifies the PWM io level when stop.
123 This parameter can be a value of @ref PWM_STOP_LVL */
124 } pwm_channel_init_t;
125
126 /**
127 * @brief PWM init Structure definition
128 */
129 typedef struct
130 {
131 uint32_t mode; /**< Specifies the PWM output mode state.
132 This parameter can be a value of @ref PWM_Mode */
133
134 uint32_t align; /**< Specifies the PWM alignment mode with three channels
135 This parameter can be a value of @ref PWM_Alignment_Mode */
136
137 uint32_t freq; /**< Specifies the PWM frequency.
138 This parameter must be a number between 0 ~ SystemFreq/2 (max = 32Mhz).*/
139
140 uint32_t bperiod; /**< Specifies the PWM breath period in breath mode. Unit: ms.
141 This parameter must be a number between 0 ~ 0xFFFFFFFF/SystemFreq*1000. */
142
143 uint32_t hperiod; /**< Specifies the PWM hold period in breath mode. Unit: ms.
144 This parameter must be a number between 0 ~ 0xFFFFFF/SystemFreq*1000. */
145
146 uint32_t bstoplvl; /**< Specifies the PWM io level when stop.
147 This parameter can be a value of @ref PWM_STOP_LVL */
148
149 pwm_channel_init_t channel_a; /**< Specifies the configuration parameters of channel A. */
150
151 pwm_channel_init_t channel_b; /**< Specifies the configuration parameters of channel B. */
152
153 pwm_channel_init_t channel_c; /**< Specifies the configuration parameters of channel C. */
154
155 } pwm_init_t;
156 /** @} */
157
158 /** @defgroup PWM_handle PWM handle
159 * @{
160 */
161
162 /**
163 * @brief PWM handle Structure definition
164 */
165 typedef struct
166 {
167 pwm_regs_t *p_instance; /**< Register base address */
168
169 pwm_init_t init; /**< Required parameters for PWM Base */
170
171 hal_pwm_active_channel_t active_channel; /**< Active channel */
172
173 __IO hal_lock_t lock; /**< Lock object */
174
175 __IO hal_pwm_state_t state; /**< PWM operation state */
176
177 uint32_t retention[12]; /**< PWM important register information. */
178
179 } pwm_handle_t;
180
181 /** @} */
182
183 /** @} */
184
185 /** @addtogroup HAL_PWM_CALLBACK_STRUCTURES Callback Structures
186 * @{
187 */
188
189 /** @defgroup PWM_Callback PWM Callback
190 * @{
191 */
192
193 /**
194 * @brief HAL_PWM Callback function definition
195 */
196
197 typedef struct _hal_pwm_callback
198 {
199 void (*pwm_msp_init)(pwm_handle_t *p_pwm); /**< PWM init MSP callback */
200 void (*pwm_msp_deinit)(pwm_handle_t *p_pwm); /**< PWM de-init MSP callback */
201 } hal_pwm_callback_t;
202
203 /** @} */
204
205 /** @} */
206
207 /**
208 * @defgroup HAL_PWM_MACRO Defines
209 * @{
210 */
211
212 /* Exported constants --------------------------------------------------------*/
213 /** @defgroup PWM_Exported_Constants PWM Exported Constants
214 * @{
215 */
216
217 /** @defgroup PWM_Mode PWM Mode
218 * @{
219 */
220 #define PWM_MODE_FLICKER LL_PWM_FLICKER_MODE /**< PWM flicker mode */
221 #define PWM_MODE_BREATH LL_PWM_BREATH_MODE /**< PWM breath mode */
222 /** @} */
223
224 /** @defgroup PWM_Alignment_Mode PWM Pulses Aligned Mode
225 * @{
226 */
227 #define PWM_ALIGNED_EDGE LL_PWM_EDGE_ALIGNED /**< PWM edge-aligned */
228 #define PWM_ALIGNED_CENTER LL_PWM_CENTER_ALIGNED /**< PWM center-aligned */
229 /** @} */
230
231 /** @defgroup PWM_STOP_LVL PWM Stop Level
232 * @{
233 */
234 #define PWM_STOP_LVL_LOW LL_PWM_STOP_LVL_LOW /**< PWM stop in low io level */
235 #define PWM_STOP_LVL_HIGH LL_PWM_STOP_LVL_HIGH /**< PWM stop in high io level */
236 /** @} */
237
238 /** @defgroup PWM_Drive_Polarity PWM Drive Polarity
239 * @{
240 */
241 #define PWM_DRIVEPOLARITY_NEGATIVE LL_PWM_DRIVEPOLARITY_NEGATIVE /**< PWM led-negative-drive mode */
242 #define PWM_DRIVEPOLARITY_POSITIVE LL_PWM_DRIVEPOLARITY_POSITIVE /**< PWM led-positive-drive mode */
243 /** @} */
244 /** @} */
245
246 /* Exported macro ------------------------------------------------------------*/
247 /** @defgroup PWM_Exported_Macros PWM Exported Macros
248 * @{
249 */
250
251 /** @brief Reset PWM handle states.
252 * @param __HANDLE__ PWM handle.
253 * @retval None
254 */
255 #define __HAL_PWM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PWM_STATE_RESET)
256
257 /** @brief Enable the specified PWM peripheral.
258 * @param __HANDLE__ specifies the PWM Handle.
259 * @retval None
260 */
261 #define __HAL_PWM_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
262
263 /** @brief Disable the specified PWM peripheral.
264 * @param __HANDLE__ specifies the PWM Handle.
265 * @retval None
266 */
267 #define __HAL_PWM_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
268
269 /** @brief Enable PWM breath mode.
270 * @param __HANDLE__ specifies the PWM Handle.
271 * @retval None
272 */
273 #define __HAL_PWM_ENABLE_BREATH(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
274
275 /** @brief Disable PWM breath mode.
276 * @param __HANDLE__ specifies the PWM Handle.
277 * @retval None
278 */
279 #define __HAL_PWM_DISABLE_BREATH(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
280
281 /** @} */
282
283 /* Private macros ------------------------------------------------------------*/
284 /** @defgroup PWM_Private_Macro PWM Private Macros
285 * @{
286 */
287
288 /**
289 * @brief Check if PWM mode is valid.
290 * @param __MODE__ PWM mode.
291 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
292 */
293 #define IS_PWM_MODE(__MODE__) (((__MODE__) == PWM_MODE_FLICKER) || \
294 ((__MODE__) == PWM_MODE_BREATH))
295
296 /**
297 * @brief Check if PWM Alignment mode is valid.
298 * @param __MODE__ PWM Alignment mode.
299 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
300 */
301 #define IS_PWM_ALIGNMENT_MODE(__MODE__) (((__MODE__) == PWM_ALIGNED_EDGE) || \
302 ((__MODE__) == PWM_ALIGNED_CENTER))
303
304 /**
305 * @brief Check if PWM stop level is valid.
306 * @param __MODE__ PWM stop level.
307 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
308 */
309 #define IS_PWM_STOP_LVL(__MODE__) (((__MODE__) == PWM_STOP_LVL_LOW) || \
310 ((__MODE__) == PWM_STOP_LVL_HIGH))
311
312 /**
313 * @brief Check if PWM drive polarity is valid.
314 * @param __POLARITY__ PWM drive polarity.
315 * @retval SET (__POLARITY__ is valid) or RESET (__POLARITY__ is invalid)
316 */
317 #define IS_PWM_DRIVEPOLARITY(__POLARITY__) (((__POLARITY__) == PWM_DRIVEPOLARITY_NEGATIVE) || \
318 ((__POLARITY__) == PWM_DRIVEPOLARITY_POSITIVE))
319
320 /** @} */
321
322 /** @} */
323
324 /* Exported functions --------------------------------------------------------*/
325 /** @addtogroup HAL_PWM_DRIVER_FUNCTIONS Functions
326 * @{
327 */
328
329 /** @addtogroup PWM_Exported_Functions_Group1 Initialization and de-initialization functions
330 * @brief Initialization and de-initialization functions
331 *
332 * @verbatim
333 ===============================================================================
334 ##### Initialization and de-initialization functions #####
335 ===============================================================================
336 [..]
337 This subsection provides a set of functions allowing to initialize the PWMx.
338 (+) The parameters below can only be configured in breath mode:
339 (++) BreathPeriod
340 (++) HoldPeriod
341
342 @endverbatim
343 * @{
344 */
345
346 /**
347 ****************************************************************************************
348 * @brief Initialize the PWM mode according to the specified
349 * parameters in the pwm_init_t and initialize the associated handle.
350 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
351 * @retval ::HAL_OK: Operation is OK.
352 * @retval ::HAL_ERROR: Parameter error or operation not supported.
353 * @retval ::HAL_BUSY: Driver is busy.
354 * @retval ::HAL_TIMEOUT: Timeout occurred.
355 ****************************************************************************************
356 */
357 hal_status_t hal_pwm_init(pwm_handle_t *p_pwm);
358
359 /**
360 ****************************************************************************************
361 * @brief De-initialize the PWM peripheral.
362 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
363 * @retval ::HAL_OK: Operation is OK.
364 * @retval ::HAL_ERROR: Parameter error or operation not supported.
365 * @retval ::HAL_BUSY: Driver is busy.
366 * @retval ::HAL_TIMEOUT: Timeout occurred.
367 ****************************************************************************************
368 */
369 hal_status_t hal_pwm_deinit(pwm_handle_t *p_pwm);
370
371 /**
372 ****************************************************************************************
373 * @brief Initialize the PWM MSP.
374 * @note This function should not be modified. When the callback is needed,
375 the hal_pwm_msp_init can be implemented in the user file.
376 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
377 ****************************************************************************************
378 */
379 void hal_pwm_msp_init(pwm_handle_t *p_pwm);
380
381 /**
382 ****************************************************************************************
383 * @brief De-initialize the PWM MSP.
384 * @note This function should not be modified. When the callback is needed,
385 the hal_pwm_msp_deinit can be implemented in the user file.
386 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
387 ****************************************************************************************
388 */
389 void hal_pwm_msp_deinit(pwm_handle_t *p_pwm);
390
391 /** @} */
392
393 /** @addtogroup PWM_Exported_Functions_Group2 IO operation functions
394 * @brief IO operation functions
395 *
396 @verbatim
397 ==============================================================================
398 ##### IO operation functions #####
399 ==============================================================================
400 [..]
401 This section provides functions allowing to:
402 (+) Start the PWM.
403 (+) Stop the PWM.
404 (+) Configure the specified PWM channel.
405
406 @endverbatim
407 * @{
408 */
409
410 /**
411 ****************************************************************************************
412 * @brief Starts the PWM signal generation on the output.
413 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
414 * @retval ::HAL_OK: Operation is OK.
415 * @retval ::HAL_ERROR: Parameter error or operation not supported.
416 * @retval ::HAL_BUSY: Driver is busy.
417 * @retval ::HAL_TIMEOUT: Timeout occurred.
418 ****************************************************************************************
419 */
420 hal_status_t hal_pwm_start(pwm_handle_t *p_pwm);
421
422 /**
423 ****************************************************************************************
424 * @brief Stops the PWM signal generation on the output.
425 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
426 * @retval ::HAL_OK: Operation is OK.
427 * @retval ::HAL_ERROR: Parameter error or operation not supported.
428 * @retval ::HAL_BUSY: Driver is busy.
429 * @retval ::HAL_TIMEOUT: Timeout occurred.
430 ****************************************************************************************
431 */
432 hal_status_t hal_pwm_stop(pwm_handle_t *p_pwm);
433
434 /**
435 ****************************************************************************************
436 * @brief Update the PWM frequency on the output.
437 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
438 * @param[in] freq: This parameter ranges between min = 0 and max = SystemFreq / 2.
439 * @retval ::HAL_OK: Operation is OK.
440 * @retval ::HAL_ERROR: Parameter error or operation not supported.
441 * @retval ::HAL_BUSY: Driver is busy.
442 * @retval ::HAL_TIMEOUT: Timeout occurred.
443 ****************************************************************************************
444 */
445 hal_status_t hal_pwm_update_freq(pwm_handle_t *p_pwm, uint32_t freq);
446
447 /**
448 ****************************************************************************************
449 * @brief Suspend some registers related to PWM configuration before sleep.
450 * @param[in] p_pwm: Pointer to a PWM handle which contains the configuration
451 * information for the specified PWM module.
452 * @retval ::HAL_OK: Operation is OK.
453 * @retval ::HAL_ERROR: Parameter error or operation not supported.
454 * @retval ::HAL_BUSY: Driver is busy.
455 * @retval ::HAL_TIMEOUT: Timeout occurred.
456 ****************************************************************************************
457 */
458 hal_status_t hal_pwm_suspend_reg(pwm_handle_t *p_pwm);
459
460 /**
461 ****************************************************************************************
462 * @brief Restore some registers related to PWM configuration after sleep.
463 * This function must be used in conjunction with the hal_pwm_suspend_reg().
464 * @param[in] p_pwm: Pointer to a PWM handle which contains the configuration
465 * information for the specified PWM module.
466 * @retval ::HAL_OK: Operation is OK.
467 * @retval ::HAL_ERROR: Parameter error or operation not supported.
468 * @retval ::HAL_BUSY: Driver is busy.
469 * @retval ::HAL_TIMEOUT: Timeout occurred.
470 ****************************************************************************************
471 */
472 hal_status_t hal_pwm_resume_reg(pwm_handle_t *p_pwm);
473
474 /**
475 ****************************************************************************************
476 * @brief Initialize the PWM channels according to the specified
477 * parameters in the pwm_init_t.
478 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
479 * @param[in] p_config: PWM Channels configuration structure.
480 * @param[in] channel: PWM Channels to be configured.
481 * This parameter can be one of the following values:
482 * @arg @ref HAL_PWM_ACTIVE_CHANNEL_A :PWM Channel A is active
483 * @arg @ref HAL_PWM_ACTIVE_CHANNEL_B :PWM Channel B is active
484 * @arg @ref HAL_PWM_ACTIVE_CHANNEL_C :PWM Channel C is active
485 * @arg @ref HAL_PWM_ACTIVE_CHANNEL_ALL :All Channels are active
486 * @retval ::HAL_OK: Operation is OK.
487 * @retval ::HAL_ERROR: Parameter error or operation not supported.
488 * @retval ::HAL_BUSY: Driver is busy.
489 * @retval ::HAL_TIMEOUT: Timeout occurred.
490 ****************************************************************************************
491 */
492 hal_status_t hal_pwm_config_channel(pwm_handle_t *p_pwm, pwm_channel_init_t *p_config, hal_pwm_active_channel_t channel);
493
494 /**
495 ****************************************************************************************
496 * @brief Set the specified PWM channel inactive
497 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
498 * @param[in] channel: PWM Channels to be configured.
499 * @retval ::HAL_OK: Operation is OK.
500 * @retval ::HAL_ERROR: Parameter error or operation not supported.
501 * @retval ::HAL_BUSY: Driver is busy.
502 * @retval ::HAL_TIMEOUT: Timeout occurred.
503 ****************************************************************************************
504 */
505 hal_status_t hal_pwm_inactive_channel(pwm_handle_t *p_pwm, hal_pwm_active_channel_t channel);
506
507 /** @} */
508
509 /** @addtogroup PWM_Exported_Functions_Group3 Peripheral Control and State functions
510 * @brief PWM Peripheral State functions
511 *
512 @verbatim
513 ==============================================================================
514 ##### Peripheral Control and State functions #####
515 ==============================================================================
516 [..]
517 This subsection provides functions allowing to :
518 (+) Return the PWM handle state.
519
520 @endverbatim
521 * @{
522 */
523
524 /**
525 ****************************************************************************************
526 * @brief Return the PWM handle state.
527 * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration
528 * information for the specified PWM module.
529 * @retval ::HAL_PWM_STATE_RESET: Peripheral is not initialized or disabled.
530 * @retval ::HAL_PWM_STATE_READY: Peripheral is initialized and ready for use.
531 * @retval ::HAL_PWM_STATE_BUSY: An internal process is ongoing.
532 * @retval ::HAL_PWM_STATE_ERROR: Reception process is ongoing.
533 ****************************************************************************************
534 */
535 hal_pwm_state_t hal_pwm_get_state(pwm_handle_t *p_pwm);
536
537 /** @} */
538
539 /** @} */
540
541 #ifdef __cplusplus
542 }
543 #endif
544
545 #endif /* __GR55xx_HAL_PWM_H__ */
546
547 /** @} */
548
549 /** @} */
550
551 /** @} */
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
pwm_init_t
PWM init Structure definition.
Definition: gr55xx_hal_pwm.h:130
hal_pwm_suspend_reg
hal_status_t hal_pwm_suspend_reg(pwm_handle_t *p_pwm)
Suspend some registers related to PWM configuration before sleep.
hal_pwm_init
hal_status_t hal_pwm_init(pwm_handle_t *p_pwm)
Initialize the PWM mode according to the specified parameters in the pwm_init_t and initialize the as...
HAL_PWM_STATE_ERROR
@ HAL_PWM_STATE_ERROR
Reception process is ongoing
Definition: gr55xx_hal_pwm.h:80
_hal_pwm_callback
HAL_PWM Callback function definition.
Definition: gr55xx_hal_pwm.h:198
pwm_channel_init_t
PWM Channel init Structure definition.
Definition: gr55xx_hal_pwm.h:115
hal_pwm_callback_t
struct _hal_pwm_callback hal_pwm_callback_t
HAL_PWM Callback function definition.
HAL_PWM_STATE_BUSY
@ HAL_PWM_STATE_BUSY
An internal process is ongoing
Definition: gr55xx_hal_pwm.h:79
pwm_handle_t::p_instance
pwm_regs_t * p_instance
Register base address
Definition: gr55xx_hal_pwm.h:167
hal_pwm_msp_deinit
void hal_pwm_msp_deinit(pwm_handle_t *p_pwm)
De-initialize the PWM MSP.
pwm_init_t::mode
uint32_t mode
Specifies the PWM output mode state.
Definition: gr55xx_hal_pwm.h:131
pwm_init_t::hperiod
uint32_t hperiod
Specifies the PWM hold period in breath mode.
Definition: gr55xx_hal_pwm.h:143
HAL_PWM_STATE_READY
@ HAL_PWM_STATE_READY
Peripheral is initialized and ready for use.
Definition: gr55xx_hal_pwm.h:78
hal_pwm_state_t
hal_pwm_state_t
HAL PWM State Enumerations definition.
Definition: gr55xx_hal_pwm.h:76
pwm_init_t::bstoplvl
uint32_t bstoplvl
Specifies the PWM io level when stop.
Definition: gr55xx_hal_pwm.h:146
pwm_init_t::freq
uint32_t freq
Specifies the PWM frequency.
Definition: gr55xx_hal_pwm.h:137
hal_pwm_deinit
hal_status_t hal_pwm_deinit(pwm_handle_t *p_pwm)
De-initialize the PWM peripheral.
HAL_PWM_ACTIVE_CHANNEL_C
@ HAL_PWM_ACTIVE_CHANNEL_C
The active channel is C
Definition: gr55xx_hal_pwm.h:95
pwm_handle_t::init
pwm_init_t init
Required parameters for PWM Base.
Definition: gr55xx_hal_pwm.h:169
pwm_init_t::channel_c
pwm_channel_init_t channel_c
Specifies the configuration parameters of channel C.
Definition: gr55xx_hal_pwm.h:153
HAL_PWM_ACTIVE_CHANNEL_B
@ HAL_PWM_ACTIVE_CHANNEL_B
The active channel is B
Definition: gr55xx_hal_pwm.h:94
hal_pwm_stop
hal_status_t hal_pwm_stop(pwm_handle_t *p_pwm)
Stops the PWM signal generation on the output.
hal_pwm_resume_reg
hal_status_t hal_pwm_resume_reg(pwm_handle_t *p_pwm)
Restore some registers related to PWM configuration after sleep.
pwm_handle_t::lock
__IO hal_lock_t lock
Lock object
Definition: gr55xx_hal_pwm.h:173
hal_pwm_active_channel_t
hal_pwm_active_channel_t
HAL PWM active channel Enumerations definition.
Definition: gr55xx_hal_pwm.h:92
gr55xx_ll_pwm.h
Header file containing functions prototypes of PWM LL library.
pwm_handle_t
PWM handle Structure definition.
Definition: gr55xx_hal_pwm.h:166
HAL_PWM_STATE_RESET
@ HAL_PWM_STATE_RESET
Peripheral is not initialized or disabled
Definition: gr55xx_hal_pwm.h:77
pwm_init_t::channel_b
pwm_channel_init_t channel_b
Specifies the configuration parameters of channel B.
Definition: gr55xx_hal_pwm.h:151
HAL_PWM_ACTIVE_CHANNEL_ALL
@ HAL_PWM_ACTIVE_CHANNEL_ALL
The active channels are ALL.
Definition: gr55xx_hal_pwm.h:96
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
pwm_channel_init_t::fstoplvl
uint32_t fstoplvl
Specifies the PWM io level when stop.
Definition: gr55xx_hal_pwm.h:122
hal_pwm_start
hal_status_t hal_pwm_start(pwm_handle_t *p_pwm)
Starts the PWM signal generation on the output.
pwm_init_t::align
uint32_t align
Specifies the PWM alignment mode with three channels This parameter can be a value of PWM Pulses Alig...
Definition: gr55xx_hal_pwm.h:134
pwm_handle_t::state
__IO hal_pwm_state_t state
PWM operation state
Definition: gr55xx_hal_pwm.h:175
HAL_PWM_ACTIVE_CHANNEL_A
@ HAL_PWM_ACTIVE_CHANNEL_A
The active channel is A
Definition: gr55xx_hal_pwm.h:93
hal_pwm_get_state
hal_pwm_state_t hal_pwm_get_state(pwm_handle_t *p_pwm)
Return the PWM handle state.
_hal_pwm_callback::pwm_msp_init
void(* pwm_msp_init)(pwm_handle_t *p_pwm)
PWM init MSP callback
Definition: gr55xx_hal_pwm.h:199
pwm_channel_init_t::drive_polarity
uint8_t drive_polarity
Specifies the drive polarity in PWM output mode.
Definition: gr55xx_hal_pwm.h:119
hal_pwm_msp_init
void hal_pwm_msp_init(pwm_handle_t *p_pwm)
Initialize the PWM MSP.
hal_pwm_config_channel
hal_status_t hal_pwm_config_channel(pwm_handle_t *p_pwm, pwm_channel_init_t *p_config, hal_pwm_active_channel_t channel)
Initialize the PWM channels according to the specified parameters in the pwm_init_t.
hal_pwm_inactive_channel
hal_status_t hal_pwm_inactive_channel(pwm_handle_t *p_pwm, hal_pwm_active_channel_t channel)
Set the specified PWM channel inactive.
pwm_channel_init_t::duty
uint8_t duty
Specifies the duty in PWM output mode.
Definition: gr55xx_hal_pwm.h:116
HAL_PWM_ACTIVE_CHANNEL_CLEARED
@ HAL_PWM_ACTIVE_CHANNEL_CLEARED
All active channels are cleared.
Definition: gr55xx_hal_pwm.h:97
pwm_init_t::bperiod
uint32_t bperiod
Specifies the PWM breath period in breath mode.
Definition: gr55xx_hal_pwm.h:140
hal_pwm_update_freq
hal_status_t hal_pwm_update_freq(pwm_handle_t *p_pwm, uint32_t freq)
Update the PWM frequency on the output.
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
pwm_init_t::channel_a
pwm_channel_init_t channel_a
Specifies the configuration parameters of channel A.
Definition: gr55xx_hal_pwm.h:149
pwm_handle_t::active_channel
hal_pwm_active_channel_t active_channel
Active channel
Definition: gr55xx_hal_pwm.h:171
_hal_pwm_callback::pwm_msp_deinit
void(* pwm_msp_deinit)(pwm_handle_t *p_pwm)
PWM de-init MSP callback
Definition: gr55xx_hal_pwm.h:200