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 */
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 */
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 
123 
124 /**
125  * @brief PWM init Structure definition
126  */
127 typedef struct
128 {
129  uint32_t mode; /**< Specifies the PWM output mode state.
130  This parameter can be a value of @ref PWM_Mode */
131 
132  uint32_t align; /**< Specifies the PWM alignment mode with three channels
133  This parameter can be a value of @ref PWM_Alignment_Mode */
134 
135  uint32_t freq; /**< Specifies the PWM frequency.
136  This parameter must be a number between 0 ~ SystemFreq/2 (max = 32Mhz).*/
137 
138  uint32_t bperiod; /**< Specifies the PWM breath period in breath mode. Unit: ms.
139  This parameter must be a number between 0 ~ 0xFFFFFFFF/SystemFreq*1000. */
140 
141  uint32_t hperiod; /**< Specifies the PWM hold period in breath mode. Unit: ms.
142  This parameter must be a number between 0 ~ 0xFFFFFF/SystemFreq*1000. */
143 
144  pwm_channel_init_t channel_a; /**< Specifies the configuration parameters of channel A. */
145 
146  pwm_channel_init_t channel_b; /**< Specifies the configuration parameters of channel B. */
147 
148  pwm_channel_init_t channel_c; /**< Specifies the configuration parameters of channel C. */
149 
150 } pwm_init_t;
151 /** @} */
152 
153 /** @defgroup PWM_handle PWM handle
154  * @{
155  */
156 
157 /**
158  * @brief PWM handle Structure definition
159  */
160 typedef struct
161 {
162  pwm_regs_t *p_instance; /**< Register base address */
163 
164  pwm_init_t init; /**< Required parameters for PWM Base */
165 
166  hal_pwm_active_channel_t active_channel; /**< Active channel */
167 
168  __IO hal_lock_t lock; /**< Lock object */
169 
170  __IO hal_pwm_state_t state; /**< PWM operation state */
171 
172  uint32_t retention[11]; /**< PWM important register information. */
173 
174 } pwm_handle_t;
175 
176 /** @} */
177 
178 /** @} */
179 
180 /** @addtogroup HAL_PWM_CALLBACK_STRUCTURES Callback Structures
181  * @{
182  */
183 
184 /** @defgroup HAL_PWM_Callback Callback
185  * @{
186  */
187 
188 /**
189  * @brief HAL_PWM Callback function definition
190  */
191 
192 typedef struct _hal_pwm_callback
193 {
194  void (*pwm_msp_init)(pwm_handle_t *p_pwm); /**< PWM init MSP callback */
195  void (*pwm_msp_deinit)(pwm_handle_t *p_pwm); /**< PWM de-init MSP callback */
197 
198 /** @} */
199 
200 /** @} */
201 
202 /**
203  * @defgroup HAL_PWM_MACRO Defines
204  * @{
205  */
206 
207 /* Exported constants --------------------------------------------------------*/
208 /** @defgroup PWM_Exported_Constants PWM Exported Constants
209  * @{
210  */
211 
212 /** @defgroup PWM_Mode PWM Mode
213  * @{
214  */
215 #define PWM_MODE_FLICKER LL_PWM_FLICKER_MODE /**< PWM flicker mode */
216 #define PWM_MODE_BREATH LL_PWM_BREATH_MODE /**< PWM breath mode */
217 /** @} */
218 
219 /** @defgroup PWM_Alignment_Mode PWM Pulses Aligned.
220  * @{
221  */
222 #define PWM_ALIGNED_EDGE LL_PWM_EDGE_ALIGNED /**< PWM edge-aligned */
223 #define PWM_ALIGNED_CENTER LL_PWM_CENTER_ALIGNED /**< PWM center-aligned */
224 /** @} */
225 
226 /** @defgroup PWM_Drive_Polarity PWM Drive Polarity
227  * @{
228  */
229 #define PWM_DRIVEPOLARITY_NEGATIVE LL_PWM_DRIVEPOLARITY_NEGATIVE /**< PWM led-negative-drive mode */
230 #define PWM_DRIVEPOLARITY_POSITIVE LL_PWM_DRIVEPOLARITY_POSITIVE /**< PWM led-positive-drive mode */
231 /** @} */
232 /** @} */
233 
234 /* Exported macro ------------------------------------------------------------*/
235 /** @defgroup PWM_Exported_Macros PWM Exported Macros
236  * @{
237  */
238 
239 /** @brief Reset PWM handle states.
240  * @param __HANDLE__ PWM handle.
241  * @retval None
242  */
243 #define __HAL_PWM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PWM_STATE_RESET)
244 
245 /** @brief Enable the specified PWM peripheral.
246  * @param __HANDLE__ specifies the PWM Handle.
247  * @retval None
248  */
249 #define __HAL_PWM_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
250 
251 /** @brief Disable the specified PWM peripheral.
252  * @param __HANDLE__ specifies the PWM Handle.
253  * @retval None
254  */
255 #define __HAL_PWM_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
256 
257 /** @brief Enable PWM breath mode.
258  * @param __HANDLE__ specifies the PWM Handle.
259  * @retval None
260  */
261 #define __HAL_PWM_ENABLE_BREATH(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
262 
263 /** @brief Disable PWM breath mode.
264  * @param __HANDLE__ specifies the PWM Handle.
265  * @retval None
266  */
267 #define __HAL_PWM_DISABLE_BREATH(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
268 
269 /** @} */
270 
271 /* Private macros ------------------------------------------------------------*/
272 /** @defgroup PWM_Private_Macro PWM Private Macros
273  * @{
274  */
275 
276 /**
277  * @brief Check if PWM mode is valid.
278  * @param __MODE__ PWM mode.
279  * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
280  */
281 #define IS_PWM_MODE(__MODE__) (((__MODE__) == PWM_MODE_FLICKER) || \
282  ((__MODE__) == PWM_MODE_BREATH))
283 
284 /**
285  * @brief Check if PWM Alignment mode is valid.
286  * @param __MODE__ PWM Alignment mode.
287  * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
288  */
289 #define IS_PWM_ALIGNMENT_MODE(__MODE__) (((__MODE__) == PWM_EDGE) || \
290  ((__MODE__) == PWM_CENTER))
291 
292 /**
293  * @brief Check if PWM drive polarity is valid.
294  * @param __POLARITY__ PWM drive polarity.
295  * @retval SET (__POLARITY__ is valid) or RESET (__POLARITY__ is invalid)
296  */
297 #define IS_PWM_DRIVEPOLARITY(__POLARITY__) (((__POLARITY__) == PWM_DRIVEPOLARITY_NEGATIVE) || \
298  ((__POLARITY__) == PWM_DRIVEPOLARITY_POSITIVE))
299 
300 /** @} */
301 
302 /** @} */
303 
304 
305 /* Exported functions --------------------------------------------------------*/
306 /** @addtogroup HAL_PWM_DRIVER_FUNCTIONS Functions
307  * @{
308  */
309 
310 /** @addtogroup PWM_Exported_Functions_Group1 Initialization and de-initialization functions
311  * @brief Initialization and de-initialization functions
312  *
313  * @verbatim
314 ===============================================================================
315  ##### Initialization and de-initialization functions #####
316  ===============================================================================
317  [..]
318  This subsection provides a set of functions allowing to initialize the PWMx.
319  (+) The parameters below can only be configured in breath mode:
320  (++) BreathPeriod
321  (++) HoldPeriod
322 
323 @endverbatim
324  * @{
325  */
326 
327 /**
328  ****************************************************************************************
329  * @brief Initialize the PWM mode according to the specified
330  * parameters in the pwm_init_t and initialize the associated handle.
331  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
332  * @retval ::HAL_OK: Operation is OK.
333  * @retval ::HAL_ERROR: Parameter error or operation not supported.
334  * @retval ::HAL_BUSY: Driver is busy.
335  * @retval ::HAL_TIMEOUT: Timeout occurred.
336  ****************************************************************************************
337  */
339 
340 /**
341  ****************************************************************************************
342  * @brief De-initialize the PWM peripheral.
343  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
344  * @retval ::HAL_OK: Operation is OK.
345  * @retval ::HAL_ERROR: Parameter error or operation not supported.
346  * @retval ::HAL_BUSY: Driver is busy.
347  * @retval ::HAL_TIMEOUT: Timeout occurred.
348  ****************************************************************************************
349  */
351 
352 /**
353  ****************************************************************************************
354  * @brief Initialize the PWM MSP.
355  * @note This function should not be modified. When the callback is needed,
356  the hal_pwm_msp_init can be implemented in the user file.
357  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
358  ****************************************************************************************
359  */
361 
362 /**
363  ****************************************************************************************
364  * @brief De-initialize the PWM MSP.
365  * @note This function should not be modified. When the callback is needed,
366  the hal_pwm_msp_deinit can be implemented in the user file.
367  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
368  ****************************************************************************************
369  */
371 
372 /** @} */
373 
374 /** @addtogroup PWM_Exported_Functions_Group2 IO operation functions
375  * @brief IO operation functions
376  *
377 @verbatim
378  ==============================================================================
379  ##### IO operation functions #####
380  ==============================================================================
381  [..]
382  This section provides functions allowing to:
383  (+) Start the PWM.
384  (+) Stop the PWM.
385  (+) Configure the specified PWM channel.
386 
387 @endverbatim
388  * @{
389  */
390 
391 /**
392  ****************************************************************************************
393  * @brief Starts the PWM signal generation on the output.
394  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
395  * @retval ::HAL_OK: Operation is OK.
396  * @retval ::HAL_ERROR: Parameter error or operation not supported.
397  * @retval ::HAL_BUSY: Driver is busy.
398  * @retval ::HAL_TIMEOUT: Timeout occurred.
399  ****************************************************************************************
400  */
402 
403 /**
404  ****************************************************************************************
405  * @brief Stops the PWM signal generation on the output.
406  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
407  * @retval ::HAL_OK: Operation is OK.
408  * @retval ::HAL_ERROR: Parameter error or operation not supported.
409  * @retval ::HAL_BUSY: Driver is busy.
410  * @retval ::HAL_TIMEOUT: Timeout occurred.
411  ****************************************************************************************
412  */
414 
415 /**
416  ****************************************************************************************
417  * @brief Update the PWM frequency on the output.
418  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
419  * @param[in] freq: This parameter ranges between min = 0 and max = SystemFreq / 2.
420  * @retval ::HAL_OK: Operation is OK.
421  * @retval ::HAL_ERROR: Parameter error or operation not supported.
422  * @retval ::HAL_BUSY: Driver is busy.
423  * @retval ::HAL_TIMEOUT: Timeout occurred.
424  ****************************************************************************************
425  */
427 
428 /**
429  ****************************************************************************************
430  * @brief Suspend some registers related to PWM configuration before sleep.
431  * @param[in] p_pwm: Pointer to a PWM handle which contains the configuration
432  * information for the specified PWM module.
433  * @retval ::HAL_OK: Operation is OK.
434  * @retval ::HAL_ERROR: Parameter error or operation not supported.
435  * @retval ::HAL_BUSY: Driver is busy.
436  * @retval ::HAL_TIMEOUT: Timeout occurred.
437  ****************************************************************************************
438  */
440 
441 /**
442  ****************************************************************************************
443  * @brief Restore some registers related to PWM configuration after sleep.
444  * This function must be used in conjunction with the hal_pwm_suspend_reg().
445  * @param[in] p_pwm: Pointer to a PWM handle which contains the configuration
446  * information for the specified PWM module.
447  * @retval ::HAL_OK: Operation is OK.
448  * @retval ::HAL_ERROR: Parameter error or operation not supported.
449  * @retval ::HAL_BUSY: Driver is busy.
450  * @retval ::HAL_TIMEOUT: Timeout occurred.
451  ****************************************************************************************
452  */
454 
455 /**
456  ****************************************************************************************
457  * @brief Initialize the PWM channels according to the specified
458  * parameters in the pwm_init_t.
459  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module.
460  * @param[in] p_config: PWM Channels configuration structure.
461  * @param[in] channel: PWM Channels to be configured.
462  * This parameter can be one of the following values:
463  * @arg @ref HAL_PWM_ACTIVE_CHANNEL_A :PWM Channel A is active
464  * @arg @ref HAL_PWM_ACTIVE_CHANNEL_B :PWM Channel B is active
465  * @arg @ref HAL_PWM_ACTIVE_CHANNEL_C :PWM Channel C is active
466  * @arg @ref HAL_PWM_ACTIVE_CHANNEL_ALL :All Channels are active
467  * @retval ::HAL_OK: Operation is OK.
468  * @retval ::HAL_ERROR: Parameter error or operation not supported.
469  * @retval ::HAL_BUSY: Driver is busy.
470  * @retval ::HAL_TIMEOUT: Timeout occurred.
471  ****************************************************************************************
472  */
474 
475 /** @} */
476 
477 /** @addtogroup PWM_Exported_Functions_Group3 Peripheral Control and State functions
478  * @brief PWM Peripheral State functions
479  *
480 @verbatim
481  ==============================================================================
482  ##### Peripheral Control and State functions #####
483  ==============================================================================
484  [..]
485  This subsection provides functions allowing to :
486  (+) Return the PWM handle state.
487 
488 @endverbatim
489  * @{
490  */
491 
492 /**
493  ****************************************************************************************
494  * @brief Return the PWM handle state.
495  * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration
496  * information for the specified PWM module.
497  * @retval ::HAL_PWM_STATE_RESET: Peripheral is not initialized or disabled.
498  * @retval ::HAL_PWM_STATE_READY: Peripheral is initialized and ready for use.
499  * @retval ::HAL_PWM_STATE_BUSY: An internal process is ongoing.
500  * @retval ::HAL_PWM_STATE_ERROR: Reception process is ongoing.
501  ****************************************************************************************
502  */
504 
505 /** @} */
506 
507 /** @} */
508 
509 #ifdef __cplusplus
510 }
511 #endif
512 
513 #endif /* __GR55xx_HAL_PWM_H__ */
514 
515 /** @} */
516 
517 /** @} */
518 
519 /** @} */
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:128
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:193
pwm_channel_init_t
PWM Channel init Structure definition.
Definition: gr55xx_hal_pwm.h:115
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:162
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:129
pwm_init_t::hperiod
uint32_t hperiod
Specifies the PWM hold period in breath mode.
Definition: gr55xx_hal_pwm.h:141
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::freq
uint32_t freq
Specifies the PWM frequency.
Definition: gr55xx_hal_pwm.h:135
hal_pwm_deinit
hal_status_t hal_pwm_deinit(pwm_handle_t *p_pwm)
De-initialize the PWM peripheral.
hal_pwm_callback_t
struct _hal_pwm_callback hal_pwm_callback_t
HAL_PWM Callback function definition.
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:164
pwm_init_t::channel_c
pwm_channel_init_t channel_c
Specifies the configuration parameters of channel C.
Definition: gr55xx_hal_pwm.h:148
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:168
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:161
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:146
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
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:132
pwm_handle_t::state
__IO hal_pwm_state_t state
PWM operation state
Definition: gr55xx_hal_pwm.h:170
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:194
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.
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:138
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:144
pwm_handle_t::active_channel
hal_pwm_active_channel_t active_channel
Active channel
Definition: gr55xx_hal_pwm.h:166
_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:195