Line data Source code
1 1 : /*
2 : * Copyright 2024 Google LLC
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : /**
8 : * @file
9 : * @ingroup input_keymap
10 : * @brief Header file for keymap utilities.
11 : */
12 :
13 : #ifndef ZEPHYR_INCLUDE_INPUT_INPUT_KEYMAP_H_
14 : #define ZEPHYR_INCLUDE_INPUT_INPUT_KEYMAP_H_
15 :
16 : /**
17 : * @defgroup input_keymap Keymap utilities
18 : * @ingroup input_interface
19 : * @{
20 : */
21 :
22 : /**
23 : * @brief Extract the row index from a keymap entry.
24 : *
25 : * This macro extracts the row index from a 32-bit keymap entry. The row index
26 : * is stored in bits 24-31 of the keymap entry.
27 : *
28 : * @param keymap_entry The 32-bit keymap entry value.
29 : * @return The row index (0-255) extracted from the keymap entry.
30 : */
31 1 : #define MATRIX_ROW(keymap_entry) (((keymap_entry) >> 24) & 0xff)
32 :
33 : /**
34 : * @brief Extract the column index from a keymap entry.
35 : *
36 : * This macro extracts the column index from a 32-bit keymap entry. The column
37 : * index is stored in bits 16-23 of the keymap entry.
38 : *
39 : * @param keymap_entry The 32-bit keymap entry value.
40 : * @return The column index (0-255) extracted from the keymap entry.
41 : */
42 1 : #define MATRIX_COL(keymap_entry) (((keymap_entry) >> 16) & 0xff)
43 :
44 : /** @} */
45 :
46 : #endif /* ZEPHYR_INCLUDE_INPUT_INPUT_KEYMAP_H_ */
|