diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-12-02 13:14:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-02 13:14:04 -0500 |
commit | 78f8fe361f9f6d5c32c785e90da3c868a0b255aa (patch) | |
tree | 28fe3de019ffd4c4c116c0cc9444cd391a59c85c /tmk_core/protocol/lufa/adafruit_ble.h | |
parent | 8f0a8cb7a6c001dd07bdf0c701e40a80b16f5c15 (diff) | |
parent | 712476cd288505cabb2ad6163d1c1ba13a7a1cca (diff) |
Merge pull request #915 from wez/ble_3
Add support for Adafruit BLE modules
Diffstat (limited to 'tmk_core/protocol/lufa/adafruit_ble.h')
-rw-r--r-- | tmk_core/protocol/lufa/adafruit_ble.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h new file mode 100644 index 0000000000..351fd55ae9 --- /dev/null +++ b/tmk_core/protocol/lufa/adafruit_ble.h @@ -0,0 +1,60 @@ +/* Bluetooth Low Energy Protocol for QMK. + * Author: Wez Furlong, 2016 + * Supports the Adafruit BLE board built around the nRF51822 chip. + */ +#pragma once +#ifdef ADAFRUIT_BLE_ENABLE +#include <stdbool.h> +#include <stdint.h> +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Instruct the module to enable HID keyboard support and reset */ +extern bool adafruit_ble_enable_keyboard(void); + +/* Query to see if the BLE module is connected */ +extern bool adafruit_ble_query_is_connected(void); + +/* Returns true if we believe that the BLE module is connected. + * This uses our cached understanding that is maintained by + * calling ble_task() periodically. */ +extern bool adafruit_ble_is_connected(void); + +/* Call this periodically to process BLE-originated things */ +extern void adafruit_ble_task(void); + +/* Generates keypress events for a set of keys. + * The hid modifier mask specifies the state of the modifier keys for + * this set of keys. + * Also sends a key release indicator, so that the keys do not remain + * held down. */ +extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, + uint8_t nkeys); + +/* Send a consumer keycode, holding it down for the specified duration + * (milliseconds) */ +extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration); + +#ifdef MOUSE_ENABLE +/* Send a mouse/wheel movement report. + * The parameters are signed and indicate positive of negative direction + * change. */ +extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, + int8_t pan); +#endif + +/* Compute battery voltage by reading an analog pin. + * Returns the integer number of millivolts */ +extern uint32_t adafruit_ble_read_battery_voltage(void); + +extern bool adafruit_ble_set_mode_leds(bool on); +extern bool adafruit_ble_set_power_level(int8_t level); + +#ifdef __cplusplus +} +#endif + +#endif // ADAFRUIT_BLE_ENABLE |