pub fn display_timer(adapter: &mut TM1637Adapter, sleep_fn: &dyn Fn(), from_val: u16) {
    adapter.set_display_state(DisplayState::ON);
    adapter.set_brightness(Brightness::L7);

    let mut show_dot = false;
    // 0 to 9999
    for i in 0..(from_val + 1) {
        let i = from_val - i;
        let data = TM1637Adapter::encode_number(i);
        adapter.write_segments_raw(&data, 0);
        show_dot = !show_dot;
        sleep_fn(); // probably this is always a function that sleeps 1s => 1Hz frequency
    }

    // blinking with just zeros to show that timer is done
    for i in 0..4 {
        let data;
        if i % 2 == 0 {
            data = [0; 4];
        } else {
            data = [TM1637Adapter::encode_digit(0); 4];
        }
        adapter.write_segments_raw(&data, 0);
        sleep_fn(); // probably this is always a function that sleeps 1s => 1Hz frequency
    }
    adapter.clear();
}
/// Starts a timer from x to 0. Needs a sleep_fn (probably one that sleeps for one second / 1Hz).
/// Displays pure seconds. No minutes:seconds.
// don't to blink here, because it would look like "mins:secs" which is not true. In this case this
// is a pure seconds timer.
Starts a timer from x to 0. Needs a sleep_fn (probably one that sleeps for one second / 1Hz).
Displays pure seconds. No minutes:seconds.
don't to blink here, because it would look like "mins:secs" which is not true. In this case this
is a pure seconds timer.
Starts a timer from x to 0 . Needs a sleep_fn ( probably one that sleeps for one second / 1Hz ) . Displays pure seconds . No minutes : seconds . don ' t to blink here because it would look like " mins : secs " which is not true . In this case this is a pure seconds timer .
pub fn display_timer(adapter: &mut TM1637Adapter, sleep_fn: &dyn Fn(), from_val: u16) {
    adapter.set_display_state(DisplayState::ON);
    adapter.set_brightness(Brightness::L7);
    let mut show_dot = false;
    // 0 to 9999
    for i in 0..(from_val + 1) {
        let i = from_val - i;
        let data = TM1637Adapter::encode_number(i);
        adapter.write_segments_raw(&data, 0);
        show_dot = !show_dot;
        sleep_fn(); // probably this is always a function that sleeps 1s => 1Hz frequency
    }
    // blinking with just zeros to show that timer is done
    for i in 0..4 {
        let data;
        if i % 2 == 0 {
            data = [0; 4];
        } else {
            data = [TM1637Adapter::encode_digit(0); 4];
        }
        adapter.write_segments_raw(&data, 0);
        sleep_fn(); // probably this is always a function that sleeps 1s => 1Hz frequency
    }
    adapter.clear();
}
pub fn display_timer ( adapter : & mut TM1637Adapter , sleep_fn : & dyn Fn ( ) , from_val : u16 ) { adapter . set_display_state ( DisplayState :: ON ) ; adapter . set_brightness ( Brightness :: L7 ) ; let mut show_dot = false ; // 0 to 9999 for i in 0 .. ( from_val + 1 ) { let i = from_val - i ; let data = TM1637Adapter :: encode_number ( i ) ; adapter . write_segments_raw ( & data , 0 ) ; show_dot = ! show_dot ; sleep_fn ( ) ; // probably this is always a function that sleeps 1s => 1Hz frequency } // blinking with just zeros to show that timer is done for i in 0 .. 4 { let data ; if i % 2 == 0 { data = [ 0 ; 4 ] ; } else { data = [ TM1637Adapter :: encode_digit ( 0 ) ; 4 ] ; } adapter . write_segments_raw ( & data , 0 ) ; sleep_fn ( ) ; // probably this is always a function that sleeps 1s => 1Hz frequency } adapter . clear ( ) ; }
Starts a timer from x to 0.
Starts a timer from x to 0 .
adapter
&mut TM1637Adapter
sleep_fn
&dyn Fn()
from_val
u16