Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
Keyboard Matrix API. More...
Data Structures | |
struct | input_kbd_matrix_api |
Keyboard matrix internal APIs. More... | |
struct | input_kbd_matrix_common_config |
Common keyboard matrix config. More... | |
struct | input_kbd_matrix_common_data |
Common keyboard matrix data. More... | |
Macros | |
#define | INPUT_KBD_MATRIX_COLUMN_DRIVE_NONE -1 |
Special drive_column argument for not driving any column. | |
#define | INPUT_KBD_MATRIX_COLUMN_DRIVE_ALL -2 |
Special drive_column argument for driving all the columns. | |
#define | INPUT_KBD_MATRIX_SCAN_OCURRENCES 30U |
Number of tracked scan cycles. | |
#define | PRIkbdrow "02" PRIx8 |
#define | INPUT_KBD_ACTUAL_KEY_MASK_CONST |
#define | INPUT_KBD_MATRIX_ROW_BITS NUM_BITS(kbd_row_t) |
Maximum number of rows. | |
#define | INPUT_KBD_MATRIX_DATA_NAME(node_id, name) |
#define | INPUT_KBD_MATRIX_DT_DEFINE_ROW_COL(node_id, _row_size, _col_size) |
Defines the common keyboard matrix support data from devicetree, specify row and col count. | |
#define | INPUT_KBD_MATRIX_DT_DEFINE(node_id) |
Defines the common keyboard matrix support data from devicetree. | |
#define | INPUT_KBD_MATRIX_DT_INST_DEFINE_ROW_COL(inst, row_size, col_size) INPUT_KBD_MATRIX_DT_DEFINE_ROW_COL(DT_DRV_INST(inst), row_size, col_size) |
Defines the common keyboard matrix support data from devicetree instance, specify row and col count. | |
#define | INPUT_KBD_MATRIX_DT_INST_DEFINE(inst) INPUT_KBD_MATRIX_DT_DEFINE(DT_DRV_INST(inst)) |
Defines the common keyboard matrix support data from devicetree instance. | |
#define | INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT_ROW_COL(node_id, _api, _row_size, _col_size) |
Initialize common keyboard matrix config from devicetree, specify row and col count. | |
#define | INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT(node_id, api) |
Initialize common keyboard matrix config from devicetree. | |
#define | INPUT_KBD_MATRIX_DT_INST_COMMON_CONFIG_INIT_ROW_COL(inst, api, row_size, col_size) INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT_ROW_COL(DT_DRV_INST(inst), api, row_size, col_size) |
Initialize common keyboard matrix config from devicetree instance, specify row and col count. | |
#define | INPUT_KBD_MATRIX_DT_INST_COMMON_CONFIG_INIT(inst, api) INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT(DT_DRV_INST(inst), api) |
Initialize common keyboard matrix config from devicetree instance. | |
#define | INPUT_KBD_STRUCT_CHECK(config, data) |
Validate the offset of the common data structures. | |
Typedefs | |
typedef uint8_t | kbd_row_t |
Row entry data type. | |
Functions | |
int | input_kbd_matrix_actual_key_mask_set (const struct device *dev, uint8_t row, uint8_t col, bool enabled) |
Enables or disables a specific row, column combination in the actual key mask. | |
void | input_kbd_matrix_poll_start (const struct device *dev) |
Start scanning the keyboard matrix. | |
void | input_kbd_matrix_drive_column_hook (const struct device *dev, int col) |
Drive column hook. | |
int | input_kbd_matrix_common_init (const struct device *dev) |
Common function to initialize a keyboard matrix device at init time. | |
Keyboard Matrix API.
#define INPUT_KBD_ACTUAL_KEY_MASK_CONST |
#include <zephyr/input/input_kbd_matrix.h>
#define INPUT_KBD_MATRIX_COLUMN_DRIVE_ALL -2 |
#include <zephyr/input/input_kbd_matrix.h>
Special drive_column argument for driving all the columns.
#define INPUT_KBD_MATRIX_COLUMN_DRIVE_NONE -1 |
#include <zephyr/input/input_kbd_matrix.h>
Special drive_column argument for not driving any column.
#define INPUT_KBD_MATRIX_DATA_NAME | ( | node_id, | |
name | |||
) |
#include <zephyr/input/input_kbd_matrix.h>
#define INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT | ( | node_id, | |
api | |||
) |
#include <zephyr/input/input_kbd_matrix.h>
Initialize common keyboard matrix config from devicetree.
node_id | The devicetree node identifier. |
api | Pointer to a input_kbd_matrix_api structure. |
#define INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT_ROW_COL | ( | node_id, | |
_api, | |||
_row_size, | |||
_col_size | |||
) |
#include <zephyr/input/input_kbd_matrix.h>
Initialize common keyboard matrix config from devicetree, specify row and col count.
node_id | The devicetree node identifier. |
_api | Pointer to a input_kbd_matrix_api structure. |
_row_size | The matrix row count. |
_col_size | The matrix column count. |
#define INPUT_KBD_MATRIX_DT_DEFINE | ( | node_id | ) |
#include <zephyr/input/input_kbd_matrix.h>
Defines the common keyboard matrix support data from devicetree.
#define INPUT_KBD_MATRIX_DT_DEFINE_ROW_COL | ( | node_id, | |
_row_size, | |||
_col_size | |||
) |
#include <zephyr/input/input_kbd_matrix.h>
Defines the common keyboard matrix support data from devicetree, specify row and col count.
#define INPUT_KBD_MATRIX_DT_INST_COMMON_CONFIG_INIT | ( | inst, | |
api | |||
) | INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT(DT_DRV_INST(inst), api) |
#include <zephyr/input/input_kbd_matrix.h>
Initialize common keyboard matrix config from devicetree instance.
inst | Instance. |
api | Pointer to a input_kbd_matrix_api structure. |
#define INPUT_KBD_MATRIX_DT_INST_COMMON_CONFIG_INIT_ROW_COL | ( | inst, | |
api, | |||
row_size, | |||
col_size | |||
) | INPUT_KBD_MATRIX_DT_COMMON_CONFIG_INIT_ROW_COL(DT_DRV_INST(inst), api, row_size, col_size) |
#include <zephyr/input/input_kbd_matrix.h>
Initialize common keyboard matrix config from devicetree instance, specify row and col count.
inst | Instance. |
api | Pointer to a input_kbd_matrix_api structure. |
row_size | The matrix row count. |
col_size | The matrix column count. |
#define INPUT_KBD_MATRIX_DT_INST_DEFINE | ( | inst | ) | INPUT_KBD_MATRIX_DT_DEFINE(DT_DRV_INST(inst)) |
#include <zephyr/input/input_kbd_matrix.h>
Defines the common keyboard matrix support data from devicetree instance.
inst | Instance. |
#define INPUT_KBD_MATRIX_DT_INST_DEFINE_ROW_COL | ( | inst, | |
row_size, | |||
col_size | |||
) | INPUT_KBD_MATRIX_DT_DEFINE_ROW_COL(DT_DRV_INST(inst), row_size, col_size) |
#include <zephyr/input/input_kbd_matrix.h>
Defines the common keyboard matrix support data from devicetree instance, specify row and col count.
inst | Instance. |
row_size | The matrix row count. |
col_size | The matrix column count. |
#include <zephyr/input/input_kbd_matrix.h>
Maximum number of rows.
#define INPUT_KBD_MATRIX_SCAN_OCURRENCES 30U |
#include <zephyr/input/input_kbd_matrix.h>
Number of tracked scan cycles.
#define INPUT_KBD_STRUCT_CHECK | ( | config, | |
data | |||
) |
#include <zephyr/input/input_kbd_matrix.h>
Validate the offset of the common data structures.
config | Name of the config structure. |
data | Name of the data structure. |
#define PRIkbdrow "02" PRIx8 |
#include <zephyr/input/input_kbd_matrix.h>
#include <zephyr/input/input_kbd_matrix.h>
Row entry data type.
int input_kbd_matrix_actual_key_mask_set | ( | const struct device * | dev, |
uint8_t | row, | ||
uint8_t | col, | ||
bool | enabled | ||
) |
#include <zephyr/input/input_kbd_matrix.h>
Enables or disables a specific row, column combination in the actual key mask.
This allows enabling or disabling spcific row, column combination in the actual key mask in runtime. It can be useful if some of the keys are not present in some configuration, and the specific configuration is determined in runtime. Requires CONFIG_INPUT_KBD_ACTUAL_KEY_MASK_DYNAMIC
to be enabled.
dev | Pointer to the keyboard matrix device. |
row | The matrix row to enable or disable. |
col | The matrix column to enable or disable. |
enabled | Whether the specificied row, col has to be enabled or disabled. |
0 | If the change is successful. |
-errno | Negative errno if row or col are out of range for the device. |
int input_kbd_matrix_common_init | ( | const struct device * | dev | ) |
#include <zephyr/input/input_kbd_matrix.h>
Common function to initialize a keyboard matrix device at init time.
This function must be called at the end of the device init function.
dev | Keyboard matrix device instance. |
0 | If initialized successfully. |
-errno | Negative errno in case of failure. |
void input_kbd_matrix_drive_column_hook | ( | const struct device * | dev, |
int | col | ||
) |
#include <zephyr/input/input_kbd_matrix.h>
Drive column hook.
This can be implemented by the application to handle column selection quirks. Called after the driver specific drive_column function. Requires CONFIG_INPUT_KBD_DRIVE_COLUMN_HOOK
to be enabled.
dev | Keyboard matrix device instance. |
col | The column to drive, or INPUT_KBD_MATRIX_COLUMN_DRIVE_NONE or INPUT_KBD_MATRIX_COLUMN_DRIVE_ALL. |
void input_kbd_matrix_poll_start | ( | const struct device * | dev | ) |
#include <zephyr/input/input_kbd_matrix.h>
Start scanning the keyboard matrix.
Starts the keyboard matrix scanning cycle, this should be called in reaction of a press event, after the device has been put in detect mode.
dev | Keyboard matrix device instance. |