Skip to content
Open
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
3 changes: 3 additions & 0 deletions src/PhpGpio/Gpio.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public function setup($pinNo, $direction)
// Export pin
file_put_contents(GpioInterface::PATH_EXPORT, $pinNo);

// wait until pin is ready
while(!is_writable(GpioInterface::PATH_GPIO.$pinNo)) { /* empty */ }

// if valid direction then set direction
if ($this->isValidDirection($direction)) {
file_put_contents(GpioInterface::PATH_GPIO.$pinNo.'/direction', $direction);
Expand Down