From ad9a63a66606001e1047b044cb6924e5e51c321c Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 21 Dec 2016 22:20:28 -0800 Subject: [PATCH] GPIO: Fix apparent dumb bit-logic bug. Not due to any observable incorrect behavior, but just noticing that the code, as previously written, should not work... --- firmware/common/gpio.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/common/gpio.hpp b/firmware/common/gpio.hpp index 0f02d6ec..97e69952 100644 --- a/firmware/common/gpio.hpp +++ b/firmware/common/gpio.hpp @@ -37,12 +37,12 @@ struct PinConfig { constexpr operator uint16_t() { return - ((~ifilt) << 7) - | (input << 6) - | (fast << 5) - | ((~pu) << 4) - | (pd << 3) - | (mode << 0); + (((~ifilt) & 1) << 7) + | ((input & 1) << 6) + | ((fast & 1) << 5) + | (((~pu) & 1) << 4) + | ((pd & 1) << 3) + | ((mode & 1) << 0); } /* constexpr operator uint32_t() {