gr55xx_hal_pwm.h File Reference

Header file containing functions prototypes of PWM HAL library. More...

#include "gr55xx_hal_def.h"
#include "gr55xx_ll_pwm.h"
+ Include dependency graph for gr55xx_hal_pwm.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pwm_channel_init_t
 PWM Channel init Structure definition. More...
 
struct  pwm_init_t
 PWM init Structure definition. More...
 
struct  pwm_handle_t
 PWM handle Structure definition. More...
 
struct  _hal_pwm_callback
 HAL_PWM Callback function definition. More...
 

Macros

#define PWM_MODE_FLICKER   LL_PWM_FLICKER_MODE
 PWM flicker mode. More...
 
#define PWM_MODE_BREATH   LL_PWM_BREATH_MODE
 PWM breath mode
More...
 
#define PWM_ALIGNED_EDGE   LL_PWM_EDGE_ALIGNED
 PWM edge-aligned. More...
 
#define PWM_ALIGNED_CENTER   LL_PWM_CENTER_ALIGNED
 PWM center-aligned. More...
 
#define PWM_DRIVEPOLARITY_NEGATIVE   LL_PWM_DRIVEPOLARITY_NEGATIVE
 PWM led-negative-drive mode. More...
 
#define PWM_DRIVEPOLARITY_POSITIVE   LL_PWM_DRIVEPOLARITY_POSITIVE
 PWM led-positive-drive mode. More...
 
#define __HAL_PWM_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->state = HAL_PWM_STATE_RESET)
 Reset PWM handle states. More...
 
#define __HAL_PWM_ENABLE(__HANDLE__)   SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
 Enable the specified PWM peripheral. More...
 
#define __HAL_PWM_DISABLE(__HANDLE__)   CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN)
 Disable the specified PWM peripheral. More...
 
#define __HAL_PWM_ENABLE_BREATH(__HANDLE__)   SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
 Enable PWM breath mode. More...
 
#define __HAL_PWM_DISABLE_BREATH(__HANDLE__)   CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN)
 Disable PWM breath mode. More...
 
#define IS_PWM_MODE(__MODE__)
 Check if PWM mode is valid. More...
 
#define IS_PWM_ALIGNMENT_MODE(__MODE__)
 Check if PWM Alignment mode is valid. More...
 
#define IS_PWM_DRIVEPOLARITY(__POLARITY__)
 Check if PWM drive polarity is valid. More...
 

Typedefs

typedef struct _hal_pwm_callback hal_pwm_callback_t
 HAL_PWM Callback function definition. More...
 

Enumerations

enum  hal_pwm_state_t { HAL_PWM_STATE_RESET = 0x00, HAL_PWM_STATE_READY = 0x01, HAL_PWM_STATE_BUSY = 0x02, HAL_PWM_STATE_ERROR = 0x04 }
 HAL PWM State Enumerations definition. More...
 
enum  hal_pwm_active_channel_t {
  HAL_PWM_ACTIVE_CHANNEL_A = 0x01, HAL_PWM_ACTIVE_CHANNEL_B = 0x02, HAL_PWM_ACTIVE_CHANNEL_C = 0x04, HAL_PWM_ACTIVE_CHANNEL_ALL = 0x07,
  HAL_PWM_ACTIVE_CHANNEL_CLEARED = 0x00
}
 HAL PWM active channel Enumerations definition. More...
 

Functions

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 associated handle. More...
 
hal_status_t hal_pwm_deinit (pwm_handle_t *p_pwm)
 De-initialize the PWM peripheral. More...
 
void hal_pwm_msp_init (pwm_handle_t *p_pwm)
 Initialize the PWM MSP. More...
 
void hal_pwm_msp_deinit (pwm_handle_t *p_pwm)
 De-initialize the PWM MSP. More...
 
hal_status_t hal_pwm_start (pwm_handle_t *p_pwm)
 Starts the PWM signal generation on the output. More...
 
hal_status_t hal_pwm_stop (pwm_handle_t *p_pwm)
 Stops the PWM signal generation on the output. More...
 
hal_status_t hal_pwm_update_freq (pwm_handle_t *p_pwm, uint32_t freq)
 Update the PWM frequency on the output. More...
 
hal_status_t hal_pwm_suspend_reg (pwm_handle_t *p_pwm)
 Suspend some registers related to PWM configuration before sleep. More...
 
hal_status_t hal_pwm_resume_reg (pwm_handle_t *p_pwm)
 Restore some registers related to PWM configuration after sleep. More...
 
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. More...
 
hal_pwm_state_t hal_pwm_get_state (pwm_handle_t *p_pwm)
 Return the PWM handle state. More...
 

Detailed Description

Header file containing functions prototypes of PWM HAL library.

Author
BLE Driver Team
Attention
Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_hal_pwm.h.