23 #include <sol-common-buildopts.h>
151 #ifndef SOL_NO_API_VERSION
152 #define SOL_GPIO_CONFIG_API_VERSION (1)
271 SOL_ATTR_WARN_UNUSED_RESULT
288 SOL_ATTR_WARN_UNUSED_RESULT
305 SOL_ATTR_WARN_UNUSED_RESULT
322 SOL_ATTR_WARN_UNUSED_RESULT
339 SOL_ATTR_WARN_UNUSED_RESULT
362 SOL_ATTR_WARN_UNUSED_RESULT
381 SOL_ATTR_WARN_UNUSED_RESULT
401 SOL_ATTR_WARN_UNUSED_RESULT
enum sol_gpio_edge trigger_mode
When to trigger events for this GPIO.
Definition: sol-gpio.h:193
enum sol_gpio_direction sol_gpio_direction_from_str(const char *direction)
Converts a string GPIO direction to sol_gpio_direction.
The GPIO is an output.
Definition: sol-gpio.h:75
struct sol_gpio_config::@31::@33 in
Configuration parameters for input GPIOs.
sol_gpio_direction
Possible values for the direction of a GPIO.
Definition: sol-gpio.h:69
bool active_low
Whether the GPIO is considered active when it's in a low state.
Definition: sol-gpio.h:174
Structure to hold the configuration of a GPIO device.
Definition: sol-gpio.h:150
int sol_gpio_read(struct sol_gpio *gpio)
Get the current value set to pin.
Events will be triggered for both edge levels.
Definition: sol-gpio.h:114
These are common Soletta macros.
const char * sol_gpio_drive_to_str(enum sol_gpio_drive drive)
Converts sol_gpio_drive to a string name.
static struct sol_buffer value
Definition: server.c:42
struct sol_gpio * sol_gpio_open_raw(uint32_t pin, const struct sol_gpio_config *config)
Opens a given pin as general purpose input or output.
struct sol_gpio sol_gpio
A handle to a GPIO.
Definition: sol-gpio.h:64
struct sol_gpio * sol_gpio_open_by_label(const char *label, const struct sol_gpio_config *config)
Opens a given pin by its board label as general purpose input or output.
const void * user_data
User data poinetr to pass to the cb function.
Definition: sol-gpio.h:215
#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
Events will be triggered on a rising edge.
Definition: sol-gpio.h:102
When set as pull-up, resistor will be connected to VCC.
Definition: sol-gpio.h:132
When set as pull-down, resistor will be connected to ground.
Definition: sol-gpio.h:137
bool sol_gpio_write(struct sol_gpio *gpio, bool value)
Set an arbitrary value to pin.
struct sol_gpio_config sol_gpio_config
Structure to hold the configuration of a GPIO device.
static struct sol_gpio * gpio
Definition: linux-micro-init.c:114
bool value
The initial value to write when the GPIO is opened.
Definition: sol-gpio.h:236
const char * sol_gpio_direction_to_str(enum sol_gpio_direction direction)
Converts sol_gpio_direction to a string name.
sol_gpio_edge
Possible values for the edge mode of a GPIO.
Definition: sol-gpio.h:89
uint32_t poll_timeout
Time to poll for events, in milliseconds.
Definition: sol-gpio.h:227
enum sol_gpio_edge sol_gpio_edge_from_str(const char *edge)
Converts a string GPIO edge to sol_gpio_edge.
enum sol_gpio_direction dir
The direction in which to open the GPIO.
Definition: sol-gpio.h:158
Events will be triggered onf a falling edge.
Definition: sol-gpio.h:108
void(* cb)(void *data, struct sol_gpio *gpio, bool value)
The function to call when an event happens.
Definition: sol-gpio.h:211
enum sol_gpio_drive drive_mode
Pull-up or pull-down resistor state for this GPIO.
Definition: sol-gpio.h:181
Do not set any state.
Definition: sol-gpio.h:127
The GPIO is an input.
Definition: sol-gpio.h:81
enum sol_gpio_drive sol_gpio_drive_from_str(const char *drive)
Converts a string GPIO drive to sol_gpio_drive.
const char * sol_gpio_edge_to_str(enum sol_gpio_edge edge)
Converts sol_gpio_edge to a string name.
void sol_gpio_close(struct sol_gpio *gpio)
Closes a given GPIO pin.
struct sol_gpio_config::@31::@34 out
Configuration parameters for output GPIOs.
sol_gpio_drive
Possible values for pull-up or pull-down resistor of a GPIO.
Definition: sol-gpio.h:123
uint16_t api_version
The API version.
Definition: sol-gpio.h:153
struct sol_gpio * sol_gpio_open(uint32_t pin, const struct sol_gpio_config *config)
Opens a given pin as general purpose input or output.
Don't generate events.
Definition: sol-gpio.h:96