carousel
Time-driven page cycler for small displays.
A Carousel answers one question: given the current millisecond clock and
whether an external trigger fired, should the display show its idle screen or
one of the cycle pages, and which page?
It is pure scheduling. No rendering, no I/O, no atomics, no timer ownership.
The caller owns the framebuffer, the clock source, the trigger, and the
CarouselState; this crate only maps (now, triggered) to a Frame. That
keeps the timing logic no_std, allocation-free, and unit-testable without
hardware.
Example
use ;
const SCREENS: Carousel = Carousel ;
// Offset the first auto-cycle so the idle screen shows right after boot.
let mut state = new;
// Each render tick, feed the clock and any pending trigger:
match SCREENS.frame_at
Behaviour
- An automatic burst opens every
cycle_period_msand runs forcycle_window_ms, advancing one page everypage_duration_msand wrapping through0..page_count. Outside a burst the carousel reportsFrame::Idle. - Passing
triggered = trueopens a burst immediately without disturbing the automatic schedule, so a manual burst never delays or skips the next periodic one. cycle_period_ms = 0disables automatic bursts: the carousel then cycles only when triggered.page_count = 0reportsFrame::Idleon every tick.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.