Functions for using Pulse-Width-Modulation (PWM) peripheral. More...

Functions

zos_result_t zn_pwm_update (zos_gpio_t gpio, uint32_t duty_cycle, uint32_t frequency)
 Enable/update PWM on specified GPIO. More...
 
zos_result_t zn_pwm_update_with_resolution (zos_gpio_t gpio, uint32_t duty_cycle, uint32_t frequency)
 Enable/update PWM on specified GPIO with fine resolution. More...
 
zos_result_t zn_pwm_stop (zos_gpio_t gpio)
 Disable PWM on specified GPIO. More...
 

Detailed Description

Functions for using Pulse-Width-Modulation (PWM) peripheral.

Function Documentation

zos_result_t zn_pwm_stop ( zos_gpio_t  gpio)

Disable PWM on specified GPIO.

See ZentriOS Command API documentation: pwm_update.

Parameters
[in]gpioGPIO of corresponding PWM to disable
Returns
result of API, see zos_result_t
zos_result_t zn_pwm_update ( zos_gpio_t  gpio,
uint32_t  duty_cycle,
uint32_t  frequency 
)

Enable/update PWM on specified GPIO.

See ZentriOS Command API documentation: pwm_update.

Parameters
[in]gpioGPIO of corresponding PWM to enable/update
[in]duty_cycleDuty cycle of PWM, 0-100
[in]frequencyFrequency of PWM in Hz
Returns
result of API, see zos_result_t
Examples:
cloud/s2cdemo/zentri_platform_streams.c.
zos_result_t zn_pwm_update_with_resolution ( zos_gpio_t  gpio,
uint32_t  duty_cycle,
uint32_t  frequency 
)

Enable/update PWM on specified GPIO with fine resolution.

This has the same functionality as zn_pwm_update() exception the duty_cycle argument is padded with 100 to enable finer resolution.

For example, a duty cycle of 34.78% would be 3478`.

Parameters
gpiogpio GPIO of corresponding PWM to enable/update
duty_cycleduty cycle of PWM, padded with 100, 0-10000 (for 0.00 to 100.00%)
frequencyFrequency of PWM in Hz
Returns
result of API, see zos_result_t