dw3000_ng/hl/
mod.rs

1//! High-level interface to the DW3000
2//!
3//! The entry point to this API is the [DW3000] struct. Please refer to the
4//! documentation there for more details.
5//!
6//! This module implements a high-level interface to the DW3000. This is the
7//! recommended way to access the DW3000 using this crate, unless you need the
8//! greater flexibility provided by the [register-level interface].
9//!
10//! [register-level interface]: ../ll/index.html
11
12use core::{fmt, num::Wrapping};
13
14#[allow(unused_imports)]
15pub use awake::*;
16pub use error::*;
17pub use ready::*;
18#[allow(unused_imports)]
19pub use receiving::*;
20#[allow(unused_imports)]
21pub use sending::*;
22#[allow(unused_imports)]
23pub use sleeping::*;
24pub use state_impls::*;
25#[allow(unused_imports)]
26pub use uninitialized::*;
27
28use crate::ll;
29
30mod awake;
31mod error;
32mod ready;
33mod receiving;
34mod sending;
35mod sleeping;
36mod state_impls;
37mod uninitialized;
38
39/// Entry point to the DW3000 driver API
40#[derive(Copy, Clone)]
41pub struct DW3000<SPI, State> {
42    ll: ll::DW3000<SPI>,
43    seq: Wrapping<u8>,
44    state: State,
45}
46
47// Can't be derived without putting requirements on `SPI` and `CS`.
48impl<SPI, State> fmt::Debug for DW3000<SPI, State>
49where
50    State: fmt::Debug,
51{
52    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
53        write!(f, "DW3000 {{ state: ")?;
54        self.state.fmt(f)?;
55        write!(f, ", .. }}")?;
56
57        Ok(())
58    }
59}