crazyflie_link/lib.rs
1#![allow(clippy::single_component_path_imports)]
2
3//! # Crazyflie Link
4//!
5//! This Crate implement the Crazyflie radio link connection using Crazyradio.
6//! It allows to scan for Crazyflies and to open a safe bidirectional radio connection using a Crazyradio.
7//!
8//! The entry point to this Crate is the [LinkContext], it keeps track of Crazyradio dongles
9//! and provides functions to open a link [Connection].
10//!
11//! A connection can then be used to send and receive packet with the Crazyflie.
12//!
13//! Example:
14//!
15//! ``` no_run
16//! # use std::error::Error;
17//! # async fn test() -> Result<(), Box<dyn Error>> {
18//! // Create a link Context
19//! let context = crazyflie_link::LinkContext::new();
20//!
21//! // Scan for Crazyflies
22//! let cf_found = context.scan([0xe7; 5]).await?;
23//!
24//! if let Some(uri) = cf_found.first() {
25//! let connection = context.open_link(uri).await?;
26//! let packet = connection.recv_packet().await?;
27//! println!("Packet received: {:?}", packet);
28//! }
29//! # Ok(())
30//! # }
31//! ```
32//!
33
34#[macro_use]
35extern crate bitflags;
36
37mod connection;
38mod context;
39mod crazyflie_usb_connection;
40mod crazyradio_connection;
41mod error;
42mod packet;
43
44pub(crate) use crazyradio;
45
46pub use connection::{Connection, ConnectionStatus};
47pub use context::LinkContext;
48pub use error::Error;
49pub use packet::Packet;