bugfixes to gpiopin

This commit is contained in:
Chris 2014-06-12 01:59:17 +02:00
parent bb0e8af598
commit 2304372129
1 changed files with 5 additions and 5 deletions

View File

@ -60,7 +60,7 @@ class GpioPin
throw new \Exception; throw new \Exception;
} }
$this->direction = $direction; $this->direction = $direction;
file_put_contents("/sys/class/gpio/gpio{$this->pin}/direction", $direction); @file_put_contents("/sys/class/gpio/gpio{$this->pin}/direction", $direction);
return $this; return $this;
} }
@ -72,7 +72,7 @@ class GpioPin
public function setValue($value) public function setValue($value)
{ {
$this->value = (bool)$value; $this->value = (bool)$value;
file_put_contents("/sys/class/gpio/gpio{$this->pin}/value", (int)$this->value); @file_put_contents("/sys/class/gpio/gpio{$this->pin}/value", (int)$this->value);
return $this; return $this;
} }
@ -94,7 +94,7 @@ class GpioPin
public function export() public function export()
{ {
file_put_contents("/sys/class/gpio/export", $this->pin); @file_put_contents("/sys/class/gpio/export", $this->pin);
if (!file_exists("/sys/class/gpio/gpio{$this->pin}")) { if (!file_exists("/sys/class/gpio/gpio{$this->pin}")) {
throw new \Exception(); throw new \Exception();
} }
@ -103,7 +103,7 @@ class GpioPin
public function unexport() public function unexport()
{ {
file_put_contents("/sys/class/gpio/unexport", $this->pin); @file_put_contents("/sys/class/gpio/unexport", $this->pin);
return $this; return $this;
} }
@ -113,7 +113,7 @@ class GpioPin
throw new \Exception; throw new \Exception;
} }
$this->edge = $edge; $this->edge = $edge;
file_put_contents("/sys/class/gpio/gpio{$this->pin}/edge", $edge); @file_put_contents("/sys/class/gpio/gpio{$this->pin}/edge", $edge);
return $this; return $this;
} }