Struct Stm32

Source
pub struct Stm32<'a, I2c: Write + Read, DelayMs> { /* private fields */ }

Implementations§

Source§

impl<E, I2c> Stm32<'static, I2c, StdDelay>
where E: Debug, I2c: Write<Error = E> + Read<Error = E>,

Source

pub fn new(dev: I2c, config: Config) -> Stm32<'static, I2c, StdDelay>

Source§

impl<'a, E, I2c> Stm32<'a, I2c, StdDelay>
where E: Debug, I2c: Write<Error = E> + Read<Error = E>,

Source

pub fn borrowed(dev: &'a mut I2c, config: Config) -> Stm32<'a, I2c, StdDelay>

Construct a new instance where we only borrow the I2C implementation. This is useful if you have other things on the I2C bus that want to communicate with so don’t want to give up ownership of the I2C bus.

Source§

impl<E, I2c, Delay> Stm32<'static, I2c, Delay>
where E: Debug, I2c: Write<Error = E> + Read<Error = E>, Delay: DelayMs<u32>,

Source

pub fn new_with_delay( dev: I2c, delay: Delay, config: Config, ) -> Stm32<'static, I2c, Delay>

Constructs a new instance with a custom delay implementation.

Source§

impl<'a, E, I2c, Delay> Stm32<'a, I2c, Delay>
where E: Debug, I2c: Write<Error = E> + Read<Error = E>, Delay: DelayMs<u32>,

Source

pub fn borrowed_with_delay( dev: &'a mut I2c, delay: &'a mut Delay, config: Config, ) -> Stm32<'a, I2c, Delay>

Borrows both the I2C implementation and a custom delay.

Source

pub fn get_chip_id(&mut self) -> Result<u16, Error>

Source

pub fn read_memory(&mut self, address: u32, out: &mut [u8]) -> Result<(), Error>

Reads memory starting from address, putting the result into out.

Source

pub fn write_memory(&mut self, address: u32, data: &[u8]) -> Result<(), Error>

Writes data at address. Maximum write size is 256 bytes.

Source

pub fn write_bulk( &mut self, address: u32, bytes: &[u8], progress_cb: impl FnMut(Progress), ) -> Result<(), Error>

Writes bytes to address, calling progress_cb after each block.

Source

pub fn verify( &mut self, address: u32, bytes: &[u8], progress_cb: impl FnMut(Progress), ) -> Result<(), Error>

Verifies that memory at address is equal to bytes, calling progress_cb to report progress.

Source

pub fn erase_flash(&mut self) -> Result<(), Error>

Erase the flash of the STM32.

Source

pub fn get_bootloader_version(&mut self) -> Result<u8, Error>

Returns the version number of the bootloader.

Source

pub fn go(&mut self, address: u32) -> Result<(), Error>

Exit system bootloader by jumping to the reset vector specified in the vector table at address.

Auto Trait Implementations§

§

impl<'a, I2c, DelayMs> Freeze for Stm32<'a, I2c, DelayMs>
where I2c: Freeze, DelayMs: Freeze,

§

impl<'a, I2c, DelayMs> RefUnwindSafe for Stm32<'a, I2c, DelayMs>
where I2c: RefUnwindSafe, DelayMs: RefUnwindSafe,

§

impl<'a, I2c, DelayMs> Send for Stm32<'a, I2c, DelayMs>
where I2c: Send, DelayMs: Send,

§

impl<'a, I2c, DelayMs> Sync for Stm32<'a, I2c, DelayMs>
where I2c: Sync, DelayMs: Sync,

§

impl<'a, I2c, DelayMs> Unpin for Stm32<'a, I2c, DelayMs>
where I2c: Unpin, DelayMs: Unpin,

§

impl<'a, I2c, DelayMs> !UnwindSafe for Stm32<'a, I2c, DelayMs>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.