Trait Ccs811BootMode

Source
pub trait Ccs811BootMode: Sealed {
    type Error;
    type ModeChangeError;
    type TargetType;

    // Required methods
    fn start_application(
        self,
    ) -> Result<Self::TargetType, Self::ModeChangeError>;
    fn update_application<D: DelayNs>(
        &mut self,
        bin: &[u8],
        delay: &mut D,
    ) -> Result<(), Self::Error>;
    fn verify_application(&mut self) -> Result<(), Self::Error>;
    fn erase_application(&mut self) -> Result<(), Self::Error>;
    fn download_application<D: DelayNs>(
        &mut self,
        bin: &[u8],
        delay: &mut D,
    ) -> Result<(), Self::Error>;
    fn software_reset(&mut self) -> Result<(), Self::Error>;
}
Expand description

Methods available when on boot mode

Required Associated Types§

Source

type Error

Error type

Source

type ModeChangeError

Boot/App mode change error

Source

type TargetType

Application mode type

Required Methods§

Source

fn start_application(self) -> Result<Self::TargetType, Self::ModeChangeError>

Start application mode

NOTE: after this call 1ms must be waited before sending application commands.

Source

fn update_application<D: DelayNs>( &mut self, bin: &[u8], delay: &mut D, ) -> Result<(), Self::Error>

Reset, erase, download new application and verify it in one step.

This resets the device via a software reset, erases the current application, flashes the new binary and verifies it. This takes at least 572ms + 50ms * (bin_size/8). Returns Error::InvalidInputData if the input binary lengh is not multiple of 8.

Source

fn verify_application(&mut self) -> Result<(), Self::Error>

Verify application.

NOTE: After the first call, 70ms must be waited before calling again to poll until completion.

Source

fn erase_application(&mut self) -> Result<(), Self::Error>

Erase application.

NOTE: After the first call, 500ms must be waited before calling again to poll until completion.

Source

fn download_application<D: DelayNs>( &mut self, bin: &[u8], delay: &mut D, ) -> Result<(), Self::Error>

Download new application.

Returns Error::InvalidInputData if the input binary lengh is not multiple of 8. This takes at least 50ms * (bin_size/8).

Source

fn software_reset(&mut self) -> Result<(), Self::Error>

Restart the device in boot mode.

2ms should be waited before doing any other operation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I2C, CommE, PinE, NWAKE, WAKEDELAY> Ccs811BootMode for Ccs811<I2C, NWAKE, WAKEDELAY, Boot>
where I2C: I2c<Error = CommE>, NWAKE: OutputPin<Error = PinE>, WAKEDELAY: DelayNs,

Source§

type Error = Error<CommE, PinE>

Source§

type ModeChangeError = ModeChangeError<<Ccs811<I2C, NWAKE, WAKEDELAY, Boot> as Ccs811BootMode>::Error, Ccs811<I2C, NWAKE, WAKEDELAY, Boot>>

Source§

type TargetType = Ccs811<I2C, NWAKE, WAKEDELAY, App>

Source§

impl<I2C, E> Ccs811BootMode for Ccs811Awake<I2C, Boot>
where I2C: I2c<Error = E>,