LEDs
The four RGB LEDs — driven directly, or through the OS pattern engine
The device has 4 RGB LEDs, indexed 0-3. The OS runs its own animations on them, so stop whatever is playing before you drive them yourself:
os_led_stop_current(); // once, in init() hal_led_set_rgb(0, 100, 70, 20); // then from tick()
Patterns versus direct writes
Writing from tick() is the simple route and costs you nothing but the call. For anything that animates on its own clock, hand the OS a led_pattern_t instead: the LED task steps it on its own timer, so the animation keeps running at a steady rate even when your tick() is busy, and it survives a frame you skip.
Note — Nothing restores the OS patterns when your app exits. Put the device back the way you found it in deinit() — either write the LEDs yourself or call os_led_stop_current().
Set one LED's colour
| const uint8_t | led_num | LED index, 0-3 |
| const uint8_t | red | 0-255 |
| const uint8_t | green | 0-255 |
| const uint8_t | blue | 0-255 |
Note — The driver latches: an LED keeps its last written colour until you change it. Nothing restores OS patterns when your app exits, so set the LEDs back or call os_led_stop_current() in deinit().
Stop the OS LED pattern currently playing
Read the step counter from inside a pattern callback
| const os_led_t* | led |
Start a pattern, replacing whatever is currently playing
| led_pattern_t* | pattern | |
| const void* | ctx | when non-NULL, overrides the pattern's own ctx for this run |
Note — The pattern outlives the call — give it static storage, not a local.