aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol/lufa/adafruit_ble.h
blob: 351fd55ae92e664c7a3dd7018ed8f9d333a580a2 (plain)
1
2
3
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd
/* 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