summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/bluefruit_le.h
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-01-31 04:29:42 +1100
committerGitHub <noreply@github.com>2022-01-30 17:29:42 +0000
commit7d685956cc616a8d76aa7866f42bf569a9ca3fca (patch)
tree55f20f489b9ab12fde6bba1a8f8b59499e8ed179 /drivers/bluetooth/bluefruit_le.h
parent9f4769fbe62fd3763a72f4a56dee18b5fbabec29 (diff)
Rename `AdafruitBLE` to `BluefruitLE` (#16127)
Diffstat (limited to 'drivers/bluetooth/bluefruit_le.h')
-rw-r--r--drivers/bluetooth/bluefruit_le.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/bluetooth/bluefruit_le.h b/drivers/bluetooth/bluefruit_le.h
new file mode 100644
index 0000000000..de301c6167
--- /dev/null
+++ b/drivers/bluetooth/bluefruit_le.h
@@ -0,0 +1,59 @@
+/* Bluetooth Low Energy Protocol for QMK.
+ * Author: Wez Furlong, 2016
+ * Supports the Adafruit BLE board built around the nRF51822 chip.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "config_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Instruct the module to enable HID keyboard support and reset */
+extern bool bluefruit_le_enable_keyboard(void);
+
+/* Query to see if the BLE module is connected */
+extern bool bluefruit_le_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 bluefruit_le_is_connected(void);
+
+/* Call this periodically to process BLE-originated things */
+extern void bluefruit_le_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 void bluefruit_le_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uint8_t nkeys);
+
+/* Send a consumer usage.
+ * (milliseconds) */
+extern void bluefruit_le_send_consumer_key(uint16_t usage);
+
+#ifdef MOUSE_ENABLE
+/* Send a mouse/wheel movement report.
+ * The parameters are signed and indicate positive or negative direction
+ * change. */
+extern void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons);
+#endif
+
+/* Compute battery voltage by reading an analog pin.
+ * Returns the integer number of millivolts */
+extern uint32_t bluefruit_le_read_battery_voltage(void);
+
+extern bool bluefruit_le_set_mode_leds(bool on);
+extern bool bluefruit_le_set_power_level(int8_t level);
+
+#ifdef __cplusplus
+}
+#endif