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.

About TCA8418

Other Parts Discussed in Thread: TCA8418

Dear Sirs

I use KEY pad for TCA8418.

Could user press the key twice (continue), and the first press is neglected and the second press is workable?

How could I do?

Thank you~

BRS

Nat

  • Hello Nat,

    Thanks for the question.

    It sounds like you're asking if you can have the TCA8418 only report the 2nd key press of a double press.

    This can be done, but must be done in your driver software. The TCA8418 will report all keys that are part of the KP array (or GPIs added to the FIFO) pressed and released.

    I think you may find an issue with determining what is a double press vs single press without a large amount of latency.

    Think of this situation:
    The user presses key 1. To your driver, you don't know if this is the beginning of a double press, or if the user will hit another key. So you must wait until you can determine this. This means that the driver must not perform any action on key 1 until we can determine what the 2nd key is. So we wait. about 0.5 seconds later, the user presses key 3 and we can determine now that key 1 is not part of a double press and can perform the action of key 1 (perhaps to type the number '1'). This would result in a delay from the keypress to the action being taken to take 0.5s (or however long the user takes to press the next button).
  • Dear Sirs

    Does the Lock/Unlock function achieve my goal?

    The following function:
    9.2.1.1 Keypad Lock/Unlock
    This user can lock the keypad through the lock/unlock feature in this device. Once the keypad is locked, it can
    prevent the generation of key event interrupts and recorded key events.

    BRS
    Nat
  • Nat,

    The Lock and unlock function might achieve your goal if you're looking for only a certain combination of keys to unlock the keypad to generate interrupts.

    Once the keypad is locked, no interrupts will be generated until both of the unlock keys are pressed. At which point, any key presses or releases will generate interrupts like normal.

    In your first message, it looked to me that you were wanting some way to ignore the first press of every double press? If you are trying to only allow a specific double press to unlock the keyboard and let regular key interrupts be generated, then the lock/unlock feature is exactly what you're looking for.
  • Dear Sirs
    Thank you for your reply.
    How could I set TCA8418 (Locked/Unlocked)?

    1) Initial setting
    2) Locked ENABLE
    3) Locked Disable , Unlocked ENABLE

    BRS
    Nat
  • Hello Nat,

    I'll be happy to help you with this.

    1) The initial setting of the TCA8418[E] is that the lock feature is disabled. This is seen in the appropriate registers for Lock/unlock control, which are listed below:
    Register 0x03 (KEY_LCK_EC) - Used for checking if the keypad is locked or to turn on the keypad lock.
    Register 0x0E (KP_LCK_TMR) - Used to setup the timeout (maximum allowed time) between the two unlock keys to unlock the keypad. This is basically setting a requirement of how fast the keys must be pressed.
    Registers 0x0F-0x10 (Unlock1/2) - Used to inputting the key presses you wish to unlock the keypad.

    2) To enable the keypad lock, you must do the following:
    a) Determine which keys you would like to have unlock the keypad (EX: You can have a single press from key 1 unlock a locked keypad, or you can have any double key combination such as key 22 then key 13, or even a double tap on a key).
    To set these keys, you must write the key value to the unlock registers (0x0F and 0x10). If you wish to only require one key press to unlock the keypad, then make sure that unlock2 (0x10) is set to 0x00. Otherwise, 0x0F is the first key that must be pressed, and 0x10 is the second key that must be pressed.

    b) You then need to choose your maximum amount of time allowed between the key presses. This value is in bits [2:0] of the KP_LCK_TMR register in units of seconds. Most people will set this to decimal 7 to allow the maximum 7 seconds. Bits [7:3] are used for a backlight interrupt timer. Best way I can describe this is the following: Imagine a phone with a keypad. The keypad is locked, and when the user presses a button on the keypad, you wish to have the backlight turn on, but you don't want to receive interrupts for the key presses. This setting lets you do that, and it sets the time between interrupts for this purpose. For most people, this is not necessary and they set it to 0 to disable it. I would advise the same for a basic configuration. So write 0x07 to register 0x0E.

    c) Once you configure your unlock keys and your timers, you can enable the keypad lock by writing to bit 6 in register 0x03 (KEY_LCK_EC). Since all other bits in this register are read only, it does not matter what you send, so long as you make sure bit 6 is a 1. So you can write 0xFF to 0x03 to enable the keypad lock.
    To check if the keypad is locked, you read bits [5:4], and if both registers are 1, then the keypad is locked. If both registers are 0, then the keypad is unlocked. You can re-enable the lock by writing a 1 to bit 6 again, or disable the lock by writing a 0 to bit 6.