diff options
| author | Ryan <fauxpark@gmail.com> | 2022-10-15 14:33:24 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-15 14:33:24 +1100 |
| commit | f0b2bfd5ca5b416a9c7c9bef8c2850f1084bd106 (patch) | |
| tree | 2e3cc54b3fb899f05f15bf8008bcbb4816b5ffb5 /quantum/programmable_button.h | |
| parent | 19aed5e999ef177a2ff0b2b705443bde9c70588c (diff) | |
Programmable Button API refactor and improve docs (#18641)
Diffstat (limited to 'quantum/programmable_button.h')
| -rw-r--r-- | quantum/programmable_button.h | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/quantum/programmable_button.h b/quantum/programmable_button.h index e89b8b9fd6..e8c916d75c 100644 --- a/quantum/programmable_button.h +++ b/quantum/programmable_button.h | |||
| @@ -19,12 +19,73 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 19 | 19 | ||
| 20 | #include <stdint.h> | 20 | #include <stdint.h> |
| 21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
| 22 | #include "report.h" | ||
| 23 | 22 | ||
| 24 | void programmable_button_clear(void); | 23 | /** |
| 25 | void programmable_button_send(void); | 24 | * \defgroup programmable_button |
| 26 | void programmable_button_on(uint8_t index); | 25 | * |
| 27 | void programmable_button_off(uint8_t index); | 26 | * HID Programmable Buttons |
| 28 | bool programmable_button_is_on(uint8_t index); | 27 | * \{ |
| 28 | */ | ||
| 29 | |||
| 30 | /** | ||
| 31 | * \brief Clear the programmable button report. | ||
| 32 | */ | ||
| 33 | void 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 | */ | ||
| 40 | void 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 | */ | ||
| 47 | void 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 | */ | ||
| 54 | void 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 | */ | ||
| 61 | void 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 | */ | ||
| 70 | bool programmable_button_is_on(uint8_t index); | ||
| 71 | |||
| 72 | /** | ||
| 73 | * \brief Send the programmable button report to the host. | ||
| 74 | */ | ||
| 75 | void programmable_button_flush(void); | ||
| 76 | |||
| 77 | /** | ||
| 78 | * \brief Get the programmable button report. | ||
| 79 | * | ||
| 80 | * \return The bitmask of programmable button states. | ||
| 81 | */ | ||
| 29 | uint32_t programmable_button_get_report(void); | 82 | uint32_t programmable_button_get_report(void); |
| 30 | void programmable_button_set_report(uint32_t report); | 83 | |
| 84 | /** | ||
| 85 | * \brief Set the programmable button report. | ||
| 86 | * | ||
| 87 | * \param report A bitmask of programmable button states. | ||
| 88 | */ | ||
| 89 | void programmable_button_set_report(uint32_t report); | ||
| 90 | |||
| 91 | /** \} */ | ||
