From d96224c2fdc535d08de23aec30d62d4ada9fb8d3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Jan 2017 15:29:13 -0800 Subject: altos/chaoskey: use both halves of the CRC When pulling 16 bits from the 32-bit crc, instead of just using the low bits, xor the two halves together. This appears to even out the number of zero and one bits. Signed-off-by: Keith Packard --- src/stmf0/ao_crc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/stmf0') diff --git a/src/stmf0/ao_crc.h b/src/stmf0/ao_crc.h index 7acc6f9c..b6d91023 100644 --- a/src/stmf0/ao_crc.h +++ b/src/stmf0/ao_crc.h @@ -35,7 +35,8 @@ static inline uint16_t ao_crc_in_32_out_16(uint32_t v) { stm_crc.dr.u32 = v; - return stm_crc.dr.u16; + v = stm_crc.dr.u32; + return v ^ (v >> 16); } static inline uint16_t -- cgit v1.2.3