pub fn display_stopwatch(adapter: &mut TM1637Adapter, sleep_fn: &dyn Fn(), to: u16, blink: bool) {
    adapter.set_display_state(DisplayState::ON);
    adapter.set_brightness(Brightness::L7);

    let mut show_dot = false;
    // 0 to 9999
    for i in 0..to {
        let mut data = TM1637Adapter::encode_number(i);
        if blink && show_dot {
            data[1] |= SegmentBits::SegPoint as u8;
        }
        adapter.write_segments_raw(&data, 0);
        show_dot = !show_dot;
        sleep_fn(); // probably this is always a function that sleeps 1s => 1Hz frequency
    }
}
/// Starts a stopwatch aka counter from 0 to 9999.
/// You need to provide a sleep_fn that waits 1s (for stopwatch).
Starts a stopwatch aka counter from 0 to 9999.
You need to provide a sleep_fn that waits 1s (for stopwatch).
Starts a stopwatch aka counter from 0 to 9999 . You need to provide a sleep_fn that waits 1s ( for stopwatch ) .
pub fn display_stopwatch(adapter: &mut TM1637Adapter, sleep_fn: &dyn Fn(), to: u16, blink: bool) {
    adapter.set_display_state(DisplayState::ON);
    adapter.set_brightness(Brightness::L7);
    let mut show_dot = false;
    // 0 to 9999
    for i in 0..to {
        let mut data = TM1637Adapter::encode_number(i);
        if blink && show_dot {
            data[1] |= SegmentBits::SegPoint as u8;
        }
        adapter.write_segments_raw(&data, 0);
        show_dot = !show_dot;
        sleep_fn(); // probably this is always a function that sleeps 1s => 1Hz frequency
    }
}
pub fn display_stopwatch ( adapter : & mut TM1637Adapter , sleep_fn : & dyn Fn ( ) , to : u16 , blink : bool ) { adapter . set_display_state ( DisplayState :: ON ) ; adapter . set_brightness ( Brightness :: L7 ) ; let mut show_dot = false ; // 0 to 9999 for i in 0 .. to { let mut data = TM1637Adapter :: encode_number ( i ) ; if blink && show_dot { data [ 1 ] |= SegmentBits :: SegPoint as u8 ; } adapter . write_segments_raw ( & data , 0 ) ; show_dot = ! show_dot ; sleep_fn ( ) ; // probably this is always a function that sleeps 1s => 1Hz frequency } }
Starts a stopwatch aka counter from 0 to 9999.
Starts a stopwatch aka counter from 0 to 9999 .
adapter
&mut TM1637Adapter
sleep_fn
&dyn Fn()
to
u16
blink
bool