-
Notifications
You must be signed in to change notification settings - Fork 963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MPR121 Touch IC Based Keypad Input Module #5103
Conversation
|
Hi and welcome! Thanks for proving a great write-up. I see the conflict with the MLX90614. Question - is there a register in the keyboard we can query that reliably returns something we can use to identify it? "Chip ID"/"model number/ etc. That way we can better disambiguate whether we have the sensor or the keyboard at that address. |
And then write a special case scan, instead of using the simple scan macro, i.e instead of disambiguating in configuration.h, doing it in scani2c/scani2cwire? |
Ayesir! |
Couldn't see anything obvious in the data sheet. The 90614 appears to have an ID Number register so maybe we can search for that instead and make the keyboards the default :) |
By the way, are you familiar with the trunk linting tool? We use it to keep forgetting consistent and it looks like the files changed here need to be run through it. |
I saw that. I'll lint it and give the detecttion approach a go. Cheers. |
This will take some more thought... the MLX90614 ir temp sensor datasheet doesn't document the canonical id value, and it may be more a serial number than product id... this reference treats it as a 64 bit value... https://github.com/jfitter/MLX90614/blob/master/src%2FMLX90614.cpp |
I think the most effective solution will be relying on the initial startup state of the MPR121: Note: After completing power on reset (POR) or soft reset by command, MPR121 all registers are in default reset initial value (see Table 1). All the registers are cleared, except AFE Configuration Registers 0x5C (Default 0x10) and 0x5D (Default 0x24). |
Here's how the dual addresses are done for the INA3221: Line 127 in 2ba72c1
is the same as Line 145 in 2ba72c1
So: firmware/src/detect/ScanI2CTwoWire.cpp Lines 304 to 313 in 2ba72c1
|
I'll need to get someone with the IR temp sensor to test the detection when it's working, but I'll use the 0x5C (Default 0x10) value as I maintain that value in the setup. The other default value is changed to 0x20 during initialisation of the ic, so would be different on a warm reboot. |
Okay, looks like a more complex soft reset process would be needed before reading from the MPR121, Instead looking to read the bus address register 0x0E from the MLX90614, which will contain 0x5A. |
Mpr121 v3 alt detection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most excellent work
Garn |
Implements an input driver utilising the MPR121 Touch IC and is compatible with common MPR121 keypad PCB's. - Implements a "candybar" phone style 12-key keypad - multiple taps to rotate through the character set - longpress for navigation keys - keymap to allow arbitrary routing of MPR121 pin to button configuration - extendable to other key functions - Integrates with the existing kbI2cBase implementation - Works with CannedMessageModule Freetext mode - Can be used with common MPR121 boards, such as https://www.amazon.com/MPR121-Capacitive-Keyboard-Buttons-Sensitive/dp/B083R89CHB/ref=sr_1_6 - Of use for PCB based radios, where some form of low surface area low component freetext input is required, but also without consuming too many IO pins. - Tested on a T3S3 connected to Wire1 (Second) interface. - Demonstration of functionality: https://youtu.be/UI6QP6nGvhY
For an upcoming meshtastic project, this implements an input driver utilising the MPR121 Touch IC and is compatible with common MPR121 keypad PCB's.
For testing, uncommented the MRP121_USE_5A define in configuration.h, and add #define CANNED_MESSAGE_MODULE_ENABLE 1 to variant.h. Again, I expect that this is not an ideal approach and looking for input as to the best way to move forward.