From 4cc95091ab07f0b90c078f087f3826e845443873 Mon Sep 17 00:00:00 2001 From: Yehoshua Pesach Wallach Date: Mon, 13 Dec 2021 12:39:34 +0200 Subject: [PATCH] order ReadHrs, ReadAls bitwise according to bit ordering --- src/drivers/Hrs3300.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp index c14fe7aa..45458adc 100644 --- a/src/drivers/Hrs3300.cpp +++ b/src/drivers/Hrs3300.cpp @@ -58,14 +58,14 @@ uint16_t Hrs3300::ReadHrs() { auto m = ReadRegister(static_cast(Registers::C0DataM)); auto h = ReadRegister(static_cast(Registers::C0DataH)); auto l = ReadRegister(static_cast(Registers::C0dataL)); - return (m << 8) | ((h & 0x0f) << 4) | (l & 0x0f) | ((l & 0x30) << 12); + return ((l & 0x30) << 12) | (m << 8) | ((h & 0x0f) << 4) | (l & 0x0f); } uint16_t Hrs3300::ReadAls() { auto m = ReadRegister(static_cast(Registers::C1dataM)); auto h = ReadRegister(static_cast(Registers::C1dataH)); auto l = ReadRegister(static_cast(Registers::C1dataL)); - return (m << 3) | ((h & 0x3f) << 11) | (l & 0x07); + return ((h & 0x3f) << 11) | (m << 3) | (l & 0x07); } void Hrs3300::SetGain(uint8_t gain) {