tm1637_embedded_hal::options

Struct ClockDisplayOptions

Source
pub struct ClockDisplayOptions<'d, const N: usize, T, CLK, DIO, DELAY, I, M> { /* private fields */ }
Expand description

High-level API for setting a clock.

§Example

Display the time 14:28 on the display.

use tm1637_embedded_hal::{mock::Noop, TM1637Builder};

let mut tm = TM1637Builder::new(Noop, Noop, Noop).build_blocking::<4>();

tm.options()
    .clock()
    .hour(14)
    .minute(28)
    .finish()
    // Set the colon between the hours and minutes.
    .dot(1)
    .display()
    .ok();

The display will show:

+---+ +---+ +---+ +---+
| 1 | | 4 |:| 2 | | 8 |
+---+ +---+ +---+ +---+

Implementations§

Source§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>

Source

pub fn new(options: DisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>) -> Self

Create a new ClockDisplayOptions instance.

Source

pub const fn hour(self, hour: u8) -> Self

Set the hour.

Source

pub const fn minute(self, minute: u8) -> Self

Set the minute.

Source

pub fn finish( self, ) -> DisplayOptions<'d, N, T, CLK, DIO, DELAY, impl DoubleEndedIterator<Item = u8> + ExactSizeIterator, M>

Finish setting the clock.

Trait Implementations§

Source§

impl<'d, const N: usize, T: Debug, CLK: Debug, DIO: Debug, DELAY: Debug, I: Debug, M: Debug> Debug for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> Format for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>
where DisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>: Format,

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.

Auto Trait Implementations§

§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> Freeze for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>
where I: Freeze, M: Freeze,

§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> RefUnwindSafe for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>

§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> Send for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>
where I: Send, M: Send, CLK: Send, DIO: Send, DELAY: Send, T: Send,

§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> Sync for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>
where I: Sync, M: Sync, CLK: Sync, DIO: Sync, DELAY: Sync, T: Sync,

§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> Unpin for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>
where I: Unpin, M: Unpin,

§

impl<'d, const N: usize, T, CLK, DIO, DELAY, I, M> !UnwindSafe for ClockDisplayOptions<'d, N, T, CLK, DIO, DELAY, I, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.