-
Notifications
You must be signed in to change notification settings - Fork 2
/
ble_stack.h
49 lines (40 loc) · 1.29 KB
/
ble_stack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdint.h>
#include <string.h>
#include "app_error.h"
#include "ble.h"
#include "ble_err.h"
#include "ble_hci.h"
#include "ble_srv_common.h"
#include "ble_advdata.h"
#include "ble_conn_params.h"
#include "nrf5x-compat.h"
#if NRF_SDK_VERSION < 15
#define APP_TIMER_PRESCALER 31
#define APP_TIMER_MAX_TIMERS 1
#define APP_TIMER_OP_QUEUE_SIZE 4
#include "softdevice_handler.h"
#endif
#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 3
#include "nrf_sdh.h"
#include "nrf_sdh_ble.h"
#include "nrf_ble_gatt.h"
#include "nrf_ble_qwr.h"
#include "nrf_pwr_mgmt.h"
#include "ble_lbs.h"
#endif
#include "boards.h"
#include "app_timer.h"
#include "app_button.h"
#define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */
#define STATUS_FLAG_BATTERY_MASK 0b11000000
#define STATUS_FLAG_COUNTER_MASK 0b00111111
#define STATUS_FLAG_MEDIUM_BATTERY 0b01000000
#define STATUS_FLAG_LOW_BATTERY 0b10000000
#define STATUS_FLAG_CRITICALLY_LOW_BATTERY 0b11000000
#ifndef ADVERTISING_INTERVAL
#define ADVERTISING_INTERVAL 1000
#endif
void ble_advertising_init(void);
void ble_set_max_tx_power(void);
void set_battery(uint8_t battery_level);
uint8_t ble_set_advertisement_key(const char *key);