Extracted lcdbridge and added first signs of RPI B+ to pi mapper

This commit is contained in:
2014-08-13 03:04:31 +02:00
parent 1449ec643f
commit ec4e5bd6ab
9 changed files with 75 additions and 100 deletions

View File

@ -24,11 +24,15 @@ use NoccyLabs\Gpio\Exception\GpioException;
class WiringPiMapper implements GpioMapperInterface
{
const REV_A = 1;
const REV_B = 2;
const REV_BPLUS = 3;
protected $version;
public function __construct($version=1)
{
$this->version = (int)$version;
$this->version = $version;
}
/** {@inheritdoc} */
@ -54,13 +58,19 @@ class WiringPiMapper implements GpioMapperInterface
case 30: return 19;
case 31: return 20;
}
if ($this->version == 2) {
if ($this->version == self::REV_B) {
switch ($gpio) {
case 27: return 2;
case 2: return 8;
case 3: return 9;
}
} elseif ($this->version == 1) {
} elseif ($this->version == self::REV_BPLUS) {
switch ($gpio) {
case 27: return 2;
case 2: return 8;
case 3: return 9;
}
} elseif ($this->version == self::REV_A) {
switch ($gpio) {
case 21: return 2;
case 9: return 8;
@ -77,7 +87,8 @@ class WiringPiMapper implements GpioMapperInterface
case 0: return 17;
case 1: return 18;
case 2:
if ($this->version == 2) {
if (($this->version == self::REV_B)
||($this->version == self::REV_BPLUS)) {
return 27;
}
return 21;
@ -87,12 +98,14 @@ class WiringPiMapper implements GpioMapperInterface
case 6: return 25;
case 7: return 11;
case 8:
if ($this->version == 2) {
if (($this->version == self::REV_B)
||($this->version == self::REV_BPLUS)) {
return 2;
}
return 0;
case 9:
if ($this->version == 2) {
if (($this->version == self::REV_B)
||($this->version == self::REV_BPLUS)) {
return 3;
}
return 1;