ove/
led.rs

1// Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4//
5// This file is part of oveRTOS.
6
7//! LED control for oveRTOS boards.
8//!
9//! LEDs are identified by zero-based index. Call [`count`] to discover how
10//! many LEDs are available on the current board.
11
12use crate::bindings;
13
14/// Set the state of LED `led` (0-based index).
15///
16/// `on = true` turns the LED on, `on = false` turns it off.
17pub fn set(led: u32, on: bool) {
18    unsafe { bindings::ove_led_set(led, on as i32) }
19}
20
21/// Toggle the current state of LED `led` (on → off, off → on).
22pub fn toggle(led: u32) {
23    unsafe { bindings::ove_led_toggle(led) }
24}
25
26/// Return the number of LEDs available on this board.
27pub fn count() -> u32 {
28    unsafe { bindings::ove_led_count() }
29}