Medius - Rust LibraryLED

LED

Drive a status LED, or hand it back to the box

led overrides one of the box's two green status LEDs, or with LedMode::Auto returns it to the box's own status display. It's fire-and-forget: one frame, no reply.

led

Override or restore a status LED
fn led(&self, target: LedTarget, mode: LedMode, level: u8) -> Result<()>

Fire-and-forget

LedTarget picks which chip's LED, and LedMode picks what to drive it to; both enums and their bytes are on Types.level is brightness 0..=255, used by Solid and Blink and ignored for Off and Auto.

PARAMETERS
ParameterTypeDescription
targetLedTargetWhich chip's LED: Device, Host, or Both.
modeLedModeAuto restores the status display; Off, Solid, and Blink override it.
levelu8Brightness 0-255 for Solid and Blink; ignored otherwise.

An override holds until you send Auto, and the box also reverts the LED to its status display on control-PC silence, on reset, or on inter-chip link loss. See the native LED command for the status patterns each chip shows.

EXAMPLE
use medius::{Device, LedTarget, LedMode};

let device = Device::find()?;
device.led(LedTarget::Both, LedMode::Blink, 200)?;   // both LEDs blink, bright
device.led(LedTarget::Device, LedMode::Auto, 0)?;    // hand the device LED back

On AsyncDevice

Still fire-and-forget, no await

AsyncDevice re-exposes led unchanged: it expects no reply, so there's no .await and no block_on. Only the queries are async.

EXAMPLE
use medius::{AsyncDevice, LedTarget, LedMode};

let device = AsyncDevice::open("/dev/ttyACM0")?;
device.led(LedTarget::Host, LedMode::Solid, 128)?;   // sync, no await