Skip to content

Commit 8978603

Browse files
committed
Tabs Removed from Adafruit_MCP230xx.py
1 parent c5a4f34 commit 8978603

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

Adafruit_MCP230xx/Adafruit_MCP230xx.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python
22

33
# Copyright 2012 Daniel Berlin (with some changes by Adafruit Industries/Limor Fried)
44
#
@@ -125,35 +125,35 @@ def input(self, pin):
125125
value |= temp
126126
return value & (1 << pin)
127127

128-
def readU8(self):
129-
result = self.i2c.readU8(MCP23008_OLATA)
130-
return(result)
128+
def readU8(self):
129+
result = self.i2c.readU8(MCP23008_OLATA)
130+
return(result)
131131

132-
def readS8(self):
133-
result = self.i2c.readU8(MCP23008_OLATA)
134-
if (result > 127): result -= 256
135-
return result
132+
def readS8(self):
133+
result = self.i2c.readU8(MCP23008_OLATA)
134+
if (result > 127): result -= 256
135+
return result
136136

137-
def readU16(self):
138-
assert self.num_gpios >= 16, "16bits required"
139-
lo = self.i2c.readU8(MCP23017_OLATA)
140-
hi = self.i2c.readU8(MCP23017_OLATB)
141-
return((hi << 8) | lo)
137+
def readU16(self):
138+
assert self.num_gpios >= 16, "16bits required"
139+
lo = self.i2c.readU8(MCP23017_OLATA)
140+
hi = self.i2c.readU8(MCP23017_OLATB)
141+
return((hi << 8) | lo)
142142

143-
def readS16(self):
144-
assert self.num_gpios >= 16, "16bits required"
145-
lo = self.i2c.readU8(MCP23017_OLATA)
146-
hi = self.i2c.readU8(MCP23017_OLATB)
147-
if (hi > 127): hi -= 256
148-
return((hi << 8) | lo)
143+
def readS16(self):
144+
assert self.num_gpios >= 16, "16bits required"
145+
lo = self.i2c.readU8(MCP23017_OLATA)
146+
hi = self.i2c.readU8(MCP23017_OLATB)
147+
if (hi > 127): hi -= 256
148+
return((hi << 8) | lo)
149149

150-
def write8(self, value):
151-
self.i2c.write8(MCP23008_OLATA, value)
150+
def write8(self, value):
151+
self.i2c.write8(MCP23008_OLATA, value)
152152

153-
def write16(self, value):
154-
assert self.num_gpios >= 16, "16bits required"
155-
self.i2c.write8(MCP23017_OLATA, value & 0xFF)
156-
self.i2c.write8(MCP23017_OLATB, (value >> 8) & 0xFF)
153+
def write16(self, value):
154+
assert self.num_gpios >= 16, "16bits required"
155+
self.i2c.write8(MCP23017_OLATA, value & 0xFF)
156+
self.i2c.write8(MCP23017_OLATB, (value >> 8) & 0xFF)
157157

158158
# RPi.GPIO compatible interface for MCP23017 and MCP23008
159159

@@ -181,21 +181,21 @@ def pullup(self, pin, value):
181181
mcp = Adafruit_MCP230XX(address = 0x20, num_gpios = 8)
182182

183183
# ***************************************************
184-
# Set num_gpios to 8 for MCP23008 or 16 for MCP23017!
185-
# If you have a new Pi you may also need to add:
186-
# busnum = 1
187-
# ***************************************************
188-
189-
# Set pins 0, 1 and 2 to output (you can set pins 0..15 this way)
184+
# Set num_gpios to 8 for MCP23008 or 16 for MCP23017!
185+
# If you have a new Pi you may also need to add:
186+
# busnum = 1
187+
# ***************************************************
188+
189+
# Set pins 0, 1 and 2 to output (you can set pins 0..15 this way)
190190
mcp.config(0, mcp.OUTPUT)
191191
mcp.config(1, mcp.OUTPUT)
192192
mcp.config(2, mcp.OUTPUT)
193-
194-
# Set pin 3 to input with the pullup resistor enabled
193+
194+
# Set pin 3 to input with the pullup resistor enabled
195195
mcp.pullup(3, 1)
196196
# Read pin 3 and display the results
197197
print "%d: %x" % (3, mcp.input(3) >> 3)
198-
198+
199199
# Python speed test on output 0 toggling at max speed
200200
while (True):
201201
mcp.output(0, 1) # Pin 0 High

0 commit comments

Comments
 (0)