You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.2 KiB

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