Use GPIOTOGGLE to toggle the pin state instead of read, modify and write.

This commit is contained in:
Luiz Otavio O Souza 2016-04-19 15:18:31 +00:00
parent e848a50ce6
commit c4839d320a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298272

View file

@ -181,14 +181,14 @@ gpio_pin_set(gpio_handle_t handle, gpio_pin_t pin, gpio_value_t value)
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