Skip to content

Commit b769089

Browse files
committed
Bugfix: Fixed GPIO pin mode configuration
1 parent c228081 commit b769089

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

qwiic_gpio.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ class QwiicGPIO(object):
9494
REG_CONFIGURATION = 0x03
9595

9696
# Status/Configuration Flags
97-
GPIO_IN = 0
98-
GPIO_OUT = 1
97+
GPIO_OUT = 0
98+
GPIO_IN = 1
9999

100100
GPIO_LO = 0
101101
GPIO_HI = 1
@@ -196,14 +196,14 @@ def setMode(self):
196196
197197
"""
198198
tempData = 0
199-
tempData &= self.mode_0 << 0
200-
tempData &= self.mode_1 << 1
201-
tempData &= self.mode_2 << 2
202-
tempData &= self.mode_3 << 3
203-
tempData &= self.mode_4 << 4
204-
tempData &= self.mode_5 << 5
205-
tempData &= self.mode_6 << 6
206-
tempData &= self.mode_7 << 7
199+
tempData |= self.mode_0 << 0
200+
tempData |= self.mode_1 << 1
201+
tempData |= self.mode_2 << 2
202+
tempData |= self.mode_3 << 3
203+
tempData |= self.mode_4 << 4
204+
tempData |= self.mode_5 << 5
205+
tempData |= self.mode_6 << 6
206+
tempData |= self.mode_7 << 7
207207
self._i2c.writeByte(self.address, self.REG_CONFIGURATION, tempData)
208208

209209
#----------------------------------------------------------------

0 commit comments

Comments
 (0)