usb_main.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * (c) 2015 flabberast <s3+flabbergast@sdfeu.org>
  3. *
  4. * Based on the following work:
  5. * - Guillaume Duc's raw hid example (MIT License)
  6. * https://github.com/guiduc/usb-hid-chibios-example
  7. * - PJRC Teensy examples (MIT License)
  8. * https://www.pjrc.com/teensy/usb_keyboard.html
  9. * - hasu's TMK keyboard code (GPL v2 and some code Modified BSD)
  10. * https://github.com/tmk/tmk_keyboard/
  11. * - ChibiOS demo code (Apache 2.0 License)
  12. * http://www.chibios.org
  13. *
  14. * Since some GPL'd code is used, this work is licensed under
  15. * GPL v2 or later.
  16. */
  17. #ifndef _USB_MAIN_H_
  18. #define _USB_MAIN_H_
  19. // TESTING
  20. // extern uint8_t blinkLed;
  21. #include "ch.h"
  22. #include "hal.h"
  23. /* -------------------------
  24. * General USB driver header
  25. * -------------------------
  26. */
  27. /* The USB driver to use */
  28. #define USB_DRIVER USBD1
  29. /* Initialize the USB driver and bus */
  30. void init_usb_driver(USBDriver *usbp);
  31. /* ---------------
  32. * Keyboard header
  33. * ---------------
  34. */
  35. /* extern report_keyboard_t keyboard_report_sent; */
  36. /* keyboard IN request callback handler */
  37. void kbd_in_cb(USBDriver *usbp, usbep_t ep);
  38. /* start-of-frame handler */
  39. void kbd_sof_cb(USBDriver *usbp);
  40. #ifdef NKRO_ENABLE
  41. /* nkro IN callback hander */
  42. void nkro_in_cb(USBDriver *usbp, usbep_t ep);
  43. #endif /* NKRO_ENABLE */
  44. /* ------------
  45. * Mouse header
  46. * ------------
  47. */
  48. #ifdef MOUSE_ENABLE
  49. /* mouse IN request callback handler */
  50. void mouse_in_cb(USBDriver *usbp, usbep_t ep);
  51. #endif /* MOUSE_ENABLE */
  52. /* ---------------
  53. * Shared EP header
  54. * ---------------
  55. */
  56. /* shared IN request callback handler */
  57. void shared_in_cb(USBDriver *usbp, usbep_t ep);
  58. /* --------------
  59. * Console header
  60. * --------------
  61. */
  62. #ifdef CONSOLE_ENABLE
  63. /* Putchar over the USB console */
  64. int8_t sendchar(uint8_t c);
  65. /* Flush output (send everything immediately) */
  66. void console_flush_output(void);
  67. #endif /* CONSOLE_ENABLE */
  68. #endif /* _USB_MAIN_H_ */