Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions source/event_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ BBIO_err gpio_export(unsigned int gpio)
goto exit;
}

// Is GPIO an LED?
if ( ((gpio >= USR_LED_GPIO_MIN) && (gpio <= USR_LED_GPIO_MAX))
||
( beaglebone_blue()
&&
(
(gpio == USR_LED_RED)
|| (gpio == USR_LED_GREEN)
|| (gpio == BAT25)
|| (gpio == BAT50)
|| (gpio == BAT75)
|| (gpio == BAT100)
|| (gpio == WIFI)
)
)
)
{
syslog(LOG_WARNING, "Adafruit_BBIO: gpio_export: %u not applicable to built-in LEDs", gpio);
return BBIO_OK; // export is not applicable to the USR LED pins
}

// already exported by someone else?
char gpio_path[64];
snprintf(gpio_path, sizeof(gpio_path), "/sys/class/gpio/gpio%d", gpio);
Expand Down