diff options
Diffstat (limited to 'drivers/bluetooth/adafruit_ble.h')
| -rw-r--r-- | drivers/bluetooth/adafruit_ble.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/bluetooth/adafruit_ble.h b/drivers/bluetooth/adafruit_ble.h new file mode 100644 index 000000000..b43e0771d --- /dev/null +++ b/drivers/bluetooth/adafruit_ble.h | |||
| @@ -0,0 +1,59 @@ | |||
| 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 | |||
| 6 | #pragma once | ||
| 7 | |||
| 8 | #include <stdbool.h> | ||
| 9 | #include <stdint.h> | ||
| 10 | #include <string.h> | ||
| 11 | |||
| 12 | #include "config_common.h" | ||
| 13 | |||
| 14 | #ifdef __cplusplus | ||
| 15 | extern "C" { | ||
| 16 | #endif | ||
| 17 | |||
| 18 | /* Instruct the module to enable HID keyboard support and reset */ | ||
| 19 | extern bool adafruit_ble_enable_keyboard(void); | ||
| 20 | |||
| 21 | /* Query to see if the BLE module is connected */ | ||
| 22 | extern bool adafruit_ble_query_is_connected(void); | ||
| 23 | |||
| 24 | /* Returns true if we believe that the BLE module is connected. | ||
| 25 | * This uses our cached understanding that is maintained by | ||
| 26 | * calling ble_task() periodically. */ | ||
| 27 | extern bool adafruit_ble_is_connected(void); | ||
| 28 | |||
| 29 | /* Call this periodically to process BLE-originated things */ | ||
| 30 | extern void adafruit_ble_task(void); | ||
| 31 | |||
| 32 | /* Generates keypress events for a set of keys. | ||
| 33 | * The hid modifier mask specifies the state of the modifier keys for | ||
| 34 | * this set of keys. | ||
| 35 | * Also sends a key release indicator, so that the keys do not remain | ||
| 36 | * held down. */ | ||
| 37 | extern void adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys); | ||
| 38 | |||
| 39 | /* Send a consumer usage. | ||
| 40 | * (milliseconds) */ | ||
| 41 | extern void adafruit_ble_send_consumer_key(uint16_t usage); | ||
| 42 | |||
| 43 | #ifdef MOUSE_ENABLE | ||
| 44 | /* Send a mouse/wheel movement report. | ||
| 45 | * The parameters are signed and indicate positive or negative direction | ||
| 46 | * change. */ | ||
| 47 | extern void adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons); | ||
| 48 | #endif | ||
| 49 | |||
| 50 | /* Compute battery voltage by reading an analog pin. | ||
| 51 | * Returns the integer number of millivolts */ | ||
| 52 | extern uint32_t adafruit_ble_read_battery_voltage(void); | ||
| 53 | |||
| 54 | extern bool adafruit_ble_set_mode_leds(bool on); | ||
| 55 | extern bool adafruit_ble_set_power_level(int8_t level); | ||
| 56 | |||
| 57 | #ifdef __cplusplus | ||
| 58 | } | ||
| 59 | #endif | ||
