bluetooth.c
1662 bytes
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
18#include "bluetooth.h"
19
20#if defined(BLUETOOTH_BLUEFRUIT_LE)
21# include "bluefruit_le.h"
22#elif defined(BLUETOOTH_RN42)
23# include "rn42.h"
24#endif
25
26void bluetooth_init(void) {
27#if defined(BLUETOOTH_BLUEFRUIT_LE)
28 bluefruit_le_init();
29#elif defined(BLUETOOTH_RN42)
30 rn42_init();
31#endif
32}
33
34void bluetooth_task(void) {
35#if defined(BLUETOOTH_BLUEFRUIT_LE)
36 bluefruit_le_task();
37#endif
38}
39
40void bluetooth_send_keyboard(report_keyboard_t *report) {
41#if defined(BLUETOOTH_BLUEFRUIT_LE)
42 bluefruit_le_send_keyboard(report);
43#elif defined(BLUETOOTH_RN42)
44 rn42_send_keyboard(report);
45#endif
46}
47
48void bluetooth_send_mouse(report_mouse_t *report) {
49#if defined(BLUETOOTH_BLUEFRUIT_LE)
50 bluefruit_le_send_mouse(report);
51#elif defined(BLUETOOTH_RN42)
52 rn42_send_mouse(report);
53#endif
54}
55
56void bluetooth_send_consumer(uint16_t usage) {
57#if defined(BLUETOOTH_BLUEFRUIT_LE)
58 bluefruit_le_send_consumer(usage);
59#elif defined(BLUETOOTH_RN42)
60 rn42_send_consumer(usage);
61#endif
62}