Skip to main content

Crc

Struct Crc 

Source
pub struct Crc<'d, T: Instance> { /* private fields */ }
Expand description

CRC-32 driver.

Implementations§

Source§

impl<'d, T: Instance> Crc<'d, T>

Source

pub fn new(inner: Peri<'d, T>) -> Self

Enable the peripheral clock and start a new calculation at 0xFFFF_FFFF.

Source

pub fn reset(&mut self)

Reset the CRC accumulator to 0xFFFF_FFFF without changing the independent data register.

Source

pub fn feed_word(&mut self, word: u32) -> u32

Feed a 32-bit word, most-significant bit first, and return the new CRC.

Source

pub fn feed_words(&mut self, words: &[u32]) -> u32

Feed the words in slice order without resetting the accumulator and return the new CRC.

Source

pub fn read(&self) -> u32

Read the raw CRC remainder without resetting the accumulator.

Source

pub fn set_independent_data(&mut self, value: u8)

Store a byte in the independent data register.

This byte is not included in the CRC calculation and survives Self::reset.

Source

pub fn independent_data(&self) -> u8

Read the independent data register; it does not affect the CRC calculation.

Trait Implementations§

Source§

impl<'d, T: Instance> Drop for Crc<'d, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'d, T> !UnwindSafe for Crc<'d, T>

§

impl<'d, T> Freeze for Crc<'d, T>
where T: Freeze,

§

impl<'d, T> RefUnwindSafe for Crc<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for Crc<'d, T>
where T: Send,

§

impl<'d, T> Sync for Crc<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for Crc<'d, T>
where T: Unpin,

§

impl<'d, T> UnsafeUnpin for Crc<'d, T>
where T: UnsafeUnpin,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.