From 85d4af6ac2b5f2ea0b521294fa9d56d0f5cf8a51 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 17 Feb 2016 15:35:08 +0100 Subject: [PATCH] fix initialization of input pins (polarity of pull-resistor was not set) --- src/hmi.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hmi.cpp b/src/hmi.cpp index 52a289b..5190b6b 100644 --- a/src/hmi.cpp +++ b/src/hmi.cpp @@ -77,9 +77,11 @@ class SwitchPort2 : public SwitchPort { public: SwitchPort2(uint16_t bit) : SwitchPort() { m_bit = bit; - P2REN |= bit; P2DIR &= ~bit; + P2REN |= bit; + P2OUT |= bit; P2SEL &= ~bit; + P2SEL2 &= ~bit; }; virtual bool getSwitchState() { bool a = P2IN & m_bit; @@ -96,9 +98,11 @@ class SwitchPort1 : public SwitchPort { public: SwitchPort1(uint16_t bit) : SwitchPort() { m_bit = bit; - P1REN |= bit; P1DIR &= ~bit; + P1REN |= bit; + P1OUT |= bit; P1SEL &= ~bit; + P1SEL2 &= ~bit; }; virtual bool getSwitchState() { return P1IN & m_bit;