Infineon Logo AIROC BTSDK v4.8 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

PWM Functions. More...

Functions

BOOL32 wiced_hal_pwm_start (UINT8 channel, PwmClockType clk, UINT32 toggleCount, UINT32 initCount, BOOL32 invert)
 Configures, enables, and starts the PWM to be active on a preconfigured GPIO pin. More...
 
BOOL32 wiced_hal_pwm_change_values (UINT8 channel, UINT32 toggleCount, UINT32 initCount)
 Changes the PWM settings after the PWM HW has already been started. More...
 
UINT32 wiced_hal_pwm_get_toggle_count (UINT8 channel)
 Returns the current toggle count setting for the corresponding PWM channel. More...
 
UINT32 wiced_hal_pwm_get_init_value (UINT8 channel)
 Returns the current toggle count setting for the corresponding PWM channel. More...
 
void wiced_hal_pwm_disable (UINT8 channel)
 Disables the PWM channel. More...
 
void wiced_hal_pwm_enable (UINT8 channel)
 Enables the PWM channel which is already preconfigured. More...
 
void wiced_hal_pwm_configure_pin (UINT8 pin, UINT8 PWM) __attribute__((deprecated("Please use supermux tool to configure PWM pin")))
 Configure any LHL GPIO to any PWM port. More...
 
void wiced_hal_pwm_get_params (uint32_t clock_frequency_in, uint32_t duty_cycle, uint32_t pwm_frequency_out, pwm_config_t *params_out)
 This utility API can be used calculate PWM input parameters per desired PWM output. More...
 

Detailed Description

PWM Functions.

Function Documentation

BOOL32 wiced_hal_pwm_change_values ( UINT8  channel,
UINT32  toggleCount,
UINT32  initCount 
)

Changes the PWM settings after the PWM HW has already been started.

(!) Note that the maximum width or period of the PWM is 0xFFFF (16-bits).

Parameters
[in]channel: Desired PWM channel to use [PWM0-PWM5].
[in]toggleCount: The number of ticks to wait before toggling the signal.
[in]initCount: Initial value for the counter.
Returns
: 1 if PWM was successfully changed, 0 otherwise.
void wiced_hal_pwm_configure_pin ( UINT8  pin,
UINT8  PWM 
)

Configure any LHL GPIO to any PWM port.

Parameters
[in]pin: Desired LHL GPIO to configure as PWM from wiced_bt_gpio_numbers_t.
[in]PWM: Desired PWM channel to set the pin to. [PWM0-PWM5]
Returns
: None
void wiced_hal_pwm_disable ( UINT8  channel)

Disables the PWM channel.

Parameters
[in]channel: Desired PWM channel to stop/disable. [PWM0-PWM5]
Returns
: None
void wiced_hal_pwm_enable ( UINT8  channel)

Enables the PWM channel which is already preconfigured.

Parameters
[in]channel: Desired PWM channel to enable. [PWM0-PWM5]
Returns
: None
UINT32 wiced_hal_pwm_get_init_value ( UINT8  channel)

Returns the current toggle count setting for the corresponding PWM channel.

Parameters
[in]channel: Desired PWM channel from which to obtain the initial count. [PWM0-PWM5]
Returns
: The initial count value of the PWM.
void wiced_hal_pwm_get_params ( uint32_t  clock_frequency_in,
uint32_t  duty_cycle,
uint32_t  pwm_frequency_out,
pwm_config_t params_out 
)

This utility API can be used calculate PWM input parameters per desired PWM output.

Parameters
[in]clock_frequency_in: Input clock frequency selected for specific PWM channel.
[in]duty_cycle: Ducy cycle expected in percentage for specific PWM channel.
[in]pwm_frequency_out: Desired PWM output frequency for specific PWM channel.
[out]params_out: Output parameters to be used in configuring specific PWM channel.
Returns
: None
UINT32 wiced_hal_pwm_get_toggle_count ( UINT8  channel)

Returns the current toggle count setting for the corresponding PWM channel.

Parameters
[in]channel: Desired PWM channel from which to obtain the toggle count. [PWM0-PWM5]
Returns
: The value at which the PWM is going to toggle.
BOOL32 wiced_hal_pwm_start ( UINT8  channel,
PwmClockType  clk,
UINT32  toggleCount,
UINT32  initCount,
BOOL32  invert 
)

Configures, enables, and starts the PWM to be active on a preconfigured GPIO pin.

(!) Note that the desired GPIO pin must have already been configured as output. See device datasheet of your device for more information.

(!) Note that if you use PMU_CLK instead of LHL_CLK, a call to wiced_hal_aclk_enable() is required for configuring ACLK1.

(!) Note that the maximum width or period of the PWM is 0xFFFF (16-bits).

Parameters
[in]channel: Desired PWM channel to use [PWM0-PWM5].
[in]PwmClockType: Clock source for this PWM channel based on desired frequency.
[in]toggleCount: The number of ticks to wait before toggling the signal.
[in]initCount: Initial value for the counter.
[in]invert: 1 to invert the signal.
Returns
: 1 if PWM was successfully started, 0 otherwise.