Move the consumer string after the active_low property.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
/**
* @brief Set value of a single GPIO line.
- * @param consumer Name of the consumer.
* @param device Name, path or number of the gpiochip.
* @param offset GPIO line offset on the chip.
* @param value New value.
* @param active_low The active state of this line - true if low.
+ * @param consumer Name of the consumer.
* @param cb Callback function that will be called right after the value is
* set. Users can use this, for example, to pause the execution after
* toggling a GPIO.
* @param data User data that will be passed to the callback function.
* @return 0 if the operation succeeds, -1 on error.
*/
-int gpiod_simple_set_value(const char *consumer, const char *device,
- unsigned int offset, int value, bool active_low,
+int gpiod_simple_set_value(const char *device, unsigned int offset, int value,
+ bool active_low, const char *consumer,
gpiod_simple_set_value_cb cb, void *data) GPIOD_API;
/**
* @brief Set values of a set of a set of GPIO lines.
- * @param consumer Name of the consumer.
* @param device Name, path or number of the gpiochip.
* @param offsets An array of offsets of lines whose values should be set.
* @param values An array of integers containing new values.
* @param num_lines Number of lines, must be > 0.
* @param active_low The active state of the lines - true if low.
+ * @param consumer Name of the consumer.
* @param cb Callback function that will be called right after the values are
* set.
* @param data User data that will be passed to the callback function.
* @return 0 if the operation succeeds, -1 on error.
*/
-int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
+int gpiod_simple_set_value_multiple(const char *device,
const unsigned int *offsets,
const int *values, unsigned int num_lines,
- bool active_low,
+ bool active_low, const char *consumer,
gpiod_simple_set_value_cb cb,
void *data) GPIOD_API;
return status;
}
-int gpiod_simple_set_value(const char *consumer, const char *device,
- unsigned int offset, int value, bool active_low,
+int gpiod_simple_set_value(const char *device, unsigned int offset, int value,
+ bool active_low, const char *consumer,
gpiod_simple_set_value_cb cb, void *data)
{
- return gpiod_simple_set_value_multiple(consumer, device, &offset,
- &value, 1, active_low,
- cb, data);
+ return gpiod_simple_set_value_multiple(device, &offset, &value, 1,
+ active_low, consumer, cb, data);
}
-int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
+int gpiod_simple_set_value_multiple(const char *device,
const unsigned int *offsets,
const int *values, unsigned int num_lines,
- bool active_low,
- gpiod_simple_set_value_cb cb,
- void *data)
+ bool active_low, const char *consumer,
+ gpiod_simple_set_value_cb cb, void *data)
{
struct gpiod_line_bulk bulk;
struct gpiod_chip *chip;
die("invalid offset: %s", argv[i + 1]);
}
- status = gpiod_simple_set_value_multiple("gpioset", device, offsets,
- values, num_lines, active_low,
- mode->callback, &cbdata);
+ status = gpiod_simple_set_value_multiple(device, offsets, values,
+ num_lines, active_low,
+ "gpioset", mode->callback,
+ &cbdata);
if (status < 0)
die_perror("error setting the GPIO line values");
values[0] = values[1] = values[2] = values[3] = 1;
- rv = gpiod_simple_set_value_multiple(TEST_CONSUMER, test_chip_name(1),
- offsets, values, 4, false,
+ rv = gpiod_simple_set_value_multiple(test_chip_name(1), offsets,
+ values, 4, false, TEST_CONSUMER,
NULL, NULL);
TEST_ASSERT_RET_OK(rv);
values[0] = values[1] = values[2] = values[3] = 1;
- rv = gpiod_simple_set_value_multiple(TEST_CONSUMER, test_chip_name(1),
- offsets, values, 4, false,
+ rv = gpiod_simple_set_value_multiple(test_chip_name(1), offsets,
+ values, 4, false, TEST_CONSUMER,
NULL, NULL);
TEST_ASSERT_RET_OK(rv);
values[0] = values[1] = values[2] = 1;
- rv = gpiod_simple_set_value_multiple(TEST_CONSUMER, test_chip_name(1),
- offsets, values, 3, false,
+ rv = gpiod_simple_set_value_multiple(test_chip_name(1), offsets,
+ values, 3, false, TEST_CONSUMER,
NULL, NULL);
TEST_ASSERT_RET_OK(rv);
false, TEST_CONSUMER);
TEST_ASSERT_EQ(ret, 0);
- ret = gpiod_simple_set_value(TEST_CONSUMER, test_chip_name(0),
- 3, 1, false, NULL, NULL);
+ ret = gpiod_simple_set_value(test_chip_name(0), 3, 1,
+ false, TEST_CONSUMER, NULL, NULL);
TEST_ASSERT_RET_OK(ret);
ret = gpiod_simple_get_value(test_chip_name(0), 3,
values[8] = 0;
values[9] = 0;
- rv = gpiod_simple_set_value_multiple(TEST_CONSUMER, test_chip_name(0),
- offsets, values, 10, false,
- NULL, NULL);
+ rv = gpiod_simple_set_value_multiple(test_chip_name(0), offsets,
+ values, 10, false, TEST_CONSUMER,
+ NULL, NULL);
TEST_ASSERT_RET_OK(rv);
rv = gpiod_simple_get_value_multiple(test_chip_name(0), offsets,
unsigned int offsets[GPIOD_LINE_BULK_MAX_LINES + 1];
int values[GPIOD_LINE_BULK_MAX_LINES + 1], ret;
- ret = gpiod_simple_set_value_multiple(TEST_CONSUMER, test_chip_name(0),
- offsets, values,
+ ret = gpiod_simple_set_value_multiple(test_chip_name(0), offsets,
+ values,
GPIOD_LINE_BULK_MAX_LINES + 1,
- false, NULL, NULL);
+ false, TEST_CONSUMER, NULL, NULL);
TEST_ASSERT_NOTEQ(ret, 0);
TEST_ASSERT_ERRNO_IS(EINVAL);
}