Keyboard firmwares for Atmel AVR and Cortex-M
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.

host.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. Copyright 2011 Jun Wako <[email protected]>
  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. #ifndef HOST_H
  15. #define HOST_H
  16. #include <stdint.h>
  17. #include <stdbool.h>
  18. #include "report.h"
  19. #include "host_driver.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #ifdef NKRO_ENABLE
  24. extern bool keyboard_nkro;
  25. #endif
  26. /* report */
  27. extern report_keyboard_t *keyboard_report;
  28. extern report_mouse_t mouse_report;
  29. /* host driver */
  30. void host_set_driver(host_driver_t *driver);
  31. host_driver_t *host_get_driver(void);
  32. /* host driver interface */
  33. uint8_t host_keyboard_leds(void);
  34. void host_keyboard_send(report_keyboard_t *report);
  35. void host_mouse_send(report_mouse_t *report);
  36. void host_system_send(uint16_t data);
  37. void host_consumer_send(uint16_t data);
  38. /* keyboard report utils */
  39. void host_add_key(uint8_t key);
  40. void host_del_key(uint8_t key);
  41. void host_clear_keys(void);
  42. void host_add_mod_bit(uint8_t mod);
  43. void host_del_mod_bit(uint8_t mod);
  44. void host_set_mods(uint8_t mods);
  45. void host_clear_mods(void);
  46. uint8_t host_has_anykey(void);
  47. uint8_t host_has_anymod(void);
  48. uint8_t host_get_first_key(void);
  49. void host_send_keyboard_report(void);
  50. /* mouse report utils */
  51. uint8_t host_mouse_in_use(void);
  52. uint16_t host_last_sysytem_report(void);
  53. uint16_t host_last_consumer_report(void);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif