Skip to content

Introduce RGB LED effects #5597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Introduce RGB LED effects #5597

wants to merge 8 commits into from

Conversation

kopecdav
Copy link

This PR introduces LED effects into the rgb_led driver.

LED effects

The rgb_led driver effects are driven by an internal systimer which interrupts every 20ms (50Hz) when an effect is started. The interrupt then calls an effect callback from the lookup table which returns the actual RGB LED color based on the elapsed time.

API

The rgb_led API introduces two functions:

  • rgb_led_effect_start - starts the selected effect for the requested number of cycles (or indefinitely)
  • rgb_led_effect_stop - stops the ongoing effect

The already available rgb_led_set_color function will stop any ongoing effect and override the LED color.

API was exposed to FW via stubs.

Color palette and effect LUT

The driver was updated with a color palette defined by designers, and introduces two effects (BOOTLOADER BREATE, CHARGING) according to FW and bootloader flow. Both the palette and effects will probably be subject to fine-tuning to meet design expectations.

Prodtest

In order to allow testing, prodtest was extended with rgbled-effect-start and rgbled-effect-stop commands.

@kopecdav kopecdav self-assigned this Aug 20, 2025
@kopecdav kopecdav added the T3W1 label Aug 20, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Aug 20, 2025
@kopecdav kopecdav requested a review from Copilot August 20, 2025 14:54
Copy link

@Copilot 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

This PR introduces RGB LED effects functionality to the Trezor T3W1 device, enabling dynamic LED animations driven by system timers. The implementation adds support for predefined effects like bootloader breathing and charging animations.

  • Adds RGB LED effects infrastructure with systimer-based callbacks for 50Hz effect updates
  • Introduces two predefined effects: bootloader breathe (blue) and charging (yellow) with configurable cycle counts
  • Extends prodtest commands and API exposure to support effect control and testing

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
core/site_scons/models/T3W1/*.py Adds rgb_led_effects.c source file to build configuration
core/embed/sys/syscall/stm32/syscall_*.c Implements syscall stubs and dispatch for new effect start/stop functions
core/embed/sys/syscall/inc/sys/syscall_numbers.h Adds syscall numbers for RGB LED effect operations
core/embed/rust/build.rs Exposes new RGB LED effect types and functions to Rust bindings
core/embed/projects/prodtest/cmd/prodtest_rgbled.c Adds prodtest commands for starting and stopping RGB LED effects
core/embed/projects/prodtest/README.md Documents new prodtest commands for RGB LED effects
core/embed/io/rgb_led/unix/rgb_led.c Provides stub implementations for Unix platform
core/embed/io/rgb_led/stm32u5/rgb_led_lp.c Core RGB LED driver with effect management and systimer integration
core/embed/io/rgb_led/stm32u5/rgb_led_internal.h Internal driver structures and effect callback definitions
core/embed/io/rgb_led/stm32u5/rgb_led_effects.c Effect implementations with linear interpolation and timing logic
core/embed/io/rgb_led/inc/io/rgb_led.h Public API definitions, color palette, and effect types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kopecdav kopecdav force-pushed the kopecdav/T3W1/led_dimming branch from b089499 to d88a60e Compare August 20, 2025 15:04
Copy link

github-actions bot commented Aug 20, 2025

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 17124684426

@TychoVrahe TychoVrahe requested a review from cepetr August 22, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔎 Needs review
Development

Successfully merging this pull request may close these issues.

1 participant