]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/protocol/lufa/adafruit_ble.h
Merge branch 'master' into master
[qmk_firmware.git] / tmk_core / protocol / lufa / adafruit_ble.h
1 /* Bluetooth Low Energy Protocol for QMK.
2  * Author: Wez Furlong, 2016
3  * Supports the Adafruit BLE board built around the nRF51822 chip.
4  */
5 #pragma once
6 #ifdef MODULE_ADAFRUIT_BLE
7 #include <stdbool.h>
8 #include <stdint.h>
9 #include <string.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /* Instruct the module to enable HID keyboard support and reset */
16 extern bool adafruit_ble_enable_keyboard(void);
17
18 /* Query to see if the BLE module is connected */
19 extern bool adafruit_ble_query_is_connected(void);
20
21 /* Returns true if we believe that the BLE module is connected.
22  * This uses our cached understanding that is maintained by
23  * calling ble_task() periodically. */
24 extern bool adafruit_ble_is_connected(void);
25
26 /* Call this periodically to process BLE-originated things */
27 extern void adafruit_ble_task(void);
28
29 /* Generates keypress events for a set of keys.
30  * The hid modifier mask specifies the state of the modifier keys for
31  * this set of keys.
32  * Also sends a key release indicator, so that the keys do not remain
33  * held down. */
34 extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys,
35                                    uint8_t nkeys);
36
37 /* Send a consumer keycode, holding it down for the specified duration
38  * (milliseconds) */
39 extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration);
40
41 #ifdef MOUSE_ENABLE
42 /* Send a mouse/wheel movement report.
43  * The parameters are signed and indicate positive of negative direction
44  * change. */
45 extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
46                                          int8_t pan);
47 #endif
48
49 /* Compute battery voltage by reading an analog pin.
50  * Returns the integer number of millivolts */
51 extern uint32_t adafruit_ble_read_battery_voltage(void);
52
53 extern bool adafruit_ble_set_mode_leds(bool on);
54 extern bool adafruit_ble_set_power_level(int8_t level);
55
56 #ifdef __cplusplus
57 }
58 #endif
59
60 #endif // MODULE_ADAFRUIT_BLE