52#ifndef MATRIX_KEYPAD_H
53#define MATRIX_KEYPAD_H
66#ifndef CONFIG_MATRIX_KEYPAD_NUM_ROWS
67#define CONFIG_MATRIX_KEYPAD_NUM_ROWS 2
73#ifndef CONFIG_MATRIX_KEYPAD_NUM_COLUMNS
74#define CONFIG_MATRIX_KEYPAD_NUM_COLUMNS 2
84#ifndef CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_BEGIN
85#define CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_BEGIN 0xC0
95#ifndef CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_END
96#define CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_END 0x7
102#ifndef CONFIG_MATRIX_KEYPAD_ROWS_USE_OPEN_DRAIN
103#define CONFIG_MATRIX_KEYPAD_ROWS_USE_OPEN_DRAIN 0
109#if CONFIG_MATRIX_KEYPAD_ROWS_USE_OPEN_DRAIN
110#define MATRIX_KEYPAD_ROWS_GPIO_MODE GPIO_OD_PU
112#define MATRIX_KEYPAD_ROWS_GPIO_MODE GPIO_OUT
118#define MATRIX_KEYPAD_DEBOUNCE_MASK \
119 (CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_BEGIN | CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_END)
125#if CONFIG_MATRIX_KEYPAD_NUM_COLUMNS <= 8
127#elif CONFIG_MATRIX_KEYPAD_NUM_COLUMNS <= 16
129#elif CONFIG_MATRIX_KEYPAD_NUM_COLUMNS <= 32
131#elif CONFIG_MATRIX_KEYPAD_NUM_COLUMNS <= 64
134#error Too many columns on matrix keypad.
Low-level GPIO peripheral driver interface definitions.
void(* matrix_keypad_cb_t)(void *arg, size_t row, size_t column, bool state)
Callback for key state changes.
uint8_t matrix_keypad_state_row_t
Type definition for a full row (all columns) state, variable width depending on the number of columns...
#define CONFIG_MATRIX_KEYPAD_NUM_ROWS
Maximum number of rows.
size_t matrix_keypad_scan(matrix_keypad_t *dev)
Scan through the keypad matrix.
int matrix_keypad_init(matrix_keypad_t *dev, const matrix_keypad_params_t *params, matrix_keypad_cb_t callback, void *arg)
Initialize the given device.
#define CONFIG_MATRIX_KEYPAD_NUM_COLUMNS
Maximum number of columns.
Device initialization parameters.
uint32_t row2col_delay
Delay in microseconds between configuring the row gpio and reading out the column.
Device descriptor for the driver.
matrix_keypad_cb_t callback
Callback called when a key changes state.
void * arg
callback context
const matrix_keypad_params_t * params
Device initialization parameters.