From c01b7a9825d7365a90bbe8265965d27b4c485598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 1 Jan 2021 17:28:38 +0100 Subject: [PATCH] Fix broken hardware version detect. v1.3 is now correctly detected. --- stm-firmware/hw-version-detect.c | 4 ++-- stm-firmware/main.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/stm-firmware/hw-version-detect.c b/stm-firmware/hw-version-detect.c index a29f829..3e7434a 100644 --- a/stm-firmware/hw-version-detect.c +++ b/stm-firmware/hw-version-detect.c @@ -27,8 +27,8 @@ enum hw_revision get_pcb_hardware_version(void) /* Loop again and read in the pin mask */ for (current_pin = HW_REV_DETECT_PIN_LOW; current_pin <= HW_REV_DETECT_PIN_HIGH; current_pin++) { - port_bitmask <<= 1; - port_bitmask |= (HW_REV_DETECT_GPIO->IDR & (1 << current_pin)) ? 0x0 : 0x1; + port_bitmask >>= 1; + port_bitmask |= (HW_REV_DETECT_GPIO->IDR & (1 << current_pin)) ? 0x0 : 0x80; } switch (port_bitmask) { diff --git a/stm-firmware/main.c b/stm-firmware/main.c index 4146ed1..1d4857b 100644 --- a/stm-firmware/main.c +++ b/stm-firmware/main.c @@ -248,7 +248,6 @@ int main(void) __WFI(); else __NOP(); - } return 0;