Functions
IO operation functions
Peripheral Driver » HAL Driver » PWM » Functions

IO operation functions. More...

Collaboration diagram for IO operation functions:

## Functions
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_status_t | hal_pwm_inactive_channel (pwm_handle_t *p_pwm, hal_pwm_active_channel_t channel)
| Set the specified PWM channel inactive. More...

## Detailed Description

IO operation functions.

      ==============================================================================
                          ##### IO operation functions #####
      ==============================================================================
      [..]
        This section provides functions allowing to:
        (+) Start the PWM.
        (+) Stop the PWM.
        (+) Configure the specified PWM channel.

## Function Documentation

## ◆ 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.

Parameters

  [in] | p_pwm | Pointer to a PWM handle that contains the configuration information for the specified PWM module.
  [in] | p_config | PWM Channels configuration structure.
  [in] | channel | PWM Channels to be configured. This parameter can be one of the following values: HAL_PWM_ACTIVE_CHANNEL_A :PWM Channel A is active HAL_PWM_ACTIVE_CHANNEL_B :PWM Channel B is active HAL_PWM_ACTIVE_CHANNEL_C :PWM Channel C is active HAL_PWM_ACTIVE_CHANNEL_ALL :All Channels are active

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ 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.

Parameters

  [in] | p_pwm | Pointer to a PWM handle that contains the configuration information for the specified PWM module.
  [in] | channel | PWM Channels to be configured.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ 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.

This function must be used in conjunction with the hal_pwm_suspend_reg().

Parameters

  [in] | p_pwm | Pointer to a PWM handle which contains the configuration information for the specified PWM module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pwm_start()

hal_status_t hal_pwm_start | ( | pwm_handle_t * | p_pwm | ) |

Starts the PWM signal generation on the output.

Parameters

  [in] | p_pwm | Pointer to a PWM handle that contains the configuration information for the specified PWM module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pwm_stop()

hal_status_t hal_pwm_stop | ( | pwm_handle_t * | p_pwm | ) |

Stops the PWM signal generation on the output.

Parameters

  [in] | p_pwm | Pointer to a PWM handle that contains the configuration information for the specified PWM module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ 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.

Parameters

  [in] | p_pwm | Pointer to a PWM handle which contains the configuration information for the specified PWM module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ 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.

Parameters

  [in] | p_pwm | Pointer to a PWM handle that contains the configuration information for the specified PWM module.
  [in] | freq | This parameter ranges between min = 0 and max = SystemFreq / 2.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.