pub struct Stm32<'a, I2c: Write + Read, DelayMs> { /* private fields */ }
Implementations§
Source§impl<E, I2c, Delay> Stm32<'static, I2c, Delay>
impl<E, I2c, Delay> Stm32<'static, I2c, Delay>
Sourcepub fn new_with_delay(
dev: I2c,
delay: Delay,
config: Config,
) -> Stm32<'static, I2c, Delay>
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>
impl<'a, E, I2c, Delay> Stm32<'a, I2c, Delay>
Sourcepub fn borrowed_with_delay(
dev: &'a mut I2c,
delay: &'a mut Delay,
config: Config,
) -> Stm32<'a, I2c, Delay>
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.
pub fn get_chip_id(&mut self) -> Result<u16, Error>
Sourcepub fn read_memory(&mut self, address: u32, out: &mut [u8]) -> Result<(), Error>
pub fn read_memory(&mut self, address: u32, out: &mut [u8]) -> Result<(), Error>
Reads memory starting from address
, putting the result into out
.
Sourcepub fn write_memory(&mut self, address: u32, data: &[u8]) -> Result<(), Error>
pub fn write_memory(&mut self, address: u32, data: &[u8]) -> Result<(), Error>
Writes data
at address
. Maximum write size is 256 bytes.
Sourcepub fn write_bulk(
&mut self,
address: u32,
bytes: &[u8],
progress_cb: impl FnMut(Progress),
) -> Result<(), Error>
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.
Sourcepub fn verify(
&mut self,
address: u32,
bytes: &[u8],
progress_cb: impl FnMut(Progress),
) -> Result<(), Error>
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.
Sourcepub fn erase_flash(&mut self) -> Result<(), Error>
pub fn erase_flash(&mut self) -> Result<(), Error>
Erase the flash of the STM32.
Sourcepub fn get_bootloader_version(&mut self) -> Result<u8, Error>
pub fn get_bootloader_version(&mut self) -> Result<u8, Error>
Returns the version number of the bootloader.
Auto Trait Implementations§
impl<'a, I2c, DelayMs> Freeze for Stm32<'a, I2c, DelayMs>
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>
impl<'a, I2c, DelayMs> Sync for Stm32<'a, I2c, DelayMs>
impl<'a, I2c, DelayMs> Unpin for Stm32<'a, I2c, DelayMs>
impl<'a, I2c, DelayMs> !UnwindSafe for Stm32<'a, I2c, DelayMs>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more