public function removePin(Pin $pin) { /** @noinspection PhpUnusedLocalVariableInspection */ list($bank, $mask, $shift) = $pin->getAddressMask(); unset($this->pins[$bank][$shift]); $this->updateDetectRegisters(); }
public function pulse($iterations = null, $interval = 1, $duty = 0.5) { $this->on(); $on_time = $interval * $duty; $this->pin->getBoard()->getLoop()->addTimer($on_time, [$this, 'off'])->getLoop()->addPeriodicTimer($interval, function (TimerInterface $timer) use(&$iterations, $on_time) { if ($iterations !== null && --$iterations === 0) { $timer->cancel(); return; } $this->on(); $timer->getLoop()->addTimer($on_time, [$this, 'off']); }); }
public function __construct(Pin $pin) { $this->pin = $pin; $pin->setFunction(Pin\PinFunction::INPUT); }
public function reverse() { $this->pin_a->low(); $this->pin_b->high(); }
public function isExported(Pin $pin) { return file_exists(sprintf('%s/gpio%s', self::PATH_BASE, $pin->getPinNumber())); }