bluefruit_le.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Bluetooth Low Energy Protocol for QMK.
  2. * Author: Wez Furlong, 2016
  3. * Supports the Adafruit BLE board built around the nRF51822 chip.
  4. */
  5. #pragma once
  6. #include <stdbool.h>
  7. #include <stdint.h>
  8. #include "report.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /* Instruct the module to enable HID keyboard support and reset */
  13. extern bool bluefruit_le_enable_keyboard(void);
  14. /* Query to see if the BLE module is connected */
  15. extern bool bluefruit_le_query_is_connected(void);
  16. /* Returns true if we believe that the BLE module is connected.
  17. * This uses our cached understanding that is maintained by
  18. * calling ble_task() periodically. */
  19. extern bool bluefruit_le_is_connected(void);
  20. extern void bluefruit_le_init(void);
  21. /* Call this periodically to process BLE-originated things */
  22. extern void bluefruit_le_task(void);
  23. /* Generates keypress events for a set of keys.
  24. * The hid modifier mask specifies the state of the modifier keys for
  25. * this set of keys.
  26. * Also sends a key release indicator, so that the keys do not remain
  27. * held down. */
  28. extern void bluefruit_le_send_keyboard(report_keyboard_t *report);
  29. /* Send a consumer usage.
  30. * (milliseconds) */
  31. extern void bluefruit_le_send_consumer(uint16_t usage);
  32. /* Send a mouse/wheel movement report.
  33. * The parameters are signed and indicate positive or negative direction
  34. * change. */
  35. extern void bluefruit_le_send_mouse(report_mouse_t *report);
  36. /* Compute battery voltage by reading an analog pin.
  37. * Returns the integer number of millivolts */
  38. extern uint32_t bluefruit_le_read_battery_voltage(void);
  39. extern bool bluefruit_le_set_mode_leds(bool on);
  40. extern bool bluefruit_le_set_power_level(int8_t level);
  41. #ifdef __cplusplus
  42. }
  43. #endif