#[repr(C)]pub struct Crc7(/* private fields */);
Expand description
Represents the 7-bit CRC used to protect SD memory card commands, responses, and data transfer messages.
Implementations§
Source§impl Crc7
impl Crc7
Sourcepub const fn calculate(data: &[u8]) -> Self
pub const fn calculate(data: &[u8]) -> Self
Calculates the CRC7 value according the algorithm defined in the simplified physical specification. See section “4.5 Cyclic Redundancy Code” for details.
Generator Polynomial: G(x) = x^7 + x^3 + 1
M(x) = (first bit) * x^n + (second bit) * x^n-1 + ... + (last bit) * x^0
CRC[6..0] = Remainder[(M(x) * x^7) / G(x)]
Implementation based on the lookup table algorithm from: hazelnusse/crc7.
Trait Implementations§
impl Copy for Crc7
impl Eq for Crc7
impl StructuralPartialEq for Crc7
Auto Trait Implementations§
impl Freeze for Crc7
impl RefUnwindSafe for Crc7
impl Send for Crc7
impl Sync for Crc7
impl Unpin for Crc7
impl UnwindSafe for Crc7
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