Skip to content

need to put MPR121 in Stop Mode for any register writes #11

Closed
@caternuson

Description

@caternuson

This currently only affects set_threshold since the constructor manually takes care of this. However, this should be fixed in a general way so that any future register write methods will work as expected.

mpr121_reg_write

Adafruit CircuitPython 3.0.3 on 2018-10-10; Adafruit ItsyBitsy M4 Express with samd51g19
>>> import board, busio
>>> import adafruit_mpr121
>>> i2c = busio.I2C(board.SCL, board.SDA)
>>> mpr121 = adafruit_mpr121.MPR121(i2c)
>>> buf = bytearray(1)
>>> mpr121._read_register_bytes(0x41, buf)  # read ELE0 Touch Threshold
>>> buf
bytearray(b'\x0c')
>>> mpr121.set_thresholds(0xFF, 0x00)  # try to change it to 0xFF
>>> mpr121._read_register_bytes(0x41, buf)  # read ELE0 Touch Threshold
>>> buf
bytearray(b'\x0c')
>>> mpr121._write_register_byte(0x5E, 0x00)  # manually set Stop Mode
>>> mpr121.set_thresholds(0xFF, 0x00)  # try to change it to 0xFF
>>> mpr121._write_register_byte(0x5E, 0x8F)  # manually set Run Mode
>>> mpr121._read_register_bytes(0x41, buf)  # read ELE0 Touch Threshold
>>> buf
bytearray(b'\xff')
>>>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions