bluetooth.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2022
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include "bluetooth.h"
  18. #if defined(BLUETOOTH_BLUEFRUIT_LE)
  19. # include "bluefruit_le.h"
  20. #elif defined(BLUETOOTH_RN42)
  21. # include "rn42.h"
  22. #endif
  23. void bluetooth_init(void) {
  24. #if defined(BLUETOOTH_BLUEFRUIT_LE)
  25. bluefruit_le_init();
  26. #elif defined(BLUETOOTH_RN42)
  27. rn42_init();
  28. #endif
  29. }
  30. void bluetooth_task(void) {
  31. #if defined(BLUETOOTH_BLUEFRUIT_LE)
  32. bluefruit_le_task();
  33. #endif
  34. }
  35. void bluetooth_send_keyboard(report_keyboard_t *report) {
  36. #if defined(BLUETOOTH_BLUEFRUIT_LE)
  37. bluefruit_le_send_keyboard(report);
  38. #elif defined(BLUETOOTH_RN42)
  39. rn42_send_keyboard(report);
  40. #endif
  41. }
  42. void bluetooth_send_mouse(report_mouse_t *report) {
  43. #if defined(BLUETOOTH_BLUEFRUIT_LE)
  44. bluefruit_le_send_mouse(report);
  45. #elif defined(BLUETOOTH_RN42)
  46. rn42_send_mouse(report);
  47. #endif
  48. }
  49. void bluetooth_send_consumer(uint16_t usage) {
  50. #if defined(BLUETOOTH_BLUEFRUIT_LE)
  51. bluefruit_le_send_consumer(usage);
  52. #elif defined(BLUETOOTH_RN42)
  53. rn42_send_consumer(usage);
  54. #endif
  55. }