Struct stm32_hal2::crc::Polynomial[][src]

pub struct Polynomial(_);
Expand description

A CRC polynomial.

The STM32H7 CRC unit only supports odd polynomials, and the constructors will check to ensure the polynomial is odd unless the _unchecked variants are used.

Even polynomials are essentially never used in CRCs, so you most likely don’t need to worry about this if you aren’t creating your own algorithm.

A polynomial being even means that the least significant bit is 0 in the polynomial’s normal representation.

Implementations

impl Polynomial[src]

pub fn bits7(poly: u8) -> Result<Self, PolynomialError>[src]

Create a 7-bit polynomial. Returns an error if the polynomial passed has the MSB set or is even.

pub fn bits8(poly: u8) -> Result<Self, PolynomialError>[src]

Create an 8-bit polynomial. Returns an error if the polynomial passed is even.

pub fn bits16(poly: u16) -> Result<Self, PolynomialError>[src]

Create a 16-bit polynomial. Returns an error if the polynomial passed is even.

pub fn bits32(poly: u32) -> Result<Self, PolynomialError>[src]

Create a 32-bit polynomial. Returns an error if the polynomial passed is even.

pub const fn bits7_unchecked(poly: u8) -> Self[src]

Create a 7-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.

pub const fn bits8_unchecked(poly: u8) -> Self[src]

Create an 8-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.

pub const fn bits16_unchecked(poly: u16) -> Self[src]

Create a 16-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.

pub const fn bits32_unchecked(poly: u32) -> Self[src]

Create a 32-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.

Trait Implementations

impl Clone for Polynomial[src]

fn clone(&self) -> Polynomial[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Polynomial[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Polynomial[src]

fn default() -> Self[src]

Returns the 32-bit polynomial 0x04C1_1DB7.

impl PartialEq<Polynomial> for Polynomial[src]

fn eq(&self, other: &Polynomial) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Polynomial) -> bool[src]

This method tests for !=.

impl Copy for Polynomial[src]

impl StructuralPartialEq for Polynomial[src]

Auto Trait Implementations

impl Send for Polynomial

impl Sync for Polynomial

impl Unpin for Polynomial

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.