ublox_core/interface/
mod.rs

1pub mod serial;
2pub use self::serial::SerialInterface;
3
4pub mod spi;
5pub use self::spi::SpiInterface;
6
7/// A method of communicating with the device
8pub trait DeviceInterface {
9    /// Interface associated error type
10    type InterfaceError;
11
12    /// Fill up our buffer with unsolicited / periodic UBX messages.
13    /// This function should be called before attempting to read.
14    /// Returns the number of available bytes.
15    fn fill(&mut self) -> usize;
16
17    /// Read a single buffered byte.
18    /// Call `fill` before calling this.
19    fn read(&mut self) -> Result<u8, Self::InterfaceError>;
20
21    /// Read multiple buffered bytes.
22    /// Call `fill` before calling this.
23    fn read_many(
24        &mut self,
25        buffer: &mut [u8],
26    ) -> Result<usize, Self::InterfaceError>;
27}