Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libgpio/gpio.c
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | gpio_pin_config(gpio_handle_t handle, gpio_config_t *cfg) | ||||
strlcpy(cfg->g_name, gppin.gp_name, GPIOMAXNAME); | strlcpy(cfg->g_name, gppin.gp_name, GPIOMAXNAME); | ||||
cfg->g_caps = gppin.gp_caps; | cfg->g_caps = gppin.gp_caps; | ||||
cfg->g_flags = gppin.gp_flags; | cfg->g_flags = gppin.gp_flags; | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
gpio_pin_set_name(gpio_handle_t handle, gpio_pin_t pin, char *name) | |||||
{ | |||||
struct gpio_pin gppin; | |||||
if (name == NULL) | |||||
return (-1); | |||||
bzero(&gppin, sizeof(gppin)); | |||||
gppin.gp_pin = pin; | |||||
strlcpy(gppin.gp_name, name, GPIOMAXNAME); | |||||
if (ioctl(handle, GPIOSETNAME, &gppin) < 0) | |||||
return (-1); | |||||
return (0); | |||||
} | |||||
int | |||||
gpio_pin_set_flags(gpio_handle_t handle, gpio_config_t *cfg) | gpio_pin_set_flags(gpio_handle_t handle, gpio_config_t *cfg) | ||||
{ | { | ||||
struct gpio_pin gppin; | struct gpio_pin gppin; | ||||
if (cfg == NULL) | if (cfg == NULL) | ||||
return (-1); | return (-1); | ||||
gppin.gp_pin = cfg->g_pin; | gppin.gp_pin = cfg->g_pin; | ||||
gppin.gp_flags = cfg->g_flags; | gppin.gp_flags = cfg->g_flags; | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |