Use u16 instead u32

This commit is contained in:
Jonathan BAUDIN 2023-10-10 19:44:06 +02:00
parent cb47055532
commit 5c65b1f413

View file

@ -42,7 +42,7 @@ impl<P: PIOExt, STI: StateMachineIndex> DhtPio<P, STI> {
} }
} }
pub fn read_data(&mut self, delay: &mut Delay) -> Result<(u32, u32), DhtError> { pub fn read_data(&mut self, delay: &mut Delay) -> Result<(u16, u16), DhtError> {
let mut timeout = 2000; let mut timeout = 2000;
let mut raw: [Option<u32>; 2] = [None; 2]; let mut raw: [Option<u32>; 2] = [None; 2];
@ -79,7 +79,10 @@ impl<P: PIOExt, STI: StateMachineIndex> DhtPio<P, STI> {
)); ));
} }
Ok((data & 0x0000FFFF, (data & 0xFFFF0000) >> 16)) Ok((
(data & 0x0000FFFF) as u16,
((data & 0xFFFF0000) >> 16) as u16,
))
} }
fn compute_crc(data: u32) -> u32 { fn compute_crc(data: u32) -> u32 {