dszczer / oscillator
Emulator for hardware oscillator or any synchronous-driven systems for PHP
1.0.0
2024-03-04 22:34 UTC
Requires
- php: ^7.1||^8
This package is auto-updated.
Last update: 2024-12-05 00:18:23 UTC
README
Abstract for oscillator driven systems
Abstract types
Bistable Oscillator
Bistable multivibrator with 2 stable states. Commonly implemented as concrete boolean value:
declare(strict_types=1); namespace Dszczer\Oscillator; use Dszczer\Oscillator\BistableOscillatorInterface; final class BistableOscillator implements BistableOscillatorInterface { private $oscillatorState = false; /** * @inheritDoc */ public function getOscillatorState(): bool { return $this->oscillatorState; } /** * @inheritDoc */ public function tick(): void { $this->oscillatorState = !$this->oscillatorState; } }