Added comments to device classes
This commit is contained in:
@ -55,6 +55,10 @@ abstract class Device implements GpioAwareInterface
|
||||
public function getDescription()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Allocate a GPIO (as defined in hardware) pin to the device.
|
||||
*
|
||||
*/
|
||||
public function addGpioPin($gpio, $name, $description=null)
|
||||
{
|
||||
$pin = new GpioPin($gpio);
|
||||
@ -62,6 +66,10 @@ abstract class Device implements GpioAwareInterface
|
||||
$this->pins[$name] = $pin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a logical (wiring-pi 0-based pin number) pin to the device.
|
||||
*
|
||||
*/
|
||||
public function addLogicalPin($logical, $name, $description=null)
|
||||
{
|
||||
$pin = $this->gpio[$logical];
|
||||
@ -69,15 +77,32 @@ abstract class Device implements GpioAwareInterface
|
||||
$this->pins[$name] = $pin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all allocated pins
|
||||
*
|
||||
*/
|
||||
public function getPins()
|
||||
{
|
||||
return $this->pins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pin by the name specified when allocating it
|
||||
*
|
||||
*/
|
||||
public function getPin($name)
|
||||
{
|
||||
return $this->pins[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pin as a property from its name
|
||||
*
|
||||
*/
|
||||
protected function __get($pin_name)
|
||||
{
|
||||
return $this->getPin($pin_name);
|
||||
}
|
||||
|
||||
public function delayMillis($ms)
|
||||
{}
|
||||
@ -85,8 +110,4 @@ abstract class Device implements GpioAwareInterface
|
||||
public function delayMicros($us)
|
||||
{}
|
||||
|
||||
public function __get($pin_name)
|
||||
{
|
||||
return $this->getPin($pin_name);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user