svisual

Crates.iosvisual
lib.rssvisual
version0.4.1
sourcesrc
created_at2019-07-15 05:15:05.335567
updated_at2021-12-04 17:11:28.739591
descriptionBase Rust structures and traits for SVisual client
homepage
repositoryhttps://github.com/burrbull/svisual-rs
max_upload_size
id149118
size22,842
Zgarbul Andrey (burrbull)

documentation

README

crates.io crates.io

SVisual-rs

Base Rust structures and traits for SVisual client.

For example of implementation see svisual-stm32f1.

Usage

Let's measure 2 variables each 100ms and send them after 15 values be measured.

    let (mut tx, _) = Serial::usart3(
        p.USART3,
        (tx, rx),
        &mut afio.mapr,
        Config::default().baudrate(9600.bps()),
        clocks,
        &mut rcc.apb1,
    )
    .split();

    let mut delay = Delay::new(cp.SYST, clocks);

    // Create new map with not more than 2 different signals and 15 values in package
    let mut sv_map = SVMap::<2, 15>::new();

    loop {
        for i in 0..30 {
            // Set value of first signal of integers
            sv_map.set("temp", 15 + i).ok();
            // Set value of second signal of floats
            sv_map.set("temp2", 14. - (i as f32) / 2.).ok();
            // Use next value cell
            sv_map.next(|s| {
                // if package is full, send package with module name
                block!(tx.send_package("TempMod", s)).ok();
            });
            // Wait
            delay.delay_ms(100u16);
        }
    }
Commit count: 27

cargo fmt