tm1637_embedded_hal/options/
circles.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//! Ready to use circle animations.

use crate::{tokens::NotFlipped, TM1637};

mod bits;
mod default_options;
mod direction;

pub use bits::*;
pub use default_options::RotatingCircleOptions;
pub use direction::*;

/// High-level API for circle animations.
#[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct CirclesDisplayOptions<'d, const N: usize, T, CLK, DIO, DELAY> {
    device: &'d mut TM1637<N, T, CLK, DIO, DELAY>,
}

impl<'d, const N: usize, T, CLK, DIO, DELAY> CirclesDisplayOptions<'d, N, T, CLK, DIO, DELAY> {
    /// Create a new [`CirclesDisplayOptions`] instance.
    pub fn new(device: &'d mut TM1637<N, T, CLK, DIO, DELAY>) -> Self {
        Self { device }
    }

    /// Create a new [`RotatingCircleOptions`] instance.
    pub fn rotating(self) -> RotatingCircleOptions<'d, N, T, CLK, DIO, DELAY, NotFlipped> {
        RotatingCircleOptions::new_with_defaults(self.device, NotFlipped)
    }
}