plover_hid.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright 2021 dnaq
  2. *
  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. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. /**
  20. * \enum plover_hid_button_t
  21. *
  22. * An enumeration of the possible Plover HID bit indexes.
  23. *
  24. * \note Index order is protocol-mandated and must match plover-machine-hid STENO_KEY_CHART position.
  25. */
  26. typedef enum {
  27. PLV_BTN_S1,
  28. PLV_BTN_TL,
  29. PLV_BTN_KL,
  30. PLV_BTN_PL,
  31. PLV_BTN_WL,
  32. PLV_BTN_HL,
  33. PLV_BTN_RL,
  34. PLV_BTN_A,
  35. PLV_BTN_O,
  36. PLV_BTN_ST1,
  37. PLV_BTN_E,
  38. PLV_BTN_U,
  39. PLV_BTN_FR,
  40. PLV_BTN_RR,
  41. PLV_BTN_PR,
  42. PLV_BTN_BR,
  43. PLV_BTN_LR,
  44. PLV_BTN_GR,
  45. PLV_BTN_TR,
  46. PLV_BTN_SR,
  47. PLV_BTN_DR,
  48. PLV_BTN_ZR,
  49. PLV_BTN_N1,
  50. PLV_BTN_S2,
  51. PLV_BTN_ST2,
  52. PLV_BTN_ST3,
  53. PLV_BTN_ST4,
  54. PLV_BTN_N2,
  55. PLV_BTN_N3,
  56. PLV_BTN_N4,
  57. PLV_BTN_N5,
  58. PLV_BTN_N6,
  59. PLV_BTN_N7,
  60. PLV_BTN_N8,
  61. PLV_BTN_N9,
  62. PLV_BTN_NA,
  63. PLV_BTN_NB,
  64. PLV_BTN_NC,
  65. PLV_BTN_X1,
  66. PLV_BTN_X2,
  67. PLV_BTN_X3,
  68. PLV_BTN_X4,
  69. PLV_BTN_X5,
  70. PLV_BTN_X6,
  71. PLV_BTN_X7,
  72. PLV_BTN_X8,
  73. PLV_BTN_X9,
  74. PLV_BTN_X10,
  75. PLV_BTN_X11,
  76. PLV_BTN_X12,
  77. PLV_BTN_X13,
  78. PLV_BTN_X14,
  79. PLV_BTN_X15,
  80. PLV_BTN_X16,
  81. PLV_BTN_X17,
  82. PLV_BTN_X18,
  83. PLV_BTN_X19,
  84. PLV_BTN_X20,
  85. PLV_BTN_X21,
  86. PLV_BTN_X22,
  87. PLV_BTN_X23,
  88. PLV_BTN_X24,
  89. PLV_BTN_X25,
  90. PLV_BTN_X26,
  91. PLV_BTN_COUNT, // Number of available buttons (always leave at the end)
  92. } plover_hid_button_t;
  93. void plover_hid_update(uint8_t button, bool pressed);
  94. void plover_hid_task(void);