Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

usb.c 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2019 Ha Thach (tinyusb.org)
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. *
  24. */
  25. #include "bsp/board.h"
  26. #include "tusb.h"
  27. #include "config.h"
  28. #include "usb_descriptors.h"
  29. #include "usb_cdc.h"
  30. #include "usb_hid.h"
  31. #include "usb.h"
  32. void usb_init(void) {
  33. usb_descriptor_init_id();
  34. board_init();
  35. tusb_init();
  36. }
  37. void usb_run(void) {
  38. tud_task();
  39. hid_task();
  40. }
  41. // Invoked when device is mounted
  42. void tud_mount_cb(void) {
  43. }
  44. // Invoked when device is unmounted
  45. void tud_umount_cb(void) {
  46. }
  47. // Invoked when usb bus is suspended
  48. // remote_wakeup_en : if host allow us to perform remote wakeup
  49. // Within 7ms, device must draw an average of current less than 2.5 mA from bus
  50. void tud_suspend_cb(bool remote_wakeup_en) {
  51. (void) remote_wakeup_en;
  52. }
  53. // Invoked when usb bus is resumed
  54. void tud_resume_cb(void) {
  55. }