feat(hardware): add lgpio GPIO backend for Raspberry Pi 5 - #10
Merged
Conversation
Add an `lgpio` backend alongside the existing `pigpio` one, with the same interface (`LgpioBarcodeSender` / `LgpioConnection` / `send_barcode_sequence`) so it is a drop-in alternative. `lgpio` is chardev-based, pip-installable, needs no daemon, and works on the Raspberry Pi 5 (RP1) where `pigpio` does not; pass `gpiochip=4` for the Pi 5. A barcode is emitted by driving the line with `gpio_write` and holding each segment with a monotonic busy-wait (sub-ms accurate for the ms-scale segments), so there is no wave/daemon layer to configure. Adds a `ttl-barcoder[lgpio]` extra, hardware-free tests that mock the lgpio module, and hardware docs covering both backends. On-rig timing verification pending (no GPIO in CI).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1.
Adds an
lgpiohardware backend alongsidepigpio(drop-in interface:LgpioBarcodeSender/LgpioConnection/send_barcode_sequence), so barcode TTLs can be emitted on the Raspberry Pi 5 (RP1) and Pi 4 without the pigpio daemon.pigpiois unmaintained and incompatible with the Pi 5.ttl-barcoder[lgpio]extra;pigpiokept for legacy Pi 3/4 rigs.gpio_writewith a monotonic busy-wait per segment (sub-ms accurate for ms-scale barcode segments), using onlygpiochip_open/gpio_claim_output/gpio_write/gpiochip_close— matching the verifiedrpi-camera-ensembleusage. Passgpiochip=4for the Pi 5.docs/hardware.mddocuments both backends;tests/test_lgpio.pymocks lgpio (not in CI). Full suite green.On-rig timing verification pending (no GPIO in CI) — smoke-test on a real Pi 4 and Pi 5 before relying on the busy-wait timing.