PMSIS API
|
Data Structures | |
struct | pi_pwm_conf |
PWM configuration structure. More... | |
struct | pi_pwm_ioctl_ch_config |
PWM ioctl channel config arg struct. More... | |
struct | pi_pwm_ioctl_evt |
PWM ioctl event output arg struct. More... | |
Macros | |
#define | PI_PWM_CONFIG_INSEL_OFFSET |
#define | PI_PWM_CONFIG_EVT_OFFSET |
#define | PI_PWM_CONFIG_CLKSEL_OFFSET |
#define | PI_PWM_CONFIG_UPDOWNSEL_OFFSET |
#define | PI_PWM_CONFIG_PRESCALER_OFFSET |
#define | PI_PWM_EVENT_OUTPUT(pwm, channel) |
Enumerations | |
enum | pi_pwm_cmd_e |
PWM timer commands. More... | |
enum | pi_pwm_timer_conf_e |
PWM timer config. More... | |
enum | pi_pwm_ch_config_e |
PWM channel configuration. More... | |
enum | pi_pwm_channel_e |
PWM channels. More... | |
enum | pi_pwm_evt_sel_e |
Event output selection. More... | |
enum | pi_pwm_output_evt_e |
Output event source selection. More... | |
enum | pi_pwm_ioctl_cmd_e |
PWM ioctl commands. More... | |
Functions | |
void | pi_pwm_conf_init (struct pi_pwm_conf *conf) |
Initialize a PWM configuration structure. More... | |
int32_t | pi_pwm_open (struct pi_device *device) |
Open a PWM device. More... | |
void | pi_pwm_close (struct pi_device *device) |
Close a PWM device. More... | |
int32_t | pi_pwm_ioctl (struct pi_device *device, pi_pwm_ioctl_cmd_e cmd, void *arg) |
PWM ioctl command. More... | |
uint32_t | pi_pwm_counter_get (struct pi_device *device) |
Get PWM timer value. More... | |
static void | pi_pwm_timer_start (struct pi_device *device) |
Start PWM timer. More... | |
static void | pi_pwm_timer_stop (struct pi_device *device) |
Stop PWM timer. More... | |
int32_t | pi_pwm_duty_cycle_set (struct pi_device *device, uint32_t frequency, uint8_t duty_cycle) |
Set PWM frequency and duty_cycle. More... | |
#define PI_PWM_CONFIG_CLKSEL_OFFSET |
PWM timer clock source selection offset.
#define PI_PWM_CONFIG_EVT_OFFSET |
PWM timer event trigger offset.
#define PI_PWM_CONFIG_INSEL_OFFSET |
PWM timer input source selection offset.
#define PI_PWM_CONFIG_PRESCALER_OFFSET |
PWM timer prescaler value offset.
#define PI_PWM_CONFIG_UPDOWNSEL_OFFSET |
PWM timer counting method offset.
#define PI_PWM_EVENT_OUTPUT | ( | pwm, | |
channel | |||
) |
PWM output event source selection.
enum pi_pwm_ch_config_e |
Action to perform when a PWM channel's threshold match.
enum pi_pwm_channel_e |
enum pi_pwm_cmd_e |
enum pi_pwm_evt_sel_e |
enum pi_pwm_ioctl_cmd_e |
PWM ioctl commands to set timer threshold, change channel configuration,...
Enumerator | |
---|---|
PI_PWM_TIMER_COMMAND |
Timer execution command. |
PI_PWM_TIMER_CONFIG |
Timer config command. |
PI_PWM_TIMER_THRESH |
Timer threshold setting command. |
PI_PWM_CH_CONFIG |
PWM channel config command. |
PI_PWM_EVENT_SET |
PWM output event set command. |
PI_PWM_EVENT_CLEAR |
PWM output event clear command. |
PI_PWM_RESET_FREQ |
Stop PWM timer and zero frequency. This is to be used when reconfiguring timer frequency that has been set with pi_pwm_duty_cycle_set(). |
PI_PWM_ATTACH_CB |
Attach user callback to an IRQ. |
enum pi_pwm_output_evt_e |
Ouput event source selection(actual event).
enum pi_pwm_timer_conf_e |
PWM timer configuration.
void pi_pwm_close | ( | struct pi_device * | device | ) |
This function closes a PWM device. It enables PWM device clock gating and disable events of the selected PWM device.
device | Device structure. |
void pi_pwm_conf_init | ( | struct pi_pwm_conf * | conf | ) |
This function initializes a PWM configuration structure with default values.
conf | PWM configuration structure. |
uint32_t pi_pwm_counter_get | ( | struct pi_device * | device | ) |
This function returns current timer value of a PWM device.
device | Device structure. |
Value | PWM timer counter. |
int32_t pi_pwm_duty_cycle_set | ( | struct pi_device * | device, |
uint32_t | frequency, | ||
uint8_t | duty_cycle | ||
) |
This function sets PWM frequency and duty cycle(also referred to pulse width measured in seconds).
device | Device structure. |
frequency | Frequency of PWM. |
duty_cycle | Output high ratio. |
0 | If operation is successful. |
ERRNO | Otherwise error code. |
int32_t pi_pwm_ioctl | ( | struct pi_device * | device, |
pi_pwm_ioctl_cmd_e | cmd, | ||
void * | arg | ||
) |
This function allows to send different commands to PWM device. The commands are listed above in pi_pwm_ioctl_cmd_e.
Please note that some functions need arguments such as :
device | Device structure. |
cmd | Ioctl command. |
arg | Ioctl command args. |
-1 | If wrong ioctl command. |
Value | Otherwise return value depending on ioctl command. |
int32_t pi_pwm_open | ( | struct pi_device * | device | ) |
This function opens a PWM device. It disables PWM device clock gating, sets up the PWM with given value and enables events of the selected PWM device.
device | Device structure. |
0 | If operation is successful. |
ERR_CODE | Otherwise. |
|
inlinestatic |
This function starts a PWM timer.
device | Device structure. |
|
inlinestatic |
This function stops a PWM timer.
device | Device structure. |