Then tried the code and it seemed to work exactly as wanted. Emboldened by the success I added two more traces to support multi-key (highlighted in Red). That also worked perfectly. Interestingly, the pressed keys wont appear even if new key has been pressed. Only after the second key is released the first key is shown as pressed.
After going through the spec, I realized it can even be used for interrupts. The spec says the keyboard can generate interrupt every 32ms min. It generates the long low to indicate a button press or release event. It is upto the microcontroller to read the data. It does not state what happens when data read takes a long time from interrupt and the key change happens, can it cause interrupt while reading or right after reading. If the interrupt happens after read but before the interrupt handler is enabled, a key press may be lost. So, ideally the keyboard interrupt should be serviced well within 32ms, if you don't want to miss any key press. Depending on the exact behavior of the chip, the current code has a potential to have missed data, if the interrupt service routing is not called within 32ms of the key being pressed.
Also, the code takes a bit of time to read from the keyboard. So decided to keep the interrupt service separate from interrupt handler. So the caller has to keep calling HasEvent and if it has Event, then it may call GetButtonEvent to get the event. The event will be triggered for Press and Release and the caller has to find out how long the button was pressed.
On the other hand, calling GetButtonStatus will return the buttons pressed currently.
In short, here is the instruction to get the keyboard working with Arduino
1. Add a trace between 3&4 in header P1 (highlighted with yellow). This is the must if you want to use all 16 buttons. Refer to the picture above.
2. Add a trace between 1&2 in header P1 and 7&8 in header P2 (highlighted in Red). This is optional and needed only if you want to enable multi-key press at the same time. Refer to the picture above.
3. Connect the VCC & GND from the keyboard to corresponding pin in arduino.
4. Connect SCL from the keyboard to pin 7 in arduino. (If you connect to anything else, need to update the code with the right pin number. Find the line containing statement TTP16Button.Configure and replace 7 with what ever your pin number is used by you.)
5. Connect SDO from the keyboard to pin 2 in arduino. (Connecting to 2 or 3 will support interrupt based event for the keyboard and others has to be constantly polled. Find and replace line containing TTP16Button.Configure with SDO number.)