hi,
I've bought a 12 key keypad which has an mpr121 chip built in.
How do i read registers 0x00 and 0x01?
How do i signal that the rq line has been read and can reset to high/floating?
i've got this far with the dummy method `keypad.rq_high
this is my python
import RPi.GPIO as GPIO
import posix
from fcntl import ioctl
import time
IOCTL_I2C_SLAVE = 0x0703
class KEYPAD:
def __init__(self, i2c, rq_pin, address = 0x5a):
self._fd = posix.open('/dev/i2c-%d' % i2c, posix.O_RDWR)
ioctl(self._fd, IOCTL_I2C_SLAVE, address)
self._rq_pin=rq_pin
GPIO.setup(self._rq_pin, GPIO.IN, GPIO.PUD_UP)
self.switch_on()
def _del_(self):
posix.close(self._fd)
def switch_on(self):
posix.write(self._fd, b'\x5e\x01')
def rq_high(self):
return GPIO.input(self._rq_pin) == GPIO.HIGH
GPIO.setmode(GPIO.BCM)
keypad=KEYPAD(1, 23)
try:
while True:
if keypad.rq_high():
print("high", end = '\r')
else:
print("low ", end = '\r')
time.sleep(0.01)
except KeyboardInterrupt:
pass
print("")
GPIO.cleanup()
I only have switched on a few keys but realise i need to write something different to register 0x5e (probably 0x3f)
Hi Phil,
As you can see in the PCN16772, the MPR121 is a discontinued product and NXP no longer supports it.
However, attached you can find design guidelines including the sample code which might be helpful for your evaluation.
Best regards,
Tomas