bugfixes to gpiopin
This commit is contained in:
		@@ -60,7 +60,7 @@ class GpioPin
 | 
			
		||||
            throw new \Exception;
 | 
			
		||||
        }
 | 
			
		||||
        $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;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
@@ -72,7 +72,7 @@ class GpioPin
 | 
			
		||||
    public function setValue($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;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
@@ -94,7 +94,7 @@ class GpioPin
 | 
			
		||||
    
 | 
			
		||||
    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}")) {
 | 
			
		||||
            throw new \Exception();
 | 
			
		||||
        }
 | 
			
		||||
@@ -103,7 +103,7 @@ class GpioPin
 | 
			
		||||
    
 | 
			
		||||
    public function unexport()
 | 
			
		||||
    {
 | 
			
		||||
        file_put_contents("/sys/class/gpio/unexport", $this->pin);
 | 
			
		||||
        @file_put_contents("/sys/class/gpio/unexport", $this->pin);
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
@@ -113,7 +113,7 @@ class GpioPin
 | 
			
		||||
            throw new \Exception;
 | 
			
		||||
        }
 | 
			
		||||
        $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;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user