pub fn reset(&mut self) -> nb::Result<(), Error<E>> {
        if !self.has_reset_finished().map_err(nb::Error::Other)? {
            Err(nb::Error::WouldBlock)
        } else if self.was_reset_started {
            self.was_reset_started = false;
            Ok(())
        } else {
            self.i2c
                .write(self.address, &[Register::CTRL2, BitFlags::SRST])
                .map_err(Error::I2C)
                .map_err(nb::Error::Other)?;
            self.ctrl1 = Config::default();
            self.ctrl2 = Config::default();
            self.data_ctrl = DATA_CTRL_DEFAULT;
            self.was_reset_started = true;
            Err(nb::Error::WouldBlock)
        }
    }
/// Perform software reset.
///
/// This method offers a non-blocking interface. While the reset is in
/// progress and when the reset was first triggered this will
/// return `nb::Error::WouldBlock`.
Perform software reset.
This method offers a non-blocking interface. While the reset is in
progress and when the reset was first triggered this will
return `nb::Error::WouldBlock`.
Perform software reset . This method offers a non - blocking interface . While the reset is in progress and when the reset was first triggered this will return ` nb :: Error :: WouldBlock ` .
pub fn reset(&mut self) -> nb::Result<(), Error<E>> {
        if !self.has_reset_finished().map_err(nb::Error::Other)? {
            Err(nb::Error::WouldBlock)
        } else if self.was_reset_started {
            self.was_reset_started = false;
            Ok(())
        } else {
            self.i2c
                .write(self.address, &[Register::CTRL2, BitFlags::SRST])
                .map_err(Error::I2C)
                .map_err(nb::Error::Other)?;
            self.ctrl1 = Config::default();
            self.ctrl2 = Config::default();
            self.data_ctrl = DATA_CTRL_DEFAULT;
            self.was_reset_started = true;
            Err(nb::Error::WouldBlock)
        }
    }
pub fn reset ( & mut self ) -> nb :: Result < ( ) , Error < E > > { if ! self . has_reset_finished ( ) . map_err ( nb :: Error :: Other ) ? { Err ( nb :: Error :: WouldBlock ) } else if self . was_reset_started { self . was_reset_started = false ; Ok ( ( ) ) } else { self . i2c . write ( self . address , & [ Register :: CTRL2 , BitFlags :: SRST ] ) . map_err ( Error :: I2C ) . map_err ( nb :: Error :: Other ) ? ; self . ctrl1 = Config :: default ( ) ; self . ctrl2 = Config :: default ( ) ; self . data_ctrl = DATA_CTRL_DEFAULT ; self . was_reset_started = true ; Err ( nb :: Error :: WouldBlock ) } }
Perform software reset.
Perform software reset .
&mut self
&mut self