libpynq (release 5EWC0-2023 version 0.2.3 of 2023-10-06 18:15)
|
Enumerations | |
enum | pwm_index_t { PWM0 , PWM1 , PWM2 , PWM3 , PWM4 , PWM5 , NUM_PWMS } |
Functions | |
bool | pwm_initialized (const int pwm) |
void | pwm_init (const int pwm, const uint32_t period) |
void | pwm_destroy (const int pwm) |
void | pwm_set_duty_cycle (const int pwm, const uint32_t duty) |
void | pwm_set_period (const int pwm, const uint32_t period) |
uint32_t | pwm_get_period (const int pwm) |
uint32_t | pwm_get_duty_cycle (const int pwm) |
void | pwm_set_steps (const int pwm, const uint32_t steps) |
uint32_t | pwm_get_steps (const int pwm) |
Functions to use Pulse Width Modulation (PWM).
Each of the 6 PWM channels (numbered 0..NUM_PWMS-1) can be linked to any mappable pin (e.g. green or color LEDs, buttons).
PWM can also be used through GPIO (see gpio.h and pinmap.h). Note that GPIO numbering (SWB_PWM0..SWB_PWM5) is then used instead of 0..NUM_PWMS-1 (PWM0..PWM5).
enum pwm_index_t |
void pwm_destroy | ( | const int | pwm | ) |
uint32_t pwm_get_duty_cycle | ( | const int | pwm | ) |
Gets the duty cycle of the specified PWM channel.
pwm | The PWM channel. |
Definition at line 78 of file pwm.c.
uint32_t pwm_get_period | ( | const int | pwm | ) |
Returns the period of a certain PWM channel.
pwm | The PWM channel. |
Definition at line 83 of file pwm.c.
uint32_t pwm_get_steps | ( | const int | pwm | ) |
Get the number of steps a certain channel has taken so far.
pwm | PWM channel. |
Definition at line 98 of file pwm.c.
void pwm_init | ( | const int | pwm, |
const uint32_t | period | ||
) |
Initializes the PWM channel with the specified period.
pwm | the PWM channel to initialize. |
period | The period to set for the PWM channel. |
Definition at line 61 of file pwm.c.
bool pwm_initialized | ( | const int | pwm | ) |
void pwm_set_duty_cycle | ( | const int | pwm, |
const uint32_t | duty | ||
) |
Sets the duty cycle for the specified PWM channel.
pwm | The PWM channel. |
duty | The duty cycle to set for the PWM channel. |
Definition at line 93 of file pwm.c.
void pwm_set_period | ( | const int | pwm, |
const uint32_t | period | ||
) |
void pwm_set_steps | ( | const int | pwm, |
const uint32_t | steps | ||
) |
Generates steps steps on the PWM channel.
pwm | The PWM channel. |
steps | The number of steps to cycle, 0 to turn off and -1 to run continously. |
Definition at line 103 of file pwm.c.