Skip to content

Add GPIO LED states, mode#86

Open
xarantolus wants to merge 4 commits into
mainfrom
feature/gpio-states-modes
Open

Add GPIO LED states, mode#86
xarantolus wants to merge 4 commits into
mainfrom
feature/gpio-states-modes

Conversation

@xarantolus
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 14, 2026 21:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the gpio-leds device-tree driver with two new properties: default-state (off/on/keep) and osiris,output-mode (push-pull/open-drain). The dtgen codegen now emits two new enums and registry fields, the kernel LED driver consumes them at init time, and the STM32L4 GPIO HAL gains an open-drain configure helper plus a clock-enable helper used to safely read a pre-init pin.

Changes:

  • Generate LedDefaultState / LedOutputMode enums and registry fields from device-tree properties (xtasks/crates/dtgen/src/codegen/led.rs).
  • Wire the new properties into LED init: pick initial level from default-state, choose push-pull vs open-drain configure call, and log the mode (src/drivers/led.rs).
  • Add gpio_configure_output_od and gpio_clock_enable to the STM32L4 HAL plus matching native Rust wrappers and stub-side enum/struct fields.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
xtasks/crates/dtgen/src/codegen/led.rs Parse default-state / osiris,output-mode and emit enums + registry fields.
src/drivers/led.rs Use the new fields to choose initial level and configure call (push-pull / open-drain).
machine/cortex-m/st/stm32l4/interface/gpio.h Declare gpio_configure_output_od and gpio_clock_enable.
machine/cortex-m/st/stm32l4/interface/gpio.c Implement open-drain configure and standalone clock-enable helpers.
machine/cortex-m/st/stm32l4/interface/export.h Re-export the two new C symbols.
machine/cortex-m/src/native/gpio.rs Rust wrappers for the two new C functions.
machine/cortex-m/src/stub/device_tree.rs Mirror the new enums/fields on the stub HAL (gpio stub not updated).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/drivers/led.rs Outdated
Comment thread machine/cortex-m/src/stub/device_tree.rs
Comment thread src/drivers/led.rs Outdated
Comment thread machine/cortex-m/st/stm32l4/interface/gpio.c Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Comment thread src/drivers/led.rs Outdated
Comment thread src/drivers/led.rs Outdated
Comment thread src/drivers/led.rs Outdated
Comment thread xtasks/crates/dtgen/src/codegen/led.rs Outdated
Comment thread machine/cortex-m/st/stm32l4/interface/gpio.c Outdated
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.

2 participants