core: add a typedef for the set value callback
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 17 Jan 2017 08:54:36 +0000 (09:54 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Tue, 17 Jan 2017 08:54:36 +0000 (09:54 +0100)
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
include/gpiod.h
src/lib/core.c

index ca0e81dd39035c60502487afc2934c3d88911479..7fb85174e061674039f91015d90ade0e2f9b43cb 100644 (file)
@@ -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);
index e3e5f74e5536d577562f72a088ea5760ad96aa94..5a8e6fb0c8111bb5da5a965ebe7bf701f914cd7e 100644 (file)
@@ -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;