MCPcopy Create free account
hub / github.com/FutureSDR/FutureSDR / decode

Function decode

examples/zigbee/src/decoder.rs:8–19  ·  view source on GitHub ↗
(seq: u32, threshold: u32)

Source from the content-addressed store, hash-verified

6];
7
8fn decode(seq: u32, threshold: u32) -> Option<u8> {
9 let mut matches = [32u32; 16];
10 for (i, o) in CHIP_MAPPING.iter().zip(matches.iter_mut()) {
11 *o = ((seq & 0x7FFFFFFE) ^ (i & 0x7FFFFFFE)).count_ones();
12 }
13 let (i, v) = matches
14 .iter()
15 .enumerate()
16 .min_by_key(|(_, item)| **item)
17 .unwrap();
18 if *v < threshold { Some(i as u8) } else { None }
19}
20
21#[derive(Debug)]
22enum State {

Callers 5

r#inMethod · 0.85
decodeMethod · 0.85
decodeMethod · 0.85
decode_mMethod · 0.85
workMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected