Skip to main content

brightness_counts

Function brightness_counts 

Source
fn brightness_counts(brightness: u8) -> u16
Expand description

Scale an 8-bit brightness (0–255) to raw duty counts (0–DUTY_MAX).

The intermediate math runs in u32, which cannot overflow here (255 * 16383 ≈ 4.2M < u32::MAX); saturating_mul makes that bound explicit for clippy::arithmetic_side_effects.