#[repr(C)]pub struct Crc16(/* private fields */);
Expand description
Represents the 16-bit CRC used to protect SD memory card commands, responses, and data transfer messages.
Implementations§
Source§impl Crc16
impl Crc16
Sourcepub const fn calculate(buf: &[u8]) -> Self
pub const fn calculate(buf: &[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^16 + x^12 + x^5 + 1
M(x) = (first bit) * x^n + (second bit) * x^n-1 + ... + (last bit) * x^0
CRC[15..0] = Remainder[(M(x) * x^16) / G(x)]
Trait Implementations§
impl Copy for Crc16
impl Eq for Crc16
impl StructuralPartialEq for Crc16
Auto Trait Implementations§
impl Freeze for Crc16
impl RefUnwindSafe for Crc16
impl Send for Crc16
impl Sync for Crc16
impl Unpin for Crc16
impl UnwindSafe for Crc16
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