Protect access to GPIO pin with a mutex