Author: loos Date: Tue Apr 19 15:18:31 2016 New Revision: 298272 URL: https://svnweb.freebsd.org/changeset/base/298272
Log: Use GPIOTOGGLE to toggle the pin state instead of read, modify and write. Modified: head/lib/libgpio/gpio.c Modified: head/lib/libgpio/gpio.c ============================================================================== --- head/lib/libgpio/gpio.c Tue Apr 19 15:08:35 2016 (r298271) +++ head/lib/libgpio/gpio.c Tue Apr 19 15:18:31 2016 (r298272) @@ -181,14 +181,14 @@ gpio_pin_set(gpio_handle_t handle, gpio_ int gpio_pin_toggle(gpio_handle_t handle, gpio_pin_t pin) { - gpio_value_t value; + struct gpio_req gpreq; - value = gpio_pin_get(handle, pin); - if (value == GPIO_VALUE_INVALID) + bzero(&gpreq, sizeof(gpreq)); + gpreq.gp_pin = pin; + if (ioctl(handle, GPIOTOGGLE, &gpreq) < 0) return (-1); - value = !value; - return (gpio_pin_set(handle, pin, value)); + return (0); } int _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"