Skip to content

feat(hardware): add lgpio GPIO backend for Raspberry Pi 5 - #10

Merged
larsrollik merged 1 commit into
mainfrom
ft/lgpio-backend
Aug 17, 2026
Merged

feat(hardware): add lgpio GPIO backend for Raspberry Pi 5#10
larsrollik merged 1 commit into
mainfrom
ft/lgpio-backend

Conversation

@larsrollik

Copy link
Copy Markdown
Member

Closes #1.

Adds an lgpio hardware backend alongside pigpio (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. pigpio is unmaintained and incompatible with the Pi 5.

  • New ttl-barcoder[lgpio] extra; pigpio kept for legacy Pi 3/4 rigs.
  • Daemon-free: the pin is driven via gpio_write with a monotonic busy-wait per segment (sub-ms accurate for ms-scale barcode segments), using only gpiochip_open/gpio_claim_output/gpio_write/gpiochip_close — matching the verified rpi-camera-ensemble usage. Pass gpiochip=4 for the Pi 5.
  • docs/hardware.md documents both backends; tests/test_lgpio.py mocks 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.

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).
@larsrollik
larsrollik requested a review from a team as a code owner August 17, 2026 14:39
@larsrollik
larsrollik merged commit 57c6315 into main Aug 17, 2026
5 checks passed
@larsrollik
larsrollik deleted the ft/lgpio-backend branch August 17, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add lgpio hardware backend for Raspberry Pi 5 support

1 participant