From a834dd557125a2b0d9047b9a05d30a8504dea42b Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 17 Jan 2017 09:54:36 +0100 Subject: [PATCH] core: add a typedef for the set value callback Signed-off-by: Bartosz Golaszewski --- include/gpiod.h | 11 ++++++++--- src/lib/core.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/gpiod.h b/include/gpiod.h index ca0e81d..7fb8517 100644 --- a/include/gpiod.h +++ b/include/gpiod.h @@ -152,6 +152,11 @@ static inline int gpiod_simple_get_value(const char *device, return value; } +/** + * @brief Simple set value callback signature. + */ +typedef void (*gpiod_set_value_cb)(void *); + /** * @brief Set values of a set of a set of GPIO lines. * @param device Name, path or number of the gpiochip. @@ -166,7 +171,7 @@ static inline int gpiod_simple_get_value(const char *device, */ int gpiod_simple_set_value_multiple(const char *device, unsigned int *offsets, int *values, unsigned int num_lines, - bool active_low, void (*cb)(void *), + bool active_low, gpiod_set_value_cb cb, void *data) GPIOD_API; /** @@ -183,8 +188,8 @@ int gpiod_simple_set_value_multiple(const char *device, unsigned int *offsets, */ static inline int gpiod_simple_set_value(const char *device, unsigned int offset, int value, - bool active_low, void (*cb)(void *), - void *data) + bool active_low, + gpiod_set_value_cb cb, void *data) { return gpiod_simple_set_value_multiple(device, &offset, &value, 1, active_low, cb, data); diff --git a/src/lib/core.c b/src/lib/core.c index e3e5f74..5a8e6fb 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -208,7 +208,7 @@ int gpiod_simple_get_value_multiple(const char *device, unsigned int *offsets, int gpiod_simple_set_value_multiple(const char *device, unsigned int *offsets, int *values, unsigned int num_lines, - bool active_low, void (*cb)(void *), + bool active_low, gpiod_set_value_cb cb, void *data) { struct gpiod_line_bulk bulk; -- 2.30.2