scrapyard-io / framework
The ScrapyardIO Framework.
Requires
- php: ^8.3
- ext-ftdi: ^0.4.0
- ext-posi: ^0.4.0
- microscrap/ftdi: ^0.4.0
- microscrap/mpsse: ^0.4.0
- microscrap/posix: ^0.4.0
Requires (Dev)
- pestphp/pest: ^4
Replaces
- scrapyard-io/bare-metal: 0.4.0
- scrapyard-io/nuts-and-bolts: 0.4.0
- scrapyard-io/reality-interface: 0.4.0
- scrapyard-io/waveforms: 0.4.0
This package is auto-updated.
Last update: 2026-06-02 20:23:11 UTC
README
Autoloading Integrated Circuit configs
ScrapyardIO supports preloading IntegratedCircuit definitions, for streamlined instatiating of devices especially in use-cases where the IntegratedCircuits are being used in production, that is, they are physically mapped to their pins indefinitely, rather than in development, where the pins might change.
In order to do this, the framework must be plugged into a project where the .ENV gets autoloaded. And add the following variable, subbing the example string to the actual path of your project
SCRAPYARD_CONFIG_PATH=/home/pi/path/to/project/config
In the folder you decide, make a file called scrapyard-io.php and start it with -
return [ 'boards' => [ 'something' => [ 'class_name' => SomeCircuit::class, 'connection' => ['driver' => 'native'|'usb',...] 'startup' => [ 'method0' => [...$args], 'method1' => [...$args], //... ], ] ], ];
Consult with DeptOfScrapyardRobotics IntegratedCircuit packages' READMEs with the actual shape to define the devices you need to use
Setting up GPIO Pins
Native (POSIX) driver. (Single Board Computers)
use Waveforms\Carriers\GPIO\GPIO; use Waveforms\Carriers\GPIO\API\Native\NativeGPIOInput; use Waveforms\Carriers\GPIO\API\Native\NativeGPIOOutput; // Native GPIO $gpio_input = NativeGPIOInput::line(22)->edgeEvents()->alias('echo'); $gpio_output = NativeGPIOOutput::line(24)->alias('trig'); $native_gpio_bus = GPIO::connection('native') ->gpiochip(0) ->addInput($gpio_input) ->addOutput($gpio_output) ->nonblocking() ->consumer('distance-sensor') ->boot(); $native_gpio_bus->trig()->high(); $native_gpio_bus->trig()->low(); // @stop here until above is implemented. $value = $native_gpio_bus->echo()->read(); $event = $native_gpio_bus->echo()->listen()
USB (MPSSE) driver. (Linux and MacOS)
use Waveforms\Carriers\GPIO\GPIO; use Waveforms\Carriers\GPIO\API\USB\UsbGPIOInput; use Waveforms\Carriers\GPIO\API\USB\UsbGPIOOutput; // USB GPIO $gpio_input = USBGPIOInput::pin(0)->edgeEvents()->alias('echo') $gpio_output = USBGPIOOutput::pin(1)->alias('trig') $usb_gpio_bus = GPIO::connection('usb') ->device('ft232h') ->addInput($gpio_input) ->addOutput($gpio_output) ->consumer('distance-sensor') ->boot(); $usb_gpio_bus->trig()->high(); $usb_gpio_bus->trig()->low(); // @stop here until above is implemented. $value = $usb_gpio_bus->echo()->read(); $event = $usb_gpio_bus->echo()->listen()