24 #include <sol-common-buildopts.h>
96 #ifndef SOL_NO_API_VERSION
97 #define SOL_PWM_CONFIG_API_VERSION (1)
137 SOL_ATTR_WARN_UNUSED_RESULT
154 SOL_ATTR_WARN_UNUSED_RESULT
171 SOL_ATTR_WARN_UNUSED_RESULT
struct sol_pwm * sol_pwm_open_by_label(const char *label, const struct sol_pwm_config *config)
Opens a given pin by its board label as pwm.
int32_t sol_pwm_get_duty_cycle(const struct sol_pwm *pwm)
Get PWM duty cycle in nanoseconds.
struct sol_pwm * sol_pwm_open_raw(int device, int channel, const struct sol_pwm_config *config)
Opens a given pin as pwm.
int sol_pwm_set_duty_cycle(struct sol_pwm *pwm, uint32_t duty_cycle_ns)
Set PWM duty cycle in nanoseconds.
int32_t duty_cycle_ns
The PWM duty cycle.
Definition: sol-pwm.h:101
void sol_pwm_close(struct sol_pwm *pwm)
Closes a given PWM pin.
int sol_pwm_set_enabled(struct sol_pwm *pwm, bool enable)
Enable or disable a given pwm pin.
struct sol_pwm * sol_pwm_open(int device, int channel, const struct sol_pwm_config *config)
Opens a given pin as pwm.
The pulse is aligned to the leading-edge (left) of the PWM period.
Definition: sol-pwm.h:69
sol_pwm_polarity
Polarity is whether the output is active-high or active-low.
Definition: sol-pwm.h:83
int sol_pwm_set_period(struct sol_pwm *pwm, uint32_t period_ns)
Set PWM period in nanoseconds.
These are common Soletta macros.
int32_t sol_pwm_get_period(const struct sol_pwm *pwm)
Get PWM period in nanoseconds.
const char * sol_pwm_polarity_to_str(enum sol_pwm_polarity pwm_polarity)
Converts sol_pwm_polarity to a string name.
enum sol_pwm_polarity polarity
The PWM polarity.
Definition: sol-pwm.h:103
#define SOL_ATTR_WARN_UNUSED_RESULT
Causes a warning to be emitted if a caller of the function with this attribute does not use its retur...
Definition: sol-macros.h:187
PWM configuration struct.
Definition: sol-pwm.h:95
const char * sol_pwm_alignment_to_str(enum sol_pwm_alignment pwm_alignment)
Converts sol_pwm_alignment to a string name.
enum sol_pwm_polarity sol_pwm_polarity_from_str(const char *pwm_polarity)
Converts a string PWM polarity to sol_pwm_polarity.
enum sol_pwm_alignment alignment
The PWM alignment.
Definition: sol-pwm.h:102
sol_pwm_alignment
Alignment determines how the pulse is aligned within the PWM period.
Definition: sol-pwm.h:68
int32_t period_ns
The PWM period.
Definition: sol-pwm.h:100
uint16_t api_version
The API version.
Definition: sol-pwm.h:98
bool enabled
Set to true to for enabled false for disabled.
Definition: sol-pwm.h:104
struct sol_pwm_config sol_pwm_config
PWM configuration struct.
struct sol_pwm sol_pwm
A handle to a PWM.
Definition: sol-pwm.h:61
The pulse is aligned to the trailing-edge (right) of the PWM period.
Definition: sol-pwm.h:70
bool sol_pwm_is_enabled(const struct sol_pwm *pwm)
Check wheter a pmw pin is enabled or disabled.
The pulse is aligned to the center of the PWM period.
Definition: sol-pwm.h:71
enum sol_pwm_alignment sol_pwm_alignment_from_str(const char *pwm_alignment)
Converts a string PWM alignment to sol_pwm_alignment.