Skip to content

Commit 3e28984

Browse files
committed
rename nicer props
1 parent 3cc4ce1 commit 3e28984

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

adafruit_mcp230xx.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def get_pin(self, pin):
414414
return DigitalInOut(pin, self)
415415

416416
@property
417-
def intcon(self):
417+
def interrupt_configuration(self):
418418
"""The raw INTCON interrupt control register. The INTCON register
419419
controls how the associated pin value is compared for the
420420
interrupt-on-change feature. If a bit is set, the corresponding
@@ -424,12 +424,12 @@ def intcon(self):
424424
"""
425425
return self._read_u16le(_MCP23017_INTCONA)
426426

427-
@intcon.setter
428-
def intcon(self, val):
427+
@interrupt_configuration.setter
428+
def interrupt_configuration(self, val):
429429
self._write_u16le(_MCP23017_INTCONA, val)
430430

431431
@property
432-
def gpinten(self):
432+
def interrupt_enable(self):
433433
"""The raw GPINTEN interrupt control register. The GPINTEN register
434434
controls the interrupt-on-change feature for each pin. If a bit is
435435
set, the corresponding pin is enabled for interrupt-on-change.
@@ -438,26 +438,26 @@ def gpinten(self):
438438
"""
439439
return self._read_u16le(_MCP23017_GPINTENA)
440440

441-
@gpinten.setter
442-
def gpinten(self, val):
441+
@interrupt_enable.setter
442+
def interrupt_enable(self, val):
443443
self._write_u16le(_MCP23017_GPINTENA, val)
444444

445445
@property
446-
def defval(self):
446+
def default_value(self):
447447
"""The raw DEFVAL interrupt control register. The default comparison
448448
value is configured in the DEFVAL register. If enabled (via GPINTEN
449449
and INTCON) to compare against the DEFVAL register, an opposite value
450450
on the associated pin will cause an interrupt to occur.
451451
"""
452452
return self._read_u16le(_MCP23017_DEFVALA)
453453

454-
@defval.setter
455-
def defval(self, val):
454+
@default_value.setter
455+
def default_value(self, val):
456456
self._write_u16le(_MCP23017_DEFVALA, val)
457457

458458

459459
@property
460-
def iocon(self):
460+
def io_control(self):
461461
"""The raw IOCON configuration register. Bit 1 controls interrupt
462462
polarity (1 = active-high, 0 = active-low). Bit 2 is whether irq pin
463463
is open drain (1 = open drain, 0 = push-pull). Bit 3 is unused.
@@ -468,6 +468,6 @@ def iocon(self):
468468
"""
469469
return self._read_u8(_MCP23017_IOCON)
470470

471-
@iocon.setter
472-
def iocon(self, val):
471+
@io_control.setter
472+
def io_control(self, val):
473473
self._write_u8(_MCP23017_IOCON, val)

examples/mcp230xx_leds_and_buttons_irq.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
pin.pull = Pull.UP
3434

3535
# Set up to check all the port B pins (pins 8-15) w/interrupts!
36-
mcp.gpinten = 0xFF00 # INTerrupt ENable top 8 bits
36+
mcp.interrupt_enable = 0xFF00 # INTerrupt ENable top 8 bits
3737
# If intcon is set to 0's we will get interrupts on
3838
# both button presses and button releases
39-
mcp.intcon = 0x0000 # interrupt on any change
39+
mcp.interrupt_configuration = 0x0000 # interrupt on any change
4040

4141
# Or, we can ask to be notified CONTINUOUSLY if a pin goes LOW (button press)
4242
# we won't get an IRQ pulse when the pin is HIGH!
43-
#mcp.intcon = 0xFF00 # notify pin value
44-
#mcp.defval = 0xFF00 # default value is 'high' so notify whenever 'low'
43+
#mcp.interrupt_configuration = 0xFF00 # notify pin value
44+
#mcp.default_value = 0xFF00 # default value is 'high' so notify whenever 'low'
4545

4646
# connect the IRQ B pin to D4
4747
irq_b = DigitalInOut(board.D4)

0 commit comments

Comments
 (0)