File syn_keypad.c¶
FileList > input > syn_keypad.c
Go to the source code of this file
Non-blocking Matrix Keypad Scanner (3x4, 4x4, etc.).
#include "syn_keypad.h"#include "../util/syn_assert.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| bool | syn_keypad_get_key (const SYN_Keypad * kp, char * out_key) Get the currently pressed key character. |
| SYN_Status | syn_keypad_init (SYN_Keypad * kp, const SYN_GPIO_Pin * rows, uint8_t num_rows, const SYN_GPIO_Pin * cols, uint8_t num_cols, const char * keymap) Initialize a Matrix Keypad instance. |
| void | syn_keypad_scan (SYN_Keypad * kp) Perform a non-blocking matrix scan. |
| void | syn_keypad_set_callback (SYN_Keypad * kp, SYN_KeypadCallback callback, void * user_ctx) Set event callback for key press and release events. |
Public Functions Documentation¶
function syn_keypad_get_key¶
Get the currently pressed key character.
Parameters:
kpKeypad context.out_key[out] Key character (if pressed).
Returns:
True if a key is currently held pressed.
function syn_keypad_init¶
Initialize a Matrix Keypad instance.
SYN_Status syn_keypad_init (
SYN_Keypad * kp,
const SYN_GPIO_Pin * rows,
uint8_t num_rows,
const SYN_GPIO_Pin * cols,
uint8_t num_cols,
const char * keymap
)
Configures row pins as outputs and col pins as inputs with pull-down/up.
Parameters:
kpKeypad context.rowsArray of row GPIO pins.num_rowsNumber of row pins (1-8).colsArray of column GPIO pins.num_colsNumber of column pins (1-8).keymapString keymap of length (num_rows * num_cols).
Returns:
SYN_OK on success.
function syn_keypad_scan¶
Perform a non-blocking matrix scan.
Parameters:
kpKeypad context.
function syn_keypad_set_callback¶
Set event callback for key press and release events.
Parameters:
kpKeypad context.callbackEvent handler callback function.user_ctxUser context pointer.
The documentation for this class was generated from the following file src/syntropic/input/syn_keypad.c