Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_PWM_H__
53 #define __GR55xx_HAL_PWM_H__
172 uint32_t retention[11];
215 #define PWM_MODE_FLICKER LL_PWM_FLICKER_MODE
216 #define PWM_MODE_BREATH LL_PWM_BREATH_MODE
222 #define PWM_ALIGNED_EDGE LL_PWM_EDGE_ALIGNED
223 #define PWM_ALIGNED_CENTER LL_PWM_CENTER_ALIGNED
229 #define PWM_DRIVEPOLARITY_NEGATIVE LL_PWM_DRIVEPOLARITY_NEGATIVE
230 #define PWM_DRIVEPOLARITY_POSITIVE LL_PWM_DRIVEPOLARITY_POSITIVE
243 #define __HAL_PWM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PWM_STATE_RESET)
249 #define __HAL_PWM_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
255 #define __HAL_PWM_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
261 #define __HAL_PWM_ENABLE_BREATH(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
267 #define __HAL_PWM_DISABLE_BREATH(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
281 #define IS_PWM_MODE(__MODE__) (((__MODE__) == PWM_MODE_FLICKER) || \
282 ((__MODE__) == PWM_MODE_BREATH))
289 #define IS_PWM_ALIGNMENT_MODE(__MODE__) (((__MODE__) == PWM_EDGE) || \
290 ((__MODE__) == PWM_CENTER))
297 #define IS_PWM_DRIVEPOLARITY(__POLARITY__) (((__POLARITY__) == PWM_DRIVEPOLARITY_NEGATIVE) || \
298 ((__POLARITY__) == PWM_DRIVEPOLARITY_POSITIVE))
hal_lock_t
HAL Lock structures definition.
PWM init Structure definition.
hal_status_t hal_pwm_suspend_reg(pwm_handle_t *p_pwm)
Suspend some registers related to PWM configuration before sleep.
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
Reception process is ongoing
HAL_PWM Callback function definition.
PWM Channel init Structure definition.
@ HAL_PWM_STATE_BUSY
An internal process is ongoing
pwm_regs_t * p_instance
Register base address
void hal_pwm_msp_deinit(pwm_handle_t *p_pwm)
De-initialize the PWM MSP.
uint32_t mode
Specifies the PWM output mode state.
uint32_t hperiod
Specifies the PWM hold period in breath mode.
@ HAL_PWM_STATE_READY
Peripheral is initialized and ready for use.
hal_pwm_state_t
HAL PWM State Enumerations definition.
uint32_t freq
Specifies the PWM frequency.
hal_status_t hal_pwm_deinit(pwm_handle_t *p_pwm)
De-initialize the PWM peripheral.
struct _hal_pwm_callback hal_pwm_callback_t
HAL_PWM Callback function definition.
@ HAL_PWM_ACTIVE_CHANNEL_C
The active channel is C
pwm_init_t init
Required parameters for PWM Base.
pwm_channel_init_t channel_c
Specifies the configuration parameters of channel C.
@ HAL_PWM_ACTIVE_CHANNEL_B
The active channel is B
hal_status_t hal_pwm_stop(pwm_handle_t *p_pwm)
Stops the PWM signal generation on the output.
hal_status_t hal_pwm_resume_reg(pwm_handle_t *p_pwm)
Restore some registers related to PWM configuration after sleep.
__IO hal_lock_t lock
Lock object
hal_pwm_active_channel_t
HAL PWM active channel Enumerations definition.
Header file containing functions prototypes of PWM LL library.
PWM handle Structure definition.
@ HAL_PWM_STATE_RESET
Peripheral is not initialized or disabled
pwm_channel_init_t channel_b
Specifies the configuration parameters of channel B.
@ HAL_PWM_ACTIVE_CHANNEL_ALL
The active channels are ALL.
hal_status_t
HAL Status structures definition.
hal_status_t hal_pwm_start(pwm_handle_t *p_pwm)
Starts the PWM signal generation on the output.
uint32_t align
Specifies the PWM alignment mode with three channels This parameter can be a value of PWM Pulses Alig...
__IO hal_pwm_state_t state
PWM operation state
@ HAL_PWM_ACTIVE_CHANNEL_A
The active channel is A
hal_pwm_state_t hal_pwm_get_state(pwm_handle_t *p_pwm)
Return the PWM handle state.
void(* pwm_msp_init)(pwm_handle_t *p_pwm)
PWM init MSP callback
uint8_t drive_polarity
Specifies the drive polarity in PWM output mode.
void hal_pwm_msp_init(pwm_handle_t *p_pwm)
Initialize the PWM MSP.
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.
uint8_t duty
Specifies the duty in PWM output mode.
@ HAL_PWM_ACTIVE_CHANNEL_CLEARED
All active channels are cleared.
uint32_t bperiod
Specifies the PWM breath period in breath mode.
hal_status_t hal_pwm_update_freq(pwm_handle_t *p_pwm, uint32_t freq)
Update the PWM frequency on the output.
This file contains HAL common definitions, enumeration, macros and structures definitions.
pwm_channel_init_t channel_a
Specifies the configuration parameters of channel A.
hal_pwm_active_channel_t active_channel
Active channel
void(* pwm_msp_deinit)(pwm_handle_t *p_pwm)
PWM de-init MSP callback