Skip to content
Snippets Groups Projects
Commit 99d4f70e authored by Nicolae Rosia's avatar Nicolae Rosia Committed by Lorenz Meier
Browse files

linux_gpio: check if pin is already exported

parent b82a0f98
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,11 @@ int LinuxGPIO::_exportPin(unsigned int pin)
int ret;
int bytes_to_write;
if (_readValue(pin) != -1) {
/* GPIO is already exported */
return 0;
}
fd = open("/sys/class/gpio/export", O_WRONLY);
if (fd == -1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment