Loading...
Searching...
No Matches
matrix_keypad.h File Reference

Interface definition for the matrix keypad. More...

Detailed Description

Interface definition for the matrix keypad.

Author
Koen Zandberg koen@.nosp@m.berg.nosp@m.zand..nosp@m.net

Definition in file matrix_keypad.h.

#include <stdint.h>
#include <stdbool.h>
#include "periph/gpio.h"
+ Include dependency graph for matrix_keypad.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  matrix_keypad_params_t
 Device initialization parameters. More...
 
struct  matrix_keypad_t
 Device descriptor for the driver. More...
 

Macros

#define CONFIG_MATRIX_KEYPAD_NUM_ROWS   2
 Maximum number of rows.
 
#define CONFIG_MATRIX_KEYPAD_NUM_COLUMNS   2
 Maximum number of columns.
 
#define CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_BEGIN   0xC0
 Debounce pattern high to low bits.
 
#define CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_END   0x7
 Debounce pattern low to high bits.
 
#define CONFIG_MATRIX_KEYPAD_ROWS_USE_OPEN_DRAIN   0
 Use open drain GPIO mode.
 
#define MATRIX_KEYPAD_ROWS_GPIO_MODE   GPIO_OUT
 GPIO mode used for the row GPIOs.
 
#define MATRIX_KEYPAD_DEBOUNCE_MASK    (CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_BEGIN | CONFIG_MATRIX_KEYPAD_DEBOUNCE_PATTERN_END)
 Debounce pattern mask.
 

Typedefs

typedef uint8_t matrix_keypad_state_row_t
 Type definition for a full row (all columns) state, variable width depending on the number of columns.
 
typedef void(* matrix_keypad_cb_t) (void *arg, size_t row, size_t column, bool state)
 Callback for key state changes.
 

Functions

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.
 
size_t matrix_keypad_scan (matrix_keypad_t *dev)
 Scan through the keypad matrix.