#serial-port #gps #module #data #reading #initializing #yahboom

yahboom_gps

A Rust library for initializing and reading GPS data from a Yahboom GPS module via a serial port

1 unstable release

0.1.0 Jun 6, 2024

#1200 in Hardware support

Apache-2.0

15KB
141 lines

yahboom_gps

githubcrates-iodocs-rs


yahboom_gps is a Rust library for initializing and reading GPS data from a Yahboom GPS module via a serial port.

Installation

Add this to your Cargo.toml:

[dependencies]
yahboom_gps = "0.1.0"

Example

Here is a complete example demonstrating how to use the yahboom_gps library to initialize the GPS module, read GPS messages, and parse GPS data.

use yahboom_gps::{gps_init, read_complete_gps_message, parse_gps_data};
use anyhow::Result;

fn main() -> Result<()> {
    // Initialize the GPS module
    let mut port = gps_init("COM3", 9600)?;

    // Continuously read and parse GPS messages
    while let Ok(Some(message)) = read_complete_gps_message(&mut port) {
        // Parse the GPS data
        let parsed_data = parse_gps_data(&message);

        // Print the parsed GPS data
        println!("Parsed GPS Data: {}", serde_json::to_string_pretty(&parsed_data)?);
        println!("--- End of message ---");
    }

    Ok(())
}

Documentation

For more detailed documentation, please visit docs.rs.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

Contact

If you have any questions or suggestions, please feel free to contact me at [401].

Dependencies

~2.3–3MB
~63K SLoC