struct hw_pwm_t hw_pwm_t
Opaque PWM handle.
struct hw_gpio_t hw_gpio_t
GPIO logical pin structure.
float duty_percent
Requested duty cycle percentage in [0.0, 100.0].
GPIO (General Purpose Input/Output) interface.
uint64_t hw_pwm_get_period_ns(const hw_pwm_t *pwm)
Get the configured PWM period.
bool hw_pwm_get_config(const hw_pwm_t *pwm, hw_pwm_config_t *out_config)
Read current PWM configuration.
hw_pwm_t * hw_pwm_init_device(const char *device, uint8_t channel, const hw_pwm_config_t *config)
Initialize a PWM output from a platform-specific device path.
bool hw_pwm_get_enabled(const hw_pwm_t *pwm)
Query whether PWM output is enabled.
float hw_pwm_get_duty_percent(const hw_pwm_t *pwm)
Get duty cycle percentage.
void hw_pwm_set_enabled(hw_pwm_t *pwm, bool enabled)
Enable or disable PWM output.
void hw_pwm_deinit(hw_pwm_t *pwm)
Deinitialize a PWM handle.
bool hw_pwm_set_period_ns(hw_pwm_t *pwm, uint64_t period_ns)
Set the PWM period.
void(* hw_pwm_callback_t)(hw_pwm_t *pwm, void *userdata)
PWM wrap callback function pointer.
bool hw_pwm_irq_supported(void)
Check whether PWM wrap interrupt callbacks are supported.
hw_pwm_t * hw_pwm_init(hw_gpio_t *gpio, hw_pwm_callback_t callback, void *userdata, const hw_pwm_config_t *config)
Initialize a PWM output on a GPIO pin.
uint64_t period_ns
Requested PWM period in nanoseconds.
bool hw_pwm_set_config(hw_pwm_t *pwm, const hw_pwm_config_t *config)
Apply a complete PWM configuration.
bool enabled
Initial output enable state.
bool hw_pwm_set_duty_percent(hw_pwm_t *pwm, float duty_percent)
Set duty cycle percentage.