Skip to content

Add GPIO hardware test service (GPIO1_D5 button drives two outputs high) - #3

Open
fanxiaobinggit wants to merge 1 commit into
mainfrom
feature/robopi-hw-test
Open

Add GPIO hardware test service (GPIO1_D5 button drives two outputs high)#3
fanxiaobinggit wants to merge 1 commit into
mainfrom
feature/robopi-hw-test

Conversation

@fanxiaobinggit

Copy link
Copy Markdown
Contributor

Summary

Adds a boot-enabled hardware test service for verifying GPIO routing on the RoboPi2 board.

When the GPIO1_D5 button (GPIO61) is pressed, the service drives two output lines high:

Pin GPIO Chip / offset
GPIO1_B0 GPIO40 /dev/gpiochip1 offset 8
GPIO0_C2 GPIO18 /dev/gpiochip0 offset 18

Changes

  • src/hw_test.c — new robopi-hw-test program. Polls the button rising edge (30 ms debounce) via the linux/gpio.h gpioevent API, then sets both outputs high. Outputs latch high by default; a --toggle flag flips them on each press. Modeled on the existing sig_led_key.c.
  • etc/systemd/system/robopi-hw-test.service — new unit, WantedBy=multi-user.target for boot auto-start.
  • Makefile — builds the binary, installs it under /opt/roboparty/bin with a /usr/bin symlink, and installs the unit.
  • debian/postinstsystemctl enable + start the service on install.

Notes

🤖 Generated with Claude Code

Add robopi-hw-test, which watches the GPIO1_D5 button (gpiochip1/29) and
drives GPIO1_B0 (gpiochip1/8) and GPIO0_C2 (gpiochip0/18) high on each
press. Outputs latch high by default; --toggle flips them per press.

- src/hw_test.c: new program (mirrors sig_led_key.c gpioevent polling).
- etc/systemd/system/robopi-hw-test.service: new unit, WantedBy=multi-user.target.
- Makefile: build, install the binary, /usr/bin symlink, and unit.
- debian/postinst: enable and start the service on install.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant