Stubbed GPIO class

This commit is contained in:
Chris 2014-06-06 16:00:34 +02:00
parent f3fef421f3
commit d00bcde3ee
2 changed files with 62 additions and 0 deletions

View File

@ -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();
}
##

38
lib/Gpio.php Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace NoccyLabs\Gpio;
class Gpio
{
public function __construct()
{}
// call export before getpin
public function getPin($pinno)
{}
// export the pin
public function exportPin($pinno)
{}
// unexport the pin
public function unexportPin($pinno)
{}
// set handler, pass null to disable interrupts
public function setInterruptHandler(GpioPin $pin, callable $handler=null)
{}
// get the interrupt handler for the pin
public function getInterruptHandler(GpioPin $pin)
{}
// set edge
public function setInterruptEdge(GpioPin $pin, $edge)
{}
// get edge
public function getInterruptEdge(GpioPin $pin)
{}
}