Skip to content

Commit f89f348

Browse files
Merge pull request #1 from wfan19/master
Bugfix: Fixed GPIO pin mode configuration and begin()
2 parents c228081 + f29c3bc commit f89f348

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

qwiic_gpio.py

Lines changed: 11 additions & 11 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
@@ -182,7 +182,7 @@ def begin(self):
182182
183183
"""
184184

185-
return isConnected()
185+
return self.isConnected()
186186

187187
#----------------------------------------------------------------
188188
# setMode()
@@ -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)