Classes | Macros | Typedefs | Enumerations | Functions
hal_pwm.h File Reference

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

`#include "hal_def.h"`
`#include "hal_dma.h"`
`#include "ll_pwm.h"`
`#include "hal_pwr_mgmt.h"`

Go to the source code of this file.

## Classes
struct | pwm_comp_config_t
| PWM COMP value init Structure definition. More...
struct | pwm_none_coding_channel_init_t
| PWM None Coding Channel init Structure definition. More...
struct | pwm_coding_channel_init_t
| PWM Coding Channel init Structure definition. More...
struct | pwm_none_coding_init_t
| PWM None Coding Init Structure definition. More...
struct | pwm_coding_init_t
| PWM Coding 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 | HAL_PWM_ERROR_NONE (0x00000000U)
#define | HAL_PWM_CHANNEL_A_ERROR (0x00000001U)
#define | HAL_PWM_CHANNEL_B_ERROR (0x00000002U)
#define | HAL_PWM_CHANNEL_C_ERROR (0x00000004U)
#define | PWM_ALIGNED_EDGE LL_PWM_EDGE_ALIGNED
#define | PWM_ALIGNED_CENTER LL_PWM_CENTER_ALIGNED
#define | PWM_STOP_LVL_LOW LL_PWM_STOP_LVL_LOW
#define | PWM_STOP_LVL_HIGH LL_PWM_STOP_LVL_HIGH
#define | PWM_WAITING_TIME_LVL_LOW LL_PWM_WAITING_TIME_LVL_LOW
#define | PWM_WAITING_TIME_LVL_HIGH LL_PWM_WAITING_TIME_LVL_HIGH
#define | PWM_CODING_CHANNEL_ALL LL_PWM_CODING_CHANNEL_ALL
#define | PWM_CODING_CHANNEL_A LL_PWM_CODING_CHANNEL_A
#define | PWM_DRIVEPOLARITY_NEGATIVE LL_PWM_DRIVEPOLARITY_NEGATIVE
#define | PWM_DRIVEPOLARITY_POSITIVE LL_PWM_DRIVEPOLARITY_POSITIVE
#define | PWM_ACTIONEVENT_NONE LL_PWM_ACTIONEVENT_NONE
#define | PWM_ACTIONEVENT_CLEAR LL_PWM_ACTIONEVENT_CLEAR
#define | PWM_ACTIONEVENT_SET LL_PWM_ACTIONEVENT_SET
#define | PWM_ACTIONEVENT_TOGGLE LL_PWM_ACTIONEVENT_TOGGLE
#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_STOP_LVL(__MODE__)
| Check if PWM stop level is valid. More...
#define | IS_PWM_WAITING_TIME_LVL(__MODE__)
| Check if PWM waiting time level 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_mode_t { PWM_FLICKER_MODE = 0x00, PWM_BREATH_MODE, PWM_CODING_MODE }
| HAL_PWM_MODE Enumerations definition. More...
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_resume (pwm_handle_t *p_pwm)
| Resume the PWM signal generation on the output. More...
hal_status_t | hal_pwm_pause (pwm_handle_t *p_pwm)
| Pause 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...
void | hal_pwm_suspend_reg (pwm_handle_t *p_pwm)
| Suspend some registers related to PWM configuration before sleep. More...
void | hal_pwm_resume_reg (const pwm_handle_t *p_pwm)
| Restore some registers related to PWM configuration after sleep. This function must be used in conjunction with the hal_pwm_suspend_reg(). More...
hal_pm_status_t | hal_pm_pwm_suspend (pwm_handle_t *p_pwm)
| Suspend the specified PWM. More...
void | hal_pm_pwm_resume (const pwm_handle_t *p_pwm)
| Resume the specified PWM. More...
hal_status_t | hal_pwm_config_channel (pwm_handle_t *p_pwm, const pwm_none_coding_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_status_t | hal_pwm_inactive_channel (const pwm_handle_t *p_pwm, hal_pwm_active_channel_t channel)
| Set the specified PWM channel inactive. More...
hal_status_t | hal_pwm_set_coding_data_in_one_channel (const pwm_handle_t *p_pwm, uint32_t coding_data)
| Set pwm coding data. More...
hal_status_t | hal_pwm_set_coding_data_in_three_channels (const pwm_handle_t *p_pwm, uint32_t coding_data0, uint32_t coding_data1, uint32_t coding_data2)
| Set pwm coding data. More...
hal_status_t | hal_pwm_start_coding_with_dma (pwm_handle_t *p_pwm, uint32_t *p_data, uint16_t size)
| Start generate wave form in DMA mode. More...
hal_status_t | hal_pwm_start_coding_in_one_channel (pwm_handle_t *p_pwm, uint32_t coding_data)
| Start generate one channel wave form in Interrupt mode. More...
hal_status_t | hal_pwm_start_coding_in_three_channels (pwm_handle_t *p_pwm, uint32_t coding_data0, uint32_t coding_data1, uint32_t coding_data2)
| Start generate three channels wave form in Interrupt mode. More...
void | hal_pwm_irq_handler (pwm_handle_t *p_pwm)
| PWM irq handler. More...
hal_pwm_state_t | hal_pwm_get_state (const 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 hal_pwm.h.