2016-11-27 22:48:04 -08:00
|
|
|
/* Bluetooth Low Energy Protocol for QMK.
|
|
|
|
* Author: Wez Furlong, 2016
|
|
|
|
* Supports the Adafruit BLE board built around the nRF51822 chip.
|
|
|
|
*/
|
2020-08-19 05:46:15 -07:00
|
|
|
|
2016-11-27 22:48:04 -08:00
|
|
|
#pragma once
|
|
|
|
|
2020-08-19 05:46:15 -07:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2022-09-29 10:38:09 -07:00
|
|
|
#include "report.h"
|
2017-10-15 18:04:03 -07:00
|
|
|
|
2020-08-19 05:46:15 -07:00
|
|
|
#ifdef __cplusplus
|
2016-11-27 22:48:04 -08:00
|
|
|
extern "C" {
|
2020-08-19 05:46:15 -07:00
|
|
|
#endif
|
2016-11-27 22:48:04 -08:00
|
|
|
|
|
|
|
/* Instruct the module to enable HID keyboard support and reset */
|
2022-01-30 09:29:42 -08:00
|
|
|
extern bool bluefruit_le_enable_keyboard(void);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
|
|
|
/* Query to see if the BLE module is connected */
|
2022-01-30 09:29:42 -08:00
|
|
|
extern bool bluefruit_le_query_is_connected(void);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
|
|
|
/* Returns true if we believe that the BLE module is connected.
|
|
|
|
* This uses our cached understanding that is maintained by
|
|
|
|
* calling ble_task() periodically. */
|
2022-01-30 09:29:42 -08:00
|
|
|
extern bool bluefruit_le_is_connected(void);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
2022-09-29 10:38:09 -07:00
|
|
|
extern void bluefruit_le_init(void);
|
|
|
|
|
2016-11-27 22:48:04 -08:00
|
|
|
/* Call this periodically to process BLE-originated things */
|
2022-01-30 09:29:42 -08:00
|
|
|
extern void bluefruit_le_task(void);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
|
|
|
/* 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. */
|
2022-09-29 10:38:09 -07:00
|
|
|
extern void bluefruit_le_send_keyboard(report_keyboard_t *report);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
2021-01-14 19:32:00 -08:00
|
|
|
/* Send a consumer usage.
|
2016-11-27 22:48:04 -08:00
|
|
|
* (milliseconds) */
|
2022-09-29 10:38:09 -07:00
|
|
|
extern void bluefruit_le_send_consumer(uint16_t usage);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
|
|
|
/* Send a mouse/wheel movement report.
|
2021-01-14 19:32:00 -08:00
|
|
|
* The parameters are signed and indicate positive or negative direction
|
2016-11-27 22:48:04 -08:00
|
|
|
* change. */
|
2022-09-29 10:38:09 -07:00
|
|
|
extern void bluefruit_le_send_mouse(report_mouse_t *report);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
|
|
|
/* Compute battery voltage by reading an analog pin.
|
|
|
|
* Returns the integer number of millivolts */
|
2022-01-30 09:29:42 -08:00
|
|
|
extern uint32_t bluefruit_le_read_battery_voltage(void);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
2022-01-30 09:29:42 -08:00
|
|
|
extern bool bluefruit_le_set_mode_leds(bool on);
|
|
|
|
extern bool bluefruit_le_set_power_level(int8_t level);
|
2016-11-27 22:48:04 -08:00
|
|
|
|
2020-08-19 05:46:15 -07:00
|
|
|
#ifdef __cplusplus
|
2016-11-27 22:48:04 -08:00
|
|
|
}
|
2020-08-19 05:46:15 -07:00
|
|
|
#endif
|