Stubbed GPIO class
This commit is contained in:
parent
f3fef421f3
commit
d00bcde3ee
24
README.md
24
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();
|
||||
}
|
||||
|
||||
##
|
38
lib/Gpio.php
Normal file
38
lib/Gpio.php
Normal 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)
|
||||
{}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user