#gps #uart #connect #pin #tx #raspberry #rx

app crate_IA7_GPS

Get data from GPS with UART

2 unstable releases

0.2.0 Sep 30, 2020
0.1.0 Sep 30, 2020

#12 in #tx

40 downloads per month

MIT license

7KB
109 lines

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

~375KB