feat(zdevice): add GPIO_ACTIVE_HIGH flag macro#52
Merged
Conversation
gpio_dt.h defined GPIO_ACTIVE_LOW but not its companion GPIO_ACTIVE_HIGH. Active-high pins already behaved correctly (active-high is the absence of the active-low bit), but code referencing the symbol explicitly failed to compile. Define GPIO_ACTIVE_HIGH as (0 << 0), mirroring upstream Zephyr's named-zero form in dt-bindings/gpio/gpio.h. Add a test asserting it is zero and that a spec declared with it behaves identically to the active-high default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit GPIO_ACTIVE_HIGH macro to the Zephyr-compatible gpio_dt.h GPIO DT helpers so devicetree/board/application code can state active-high intent without failing to compile, and adds a unit test verifying it is a named-zero flag and behaves identically to the default active-high behavior.
Changes:
- Define
GPIO_ACTIVE_HIGHas a named-zero macro ((0 << 0)) alongsideGPIO_ACTIVE_LOW. - Add a unit test that asserts
GPIO_ACTIVE_HIGH == 0and thatgpio_pin_set_dt()does not invert values when using it. - Register the new test in the existing GPIO flags test group.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
components/zdevice/include/boreas/gpio_dt.h |
Adds GPIO_ACTIVE_HIGH named-zero macro to match Zephyr dt-bindings semantics and avoid compile failures when referenced explicitly. |
test/main/test_gpio_flags.c |
Adds a test ensuring GPIO_ACTIVE_HIGH is zero and behaves the same as default active-high DT flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
robhelvestine
approved these changes
Jun 22, 2026
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.
What
gpio_dt.hdefinedGPIO_ACTIVE_LOWbut not its companionGPIO_ACTIVE_HIGH. Active-high pins already behaved correctly at runtime (active-high is simply the absence of the active-low bit — seegpio_pin_get_dt/gpio_pin_set_dt), but any board, devicetree, or application code that referenced the symbol explicitly failed to compile.Change
GPIO_ACTIVE_HIGHas(0 << 0), mirroring upstream Zephyr's named-zero form indt-bindings/gpio/gpio.h:gpio_dt_specdeclared with it behaves identically to the active-high default.Testing
Linux test suite (
idf.py --preview set-target linux && idf.py build && ./build/boreas_test.elf): 224 tests, 0 failures.The new GPIO test compiles on the esp32s3 target only —
test_gpio_flags.cis excluded from the Linux build because the mock requires ESP-IDF'sdriver/gpio.h.🤖 Generated with Claude Code