Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
sol-pwm.h File Reference

These routines are used for PWM access under Soletta. More...

#include <stdbool.h>
#include <stdint.h>
#include <sol-common-buildopts.h>
#include <sol-macros.h>

Go to the source code of this file.

Data Structures

struct  sol_pwm_config
 PWM configuration struct. More...
 

Macros

#define SOL_PWM_CONFIG_API_VERSION   (1)
 

Typedefs

typedef struct sol_pwm sol_pwm
 A handle to a PWM. More...
 
typedef struct sol_pwm_config sol_pwm_config
 PWM configuration struct. More...
 

Enumerations

enum  sol_pwm_alignment { SOL_PWM_ALIGNMENT_LEFT, SOL_PWM_ALIGNMENT_RIGHT, SOL_PWM_ALIGNMENT_CENTER }
 Alignment determines how the pulse is aligned within the PWM period. More...
 
enum  sol_pwm_polarity { SOL_PWM_POLARITY_NORMAL, SOL_PWM_POLARITY_INVERSED }
 Polarity is whether the output is active-high or active-low. More...
 

Functions

enum sol_pwm_alignment sol_pwm_alignment_from_str (const char *pwm_alignment)
 Converts a string PWM alignment to sol_pwm_alignment. More...
 
const char * sol_pwm_alignment_to_str (enum sol_pwm_alignment pwm_alignment)
 Converts sol_pwm_alignment to a string name. More...
 
void sol_pwm_close (struct sol_pwm *pwm)
 Closes a given PWM pin. More...
 
int32_t sol_pwm_get_duty_cycle (const struct sol_pwm *pwm)
 Get PWM duty cycle in nanoseconds. More...
 
int32_t sol_pwm_get_period (const struct sol_pwm *pwm)
 Get PWM period in nanoseconds. More...
 
bool sol_pwm_is_enabled (const struct sol_pwm *pwm)
 Check wheter a pmw pin is enabled or disabled. More...
 
struct sol_pwmsol_pwm_open (int device, int channel, const struct sol_pwm_config *config)
 Opens a given pin as pwm. More...
 
struct sol_pwmsol_pwm_open_by_label (const char *label, const struct sol_pwm_config *config)
 Opens a given pin by its board label as pwm. More...
 
struct sol_pwmsol_pwm_open_raw (int device, int channel, const struct sol_pwm_config *config)
 Opens a given pin as pwm. More...
 
enum sol_pwm_polarity sol_pwm_polarity_from_str (const char *pwm_polarity)
 Converts a string PWM polarity to sol_pwm_polarity. More...
 
const char * sol_pwm_polarity_to_str (enum sol_pwm_polarity pwm_polarity)
 Converts sol_pwm_polarity to a string name. More...
 
int sol_pwm_set_duty_cycle (struct sol_pwm *pwm, uint32_t duty_cycle_ns)
 Set PWM duty cycle in nanoseconds. More...
 
int sol_pwm_set_enabled (struct sol_pwm *pwm, bool enable)
 Enable or disable a given pwm pin. More...
 
int sol_pwm_set_period (struct sol_pwm *pwm, uint32_t period_ns)
 Set PWM period in nanoseconds. More...
 

Detailed Description

These routines are used for PWM access under Soletta.

Macro Definition Documentation

#define SOL_PWM_CONFIG_API_VERSION   (1)