Pulse-Width Modulation. More...
Data Structures | |
struct | pwm_channel_attr_t |
Macros | |
#define | PWM_MIN_PCNT (0.0f) |
#define | PWM_MAX_PCNT (100.0f) |
Enumerations | |
enum | pwm_result_t { PWM_RESULT_OK , PWM_RESULT_INVALID , PWM_RESULT_UNSUPPORTED , PWM_RESULT_BUSY , PWM_RESULT_ERR , TOTAL_PWM_RESULT } |
enum | pwm_alignment_t { PWM_ALIGNMENT_EDGE , PWM_ALIGNMENT_CENTER , TOTAL_PWM_ALIGNMENT } |
Functions | |
pwm_result_t | hal_pwm_init (const pwm_channel_attr_t attr) |
Configure PWM channel with specific attributes. | |
pwm_result_t | hal_pwm_start (const gpio_pin_t pin) |
Start generate PWM pulses. | |
pwm_result_t | hal_pwm_update (const gpio_pin_t pin, const float duty_cycle_pcnt) |
Update PWM duty cycles. | |
pwm_result_t | hal_pwm_stop (const gpio_pin_t pin) |
Stop PWM operation. | |
pwm_result_t | hal_pwm_mutex_take (const gpio_pin_t pin, const uint32_t timeout_ms) |
Try acquire RTOS mutex for specified pin. | |
pwm_result_t | hal_pwm_mutex_give (const gpio_pin_t pin) |
Release RTOS mutex for specified pin. | |
Pulse-Width Modulation.
#define PWM_MAX_PCNT (100.0f) |
#include <pwm/public_inc/hal_pwm.h>
#define PWM_MIN_PCNT (0.0f) |
#include <pwm/public_inc/hal_pwm.h>
enum pwm_alignment_t |
#include <pwm/public_inc/hal_pwm.h>
Enumerator | |
---|---|
PWM_ALIGNMENT_EDGE | |
PWM_ALIGNMENT_CENTER | |
TOTAL_PWM_ALIGNMENT |
enum pwm_result_t |
#include <pwm/public_inc/hal_pwm.h>
Enumerator | |
---|---|
PWM_RESULT_OK | No error. |
PWM_RESULT_INVALID | Operation invalid. |
PWM_RESULT_UNSUPPORTED | Operation not supported. |
PWM_RESULT_BUSY | Busy busy. |
PWM_RESULT_ERR | Error occurred. |
TOTAL_PWM_RESULT |
pwm_result_t hal_pwm_init | ( | const pwm_channel_attr_t | attr | ) |
#include <pwm/public_inc/hal_pwm.h>
Configure PWM channel with specific attributes.
[in] | attr | PWM channel attributes |
PWM_RESULT_OK | Success configure PWM channel |
PWM_RESULT_INVALID | Configuration attributes invalid |
PWM_RESULT_UNSUPPORTED | Operation not supported |
PWM_RESULT_ERR | Failed configure PWM channel |
pwm_result_t hal_pwm_mutex_give | ( | const gpio_pin_t | pin | ) |
#include <pwm/public_inc/hal_pwm.h>
Release RTOS mutex for specified pin.
[in] | pin | PWM pin's mutex to be released |
PWM_RESULT_OK | Success release mutex |
PWM_RESULT_INVALID | Invalid pin |
PWM_RESULT_UNSUPPORTED | Operation not supported |
PWM_RESULT_ERR | Failed release mutex |
pwm_result_t hal_pwm_mutex_take | ( | const gpio_pin_t | pin, |
const uint32_t | timeout_ms ) |
#include <pwm/public_inc/hal_pwm.h>
Try acquire RTOS mutex for specified pin.
[in] | pin | PWM pin's mutex to be locked |
[in] | timeout_ms | Mutex acquiring timeout in milliseconds |
PWM_RESULT_OK | Success acquire mutex |
PWM_RESULT_INVALID | Invalid pin |
PWM_RESULT_UNSUPPORTED | Operation not supported |
PWM_RESULT_ERR | Failed acquire mutex |
pwm_result_t hal_pwm_start | ( | const gpio_pin_t | pin | ) |
#include <pwm/public_inc/hal_pwm.h>
Start generate PWM pulses.
[in] | pin | PWM pin |
PWM_RESULT_OK | Success start PWM |
PWM_RESULT_ERR | Failed to start PWM |
pwm_result_t hal_pwm_stop | ( | const gpio_pin_t | pin | ) |
#include <pwm/public_inc/hal_pwm.h>
Stop PWM operation.
[in] | pin | PWM pin |
SPI_RESULT_OK | Success stop PWM operation |
SPI_RESULT_UNSUPPORTED | Operation not supported |
SPI_RESULT_ERR | Failed stop PWM operation |
pwm_result_t hal_pwm_update | ( | const gpio_pin_t | pin, |
const float | duty_cycle_pcnt ) |
#include <pwm/public_inc/hal_pwm.h>
Update PWM duty cycles.
[in] | pin | PWM pin |
[in] | duty_cycle_pcnt | PWM duty cycle in percent to be set |
PWM_RESULT_OK | Success update PWM duty cycle |
PWM_RESULT_ERR | Failed to update PWM duty cycle |