1 unstable release

0.1.0 Sep 30, 2020

#13 in #tx

39 downloads per month

MIT license

10MB
235 lines

readme

How to use crate_IA7_GPS

  • connect your GPS to the raspberry berry via Tx and Rx pin.

  • create a structure like that :

    let mut data= GpsData { Uart_ : Uart::new(9600, Parity::None, 8, 1)?, id : "0".to_string(), time : "0".to_string(), lat : "0".to_string(), long : "0".to_string(), nbSat : "0".to_string(), hdop : "0".to_string(), alti : "0".to_string(), };

  • Initialisation with data.init()

  • Getting data with data.getdata()

  • All the useful data will be set in the structure () id time latitude longitude Number of sat altitude

example :

fn main() -> Result<(), Box> {

let mut data= GpsData {
    Uart_ : Uart::new(9600, Parity::None, 8, 1)?,
    id    : "0".to_string(),
    time  : "0".to_string(),
    lat   : "0".to_string(),
    long  : "0".to_string(),
    nbSat : "0".to_string(),
    hdop  : "0".to_string(),
    alti  : "0".to_string(),
};

data.init();
// println!("Start");
loop {
    data.getData();
    println!("lat : {} N", data.lat);
    println!("long : {} W", data.long);
    thread::sleep(Duration::from_millis(1000));
}

Ok(())

}

Dependencies