2016-11-28 07:48:04 +01:00
|
|
|
/* Bluetooth Low Energy Protocol for QMK.
|
|
|
|
* Author: Wez Furlong, 2016
|
|
|
|
* Supports the Adafruit BLE board built around the nRF51822 chip.
|
|
|
|
*/
|
|
|
|
#pragma once
|
2017-03-24 17:53:55 +01:00
|
|
|
#ifdef MODULE_ADAFRUIT_BLE
|
2019-08-30 20:19:03 +02:00
|
|
|
# include <stdbool.h>
|
|
|
|
# include <stdint.h>
|
|
|
|
# include <string.h>
|
2016-11-28 07:48:04 +01:00
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
# include "config_common.h"
|
|
|
|
# include "progmem.h"
|
2017-10-16 03:04:03 +02:00
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
# ifdef __cplusplus
|
2016-11-28 07:48:04 +01:00
|
|
|
extern "C" {
|
2019-08-30 20:19:03 +02:00
|
|
|
# endif
|
2016-11-28 07:48:04 +01:00
|
|
|
|
|
|
|
/* 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. */
|
2019-08-30 20:19:03 +02:00
|
|
|
extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys);
|
2016-11-28 07:48:04 +01:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
# ifdef MOUSE_ENABLE
|
2016-11-28 07:48:04 +01:00
|
|
|
/* Send a mouse/wheel movement report.
|
|
|
|
* The parameters are signed and indicate positive of negative direction
|
|
|
|
* change. */
|
2019-08-30 20:19:03 +02:00
|
|
|
extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons);
|
|
|
|
# endif
|
2016-11-28 07:48:04 +01:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
# ifdef __cplusplus
|
2016-11-28 07:48:04 +01:00
|
|
|
}
|
2019-08-30 20:19:03 +02:00
|
|
|
# endif
|
2016-11-28 07:48:04 +01:00
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
#endif // MODULE_ADAFRUIT_BLE
|