IO operation functions

IO operation functions. More...

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_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...
 
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. This function must be used in conjunction with the hal_pwm_suspend_reg(). More...
 
hal_status_t hal_pwm_config_channel (pwm_handle_t *p_pwm, 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 (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 (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 (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 (pwm_handle_t *p_pwm)
 Return the PWM handle state. 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_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.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]p_configPWM Channels configuration structure.
[in]channelPWM Channels to be configured. This parameter can be one of the following values:
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_get_state()

hal_pwm_state_t hal_pwm_get_state ( pwm_handle_t p_pwm)

Return the PWM handle state.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
Return values
HAL_PWM_STATE_RESETPeripheral is not initialized or disabled.
HAL_PWM_STATE_READYPeripheral is initialized and ready for use.
HAL_PWM_STATE_BUSYAn internal process is ongoing.
HAL_PWM_STATE_ERRORReception process is ongoing.

◆ 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_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]channelPWM Channels to be configured.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_irq_handler()

void hal_pwm_irq_handler ( pwm_handle_t p_pwm)

PWM irq handler.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
Return values
::None

◆ hal_pwm_pause()

hal_status_t hal_pwm_pause ( pwm_handle_t p_pwm)

Pause the PWM signal generation on the output.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_resume()

hal_status_t hal_pwm_resume ( pwm_handle_t p_pwm)

Resume the PWM signal generation on the output.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout 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_pwmPointer to a PWM handle which contains the configuration information for the specified PWM module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_set_coding_data_in_one_channel()

hal_status_t hal_pwm_set_coding_data_in_one_channel ( pwm_handle_t p_pwm,
uint32_t  coding_data 
)

Set pwm coding data.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]coding_dataevery bit represent compa0 or compa1 in coding data.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_set_coding_data_in_three_channels()

hal_status_t hal_pwm_set_coding_data_in_three_channels ( pwm_handle_t p_pwm,
uint32_t  coding_data0,
uint32_t  coding_data1,
uint32_t  coding_data2 
)

Set pwm coding data.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]coding_data0every bit represent compa0 or compa1 in coding data0.
[in]coding_data1every bit represent compb0 or compb1 in coding data1.
[in]coding_data2every bit represent compc0 or compc1 in coding data2.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout 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_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_start_coding_in_one_channel()

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.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]coding_dataevery bit represent compa0 or compa1 in coding data0.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_start_coding_in_three_channels()

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.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]coding_data0every bit represent compa0 or compa1 in coding data0.
[in]coding_data1every bit represent compb0 or compb1 in coding data1.
[in]coding_data2every bit represent compc0 or compc1 in coding data2.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_pwm_start_coding_with_dma()

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.

Parameters
[in]p_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]p_datathe coding data address.
[in]sizecoding data size.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout 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_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout 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_pwmPointer to a PWM handle which contains the configuration information for the specified PWM module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout 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_pwmPointer to a PWM handle that contains the configuration information for the specified PWM module.
[in]freqThis parameter ranges between min = 0 and max = SystemFreq / 2.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.