Device stubs and exceptions added
This commit is contained in:
@ -36,9 +36,37 @@ class WiringPiMapper implements GpioMapperInterface
|
||||
switch ($gpio) {
|
||||
case 17: return 0;
|
||||
case 18: return 1;
|
||||
// ..
|
||||
|
||||
case 22: return 3;
|
||||
case 23: return 4;
|
||||
case 24: return 5;
|
||||
case 25: return 6;
|
||||
case 11: return 7;
|
||||
case 8: return 10;
|
||||
case 7: return 11;
|
||||
case 10: return 12;
|
||||
case 9: return 13;
|
||||
case 11: return 14;
|
||||
case 14: return 15;
|
||||
case 15: return 16;
|
||||
case 28: return 17;
|
||||
case 29: return 18;
|
||||
case 30: return 19;
|
||||
case 31: return 20;
|
||||
}
|
||||
if ($this->version == 2) {
|
||||
switch ($gpio) {
|
||||
case 27: return 2;
|
||||
case 2: return 8;
|
||||
case 3: return 9;
|
||||
}
|
||||
} elseif ($this->version == 1) {
|
||||
switch ($gpio) {
|
||||
case 21: return 2;
|
||||
case 9: return 8;
|
||||
case 1: return 9;
|
||||
}
|
||||
}
|
||||
throw new GpioException("Unable to map GPIO{$gpio} to logical pin");
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
@ -78,9 +106,8 @@ class WiringPiMapper implements GpioMapperInterface
|
||||
case 18: return 29;
|
||||
case 19: return 30;
|
||||
case 20: return 31;
|
||||
default:
|
||||
throw new \Exception;
|
||||
}
|
||||
throw new GpioException("Unable to map logicak {$logical} to GPIO pin");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user