ydlidar_rust_driver/lib.rs
1//! # YDLidar Driver
2//!
3//! rust implementation of the YDLidar
4//! ## Quick Start
5//!
6//! ```no_run
7//! use ydlidar::{Lidar, TMiniPlus};
8//!
9//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
10//! // Create a new LIDAR instance (auto-detects USB port)
11//! let mut lidar = Lidar::<TMiniPlus>::new()?;
12//!
13//! // Get device information
14//! let (model, firmware, hardware) = lidar.get_device_info()?;
15//! println!("Model: {}, Firmware: {}, Hardware: {}", model, firmware, hardware);
16//!
17//! // Start scanning
18//! lidar.start_scan()?;
19//!
20//! // Read scan data
21//! loop {
22//! let points = lidar.get_scan_points()?;
23//! for point in points {
24//! println!("Angle: {:.2}°, Distance: {}mm, Quality: {}",
25//! point.angle, point.distance, point.quality);
26//! }
27//! }
28//! # }
29//! ```
30
31#![cfg_attr(not(feature = "std"), no_std)]
32#![warn(missing_docs)]
33#![warn(rust_2018_idioms)]
34
35/// Command definitions for LIDAR models.
36pub mod cmd;
37
38/// Error types and implementations.
39pub mod error;
40
41/// Main LIDAR driver implementation.
42pub mod lidar;
43
44/// Core types and traits.
45pub mod types;
46
47// Re-export main types for convenience
48pub use crate::error::LidarError;
49pub use crate::lidar::{Lidar, ScanPoint};
50pub use crate::types::{LidarCommands, TMiniPlus};