cargo fmt
This commit is contained in:
parent
e67af514e9
commit
7392e33ad5
@ -33,11 +33,9 @@ impl CrcConfig {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
reverse_in: CrcInputReverseConfig,
|
reverse_in: CrcInputReverseConfig,
|
||||||
reverse_out: bool,
|
reverse_out: bool,
|
||||||
#[cfg(crc_v3)]
|
#[cfg(crc_v3)] poly_size: PolySize,
|
||||||
poly_size: PolySize,
|
|
||||||
crc_init_value: u32,
|
crc_init_value: u32,
|
||||||
#[cfg(crc_v3)]
|
#[cfg(crc_v3)] crc_poly: u32,
|
||||||
crc_poly: u32,
|
|
||||||
) -> Result<Self, CrcConfigError> {
|
) -> Result<Self, CrcConfigError> {
|
||||||
// As Per RM0091 (DocID018940 Rev 9), Even polynomials are not supported.
|
// As Per RM0091 (DocID018940 Rev 9), Even polynomials are not supported.
|
||||||
#[cfg(crc_v3)]
|
#[cfg(crc_v3)]
|
||||||
@ -136,12 +134,12 @@ impl Crc {
|
|||||||
/// Feeds an slice of bytes into the CRC peripheral. Returns the computed checksum.
|
/// Feeds an slice of bytes into the CRC peripheral. Returns the computed checksum.
|
||||||
pub fn feed_bytes(&mut self, bytes: &[u8]) -> u32 {
|
pub fn feed_bytes(&mut self, bytes: &[u8]) -> u32 {
|
||||||
for byte in bytes {
|
for byte in bytes {
|
||||||
unsafe { PAC_CRC.dr8().write_value(*byte as u32); }
|
|
||||||
}
|
|
||||||
unsafe {
|
unsafe {
|
||||||
PAC_CRC.dr().read()
|
PAC_CRC.dr8().write_value(*byte as u32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unsafe { PAC_CRC.dr().read() }
|
||||||
|
}
|
||||||
/// Feeds a halfword into the CRC peripheral. Returns the computed checksum.
|
/// Feeds a halfword into the CRC peripheral. Returns the computed checksum.
|
||||||
pub fn feed_halfword(&mut self, byte: u16) -> u32 {
|
pub fn feed_halfword(&mut self, byte: u16) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -152,12 +150,12 @@ impl Crc {
|
|||||||
/// Feeds an slice of halfwords into the CRC peripheral. Returns the computed checksum.
|
/// Feeds an slice of halfwords into the CRC peripheral. Returns the computed checksum.
|
||||||
pub fn feed_halfwords(&mut self, bytes: &[u16]) -> u32 {
|
pub fn feed_halfwords(&mut self, bytes: &[u16]) -> u32 {
|
||||||
for byte in bytes {
|
for byte in bytes {
|
||||||
unsafe { PAC_CRC.dr16().write_value(*byte as u32); }
|
|
||||||
}
|
|
||||||
unsafe {
|
unsafe {
|
||||||
PAC_CRC.dr().read()
|
PAC_CRC.dr16().write_value(*byte as u32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unsafe { PAC_CRC.dr().read() }
|
||||||
|
}
|
||||||
/// Feeds a halfword into the CRC peripheral. Returns the computed checksum.
|
/// Feeds a halfword into the CRC peripheral. Returns the computed checksum.
|
||||||
pub fn feed_word(&mut self, byte: u32) -> u32 {
|
pub fn feed_word(&mut self, byte: u32) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -168,10 +166,10 @@ impl Crc {
|
|||||||
/// Feeds an slice of halfwords into the CRC peripheral. Returns the computed checksum.
|
/// Feeds an slice of halfwords into the CRC peripheral. Returns the computed checksum.
|
||||||
pub fn feed_words(&mut self, bytes: &[u32]) -> u32 {
|
pub fn feed_words(&mut self, bytes: &[u32]) -> u32 {
|
||||||
for byte in bytes {
|
for byte in bytes {
|
||||||
unsafe { PAC_CRC.dr().write_value(*byte as u32); }
|
|
||||||
}
|
|
||||||
unsafe {
|
unsafe {
|
||||||
PAC_CRC.dr().read()
|
PAC_CRC.dr().write_value(*byte as u32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unsafe { PAC_CRC.dr().read() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user