pub fn display_text_banner_in_loop(adapter: &mut TM1637Adapter, text: &str, sleep_fn: &dyn Fn()) {
    adapter.set_display_state(DisplayState::ON);
    adapter.set_brightness(Brightness::L7);

    // remove dots because this display only has one double point which looks weird.
    let data = text.replace(".", " ");
    let data = TM1637Adapter::encode_string(&data);

    // +1 because the upper border in a range is exclusive
    // otherwise last char is lost!
    let to = (data.len() - DISPLAY_COUNT) + 1;

    // display this text over and over again
    loop {
        for x in 0..to {
            let data_slice = &data[x..(x + DISPLAY_COUNT)];
            adapter.write_segments_raw(data_slice,  0);
            sleep_fn();
        }
    }
}
/// Displays a text over and over again. The text will move "animated" accross the
/// screen from right to left.
/// Blocks the calling thread because this is an infinite loop.
Displays a text over and over again. The text will move "animated" accross the
screen from right to left.
Blocks the calling thread because this is an infinite loop.
Displays a text over and over again . The text will move " animated " accross the screen from right to left . Blocks the calling thread because this is an infinite loop .
pub fn display_text_banner_in_loop(adapter: &mut TM1637Adapter, text: &str, sleep_fn: &dyn Fn()) {
    adapter.set_display_state(DisplayState::ON);
    adapter.set_brightness(Brightness::L7);
    // remove dots because this display only has one double point which looks weird.
    let data = text.replace(".", " ");
    let data = TM1637Adapter::encode_string(&data);
    // +1 because the upper border in a range is exclusive
    // otherwise last char is lost!
    let to = (data.len() - DISPLAY_COUNT) + 1;
    // display this text over and over again
    loop {
        for x in 0..to {
            let data_slice = &data[x..(x + DISPLAY_COUNT)];
            adapter.write_segments_raw(data_slice,  0);
            sleep_fn();
        }
    }
}
pub fn display_text_banner_in_loop ( adapter : & mut TM1637Adapter , text : & str , sleep_fn : & dyn Fn ( ) ) { adapter . set_display_state ( DisplayState :: ON ) ; adapter . set_brightness ( Brightness :: L7 ) ; // remove dots because this display only has one double point which looks weird. let data = text . replace ( " " , " " ) ; let data = TM1637Adapter :: encode_string ( & data ) ; // +1 because the upper border in a range is exclusive // otherwise last char is lost! let to = ( data . len ( ) - DISPLAY_COUNT ) + 1 ; // display this text over and over again loop { for x in 0 .. to { let data_slice = & data [ x .. ( x + DISPLAY_COUNT ) ] ; adapter . write_segments_raw ( data_slice , 0 ) ; sleep_fn ( ) ; } } }
Displays a text over and over again.
Displays a text over and over again .
adapter
&mut TM1637Adapter
text
&str
sleep_fn
&dyn Fn()