PoC.io.KeyPadScanner
This module drives a one-hot encoded column vector to read back a rows vector. By scanning column-by-column it’s possible to extract the current button state of the whole keypad. The scanner uses high-active logic. The keypad size and scan frequency can be configured. The outputed signal matrix is not debounced.
Entity Declaration:
1 generic (
2 CLOCK_FREQ : FREQ := 100 MHz;
3 SCAN_FREQ : FREQ := 1 kHz;
4 ROWS : positive := 4;
5 COLUMNS : positive := 4;
6 ADD_INPUT_SYNCHRONIZERS : boolean := TRUE
7 );
8 port (
9 Clock : in std_logic;
10 Reset : in std_logic;
11 -- Matrix interface
12 KeyPadMatrix : out T_SLM(COLUMNS - 1 downto 0, ROWS - 1 downto 0);
13 -- KeyPad interface
14 ColumnVector : out std_logic_vector(COLUMNS - 1 downto 0);
15 RowVector : in std_logic_vector(ROWS - 1 downto 0)
16 );
17end entity;