keyboard stuff
1/*
2Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include <stdint.h>
21#include <stdbool.h>
22
23/**
24 * \file
25 *
26 * \defgroup programmable_button HID Programmable Buttons
27 * \{
28 */
29
30/**
31 * \brief Clear the programmable button report.
32 */
33void programmable_button_clear(void);
34
35/**
36 * \brief Set the state of a button.
37 *
38 * \param index The index of the button to press, from 0 to 31.
39 */
40void programmable_button_add(uint8_t index);
41
42/**
43 * \brief Reset the state of a button.
44 *
45 * \param index The index of the button to release, from 0 to 31.
46 */
47void programmable_button_remove(uint8_t index);
48
49/**
50 * \brief Set the state of a button, and flush the report.
51 *
52 * \param index The index of the button to press, from 0 to 31.
53 */
54void programmable_button_register(uint8_t index);
55
56/**
57 * \brief Reset the state of a button, and flush the report.
58 *
59 * \param index The index of the button to release, from 0 to 31.
60 */
61void programmable_button_unregister(uint8_t index);
62
63/**
64 * \brief Get the state of a button.
65 *
66 * \param index The index of the button to check, from 0 to 31.
67 *
68 * \return `true` if the button is pressed.
69 */
70bool programmable_button_is_on(uint8_t index);
71
72/**
73 * \brief Send the programmable button report to the host.
74 */
75void programmable_button_flush(void);
76
77/**
78 * \brief Get the programmable button report.
79 *
80 * \return The bitmask of programmable button states.
81 */
82uint32_t programmable_button_get_report(void);
83
84/**
85 * \brief Set the programmable button report.
86 *
87 * \param report A bitmask of programmable button states.
88 */
89void programmable_button_set_report(uint32_t report);
90
91/** \} */