summaryrefslogtreecommitdiff
path: root/zephyr/include/emul/emul_kb_raw.h
blob: 1660ccefd48d442ca64aee6a5435f6e75c872c44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Copyright 2022 The ChromiumOS Authors.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <stdint.h>

/**
 * @file
 *
 * @brief Backend API for kb raw emulator
 */

#ifndef __EMUL_KB_RAW_H
#define __EMUL_KB_RAW_H

struct device;

/**
 * @brief Raw keyboard emulator backend API
 * @defgroup kb_raw_emul raw keyboard emulator
 * @{
 *
 * The raw keyboard emulator allows for emulating a physical keyboard.
 */

/**
 * @brief Sets or clears a key.
 *
 * @param dev Pointer to kb_raw emulator device.
 * @param row The keyboard scan row.
 * @param col The keyboard scan column.
 * @param pressed If non-zero, set that key row/col as pressed, if zero it is
 *                unpressed.
 * @return 0 for success, -EINVAL for an invalid param.
 */
int emul_kb_raw_set_kbstate(const struct device *dev, uint8_t row, uint8_t col,
			    int pressed);

/**
 * @brief Resets the keyboard to its initial state.
 *
 * @param dev Pointer to kb_raw emulator device.
 */
void emul_kb_raw_reset(const struct device *dev);

/**
 * @}
 */

#endif /* __EMUL_KB_RAW_H */