This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCA8418: In keypad matrix mode two values are returned instead of one

Part Number: TCA8418

Tool/software:

I am using Adafruit_TCA8418 library.

My configuration is as follows:

Adafruit_TCA8418 keypad;

void setup()
{
  keypad.matrix(5, 10);
  keypad.flush();
}

And my code which prints to the serial any key press or releas event.

void loop()
{
  if (keypad.available() > 0)
  {
    int k = keypad.getEvent();
    if (k & 0x80) Serial.print("PRESS\tR: ");
    else Serial.print("RELEASE\tR: ");
    k &= 0x7F;
    k--;
    Serial.print(k / 10);
    Serial.print("\tC: ");
    Serial.print(k % 10);
    Serial.println();
  }
}

All the key presses are logged properly except for two cases - buttons in matrix position: row0 col9 and row1 col9. The erroneous output is as follows:

PRESS	R: 0	C: 9
PRESS	R: 9	C: 6
RELEASE	R: 0	C: 9
RELEASE	R: 9	C: 6

PRESS	R: 1	C: 9
PRESS	R: 9	C: 7
RELEASE	R: 1	C: 9
RELEASE	R: 9	C: 7

It seems like there is some other settings than matrix mode enabled. Mayby GPI mode enabled, too? I have been checking all the registers and the settings seems to be fine.

I would appreciate any hints. Thanks in advance!