diff --git a/README.md b/README.md index e69de29..40ae7ff 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,24 @@ +Linux Userspace GPIO Library +============================ + + * Export and Unexport GPIO pins + * Interrupt support (*) + * Rewrite of NoccyLabs RaspIO + + +## Interrupts + +For interrupts to work, you need to first bind the interrupt handler, and then +make sure to call on `Gpio#refresh()` every cycle to poll the interrupt flag on +the selected pins. + + $gpio = new Gpio(); + + $gpio->onInterrupt(Gpio::get(0), "rising", function($e) { ... }); + + while (..) { + .. + $gpio->refresh(); + } + +## diff --git a/lib/Gpio.php b/lib/Gpio.php new file mode 100644 index 0000000..48d9cc2 --- /dev/null +++ b/lib/Gpio.php @@ -0,0 +1,38 @@ +