objc

Data Structures | Typedefs | Functions
pwm.h File Reference

Pulse Width Modulation (PWM) interface. More...

#include <stdbool.h>
#include <stdint.h>
Include dependency graph for pwm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hw_pwm_config_t
 PWM configuration structure for setup parameters. More...
 
struct  hw_pwm_t
 PWM structure representing a PWM instance. More...
 

Typedefs

typedef struct hw_pwm_t hw_pwm_t
 PWM structure representing a PWM instance.
 
typedef void(* hw_pwm_callback_t) (uint8_t unit, void *userdata)
 PWM interrupt callback function pointer. More...
 

Functions

hw_pwm_t hw_pwm_init (uint8_t unit, hw_pwm_config_t *config)
 Initialize a PWM unit. More...
 
uint8_t hw_pwm_count ()
 Get the number of PWM units. More...
 
static bool hw_pwm_valid (hw_pwm_t *pwm)
 Validate the PWM unit. More...
 
void hw_pwm_finalize (hw_pwm_t *pwm)
 Finalize and release a PWM unit. More...
 
uint8_t hw_pwm_gpio_unit (uint8_t gpio)
 Get the PWM unit for a GPIO pin. More...
 
hw_pwm_config_t hw_pwm_get_config (float freq)
 Get PWM configuration. More...
 
float hw_pwm_get_freq (hw_pwm_config_t *config)
 Returns the frequency for a configuration. More...
 
void hw_pwm_set_config (hw_pwm_t *pwm, const hw_pwm_config_t *config)
 Apply configuration to a PWM unit. More...
 
bool hw_pwm_start (hw_pwm_t *pwm, uint8_t gpio, float duty_percent)
 Start PWM output on a specific GPIO pin. More...
 
void hw_pwm_stop (hw_pwm_t *pwm)
 Stop PWM output. More...
 
void hw_pwm_set_callback (hw_pwm_callback_t callback, void *userdata)
 Set the PWM interrupt callback handler. More...
 
void hw_pwm_set_irq_enabled (hw_pwm_t *pwm, bool enabled)
 Enable or disable PWM wrap interrupt for a slice. More...
 

Detailed Description

Pulse Width Modulation (PWM) interface.

Definition in file pwm.h.