[−][src]Struct mh_zx_driver::Sensor
A struct representing sensor interface.
Implementations
impl<R, W> Sensor<UartWrapper<R, W>> where
R: Read<u8>,
W: Write<u8>,
[src]
R: Read<u8>,
W: Write<u8>,
Constructs the Sensor
interface from 2 'halves' of UART.
pub fn from_rx_tx(read: R, write: W) -> Sensor<UartWrapper<R, W>>
[src]
impl<U> Sensor<U> where
U: Read<u8> + Write<u8>,
[src]
U: Read<u8> + Write<u8>,
pub fn new(uart: U) -> Sensor<U>
[src]
pub fn write_packet_op<'a>(
&'a mut self,
packet: &'a Packet
) -> impl FnMut() -> Result<(), <U as Write<u8>>::Error> + 'a
[src]
&'a mut self,
packet: &'a Packet
) -> impl FnMut() -> Result<(), <U as Write<u8>>::Error> + 'a
Write a packet to the device.
Returns a closure that sends a packet to the sensor.
The result of this function can be used with the
block!()
macro from
nb
crate, e.g.:
let mut op = sensor.write_packet_op(commands::READ_CO2); block!(op()).unwrap();
pub fn read_packet_op<'a>(
&'a mut self,
packet: &'a mut Packet
) -> impl FnMut() -> Result<(), <U as Read<u8>>::Error> + 'a
[src]
&'a mut self,
packet: &'a mut Packet
) -> impl FnMut() -> Result<(), <U as Read<u8>>::Error> + 'a
Auto Trait Implementations
impl<U> Send for Sensor<U> where
U: Send,
U: Send,
impl<U> Sync for Sensor<U> where
U: Sync,
U: Sync,
impl<U> Unpin for Sensor<U> where
U: Unpin,
U: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,