use super::{scroll::Scroller, DisplayOptions};
#[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct RepeatDisplayOptions<'d, const N: usize, T, CLK, DIO, DELAY, I, D> {
options: DisplayOptions<'d, N, T, CLK, DIO, DELAY, I, D>,
delay_ms: u32,
}
impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M>
RepeatDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>
{
pub const fn new(
options: DisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>,
delay_ms: u32,
) -> Self {
Self { options, delay_ms }
}
pub const fn new_with_defaults(
options: DisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>,
) -> Self {
Self::new(options, 500)
}
pub const fn delay_ms(mut self, delay_ms: u32) -> Self {
self.delay_ms = delay_ms;
self
}
pub fn finish(
self,
) -> Scroller<
'd,
N,
T,
CLK,
DIO,
DELAY,
impl Iterator<Item = impl DoubleEndedIterator<Item = u8> + ExactSizeIterator>,
M,
>
where
I: DoubleEndedIterator<Item = u8> + ExactSizeIterator,
{
let iter = self.options.iter.map(move |i| [i]).map(|i| i.into_iter());
Scroller::new(
self.options.device,
1,
self.options.position,
self.delay_ms,
iter,
self.options._flip,
)
}
}