PoC.io.pmod.KYPD

This module drives a 4-bit one-cold encoded column vector to read back a 4-bit rows vector. By scanning column-by-column it’s possible to extract the current button state of the whole keypad. This wrapper converts the high-active signals from PoC.io.KeypadScanner to low-active signals for the pmod. An additional debounce circuit filters the button signals. The scan frequency and bounce time can be configured.

Entity Declaration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
entity pmod_KYPD is
  generic (
    CLOCK_FREQ    : FREQ        := 100 MHz;
    SCAN_FREQ     : FREQ        := 1 kHz;
    BOUNCE_TIME   : time        := 10 ms
  );
  port (
    Clock         : in  std_logic;
    Reset         : in  std_logic;
    -- Matrix interface
    Keys          : out T_PMOD_KYPD_KEYPAD;
    -- KeyPad interface
    Columns_n     : out std_logic_vector(3 downto 0);
    Rows_n        : in  std_logic_vector(3 downto 0)
  );
end entity;