Skip to content

Commit cc16174

Browse files
added profile constructor
1 parent 72502f0 commit cc16174

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/bluetooth.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,28 @@
88
BLEHidAdafruit blehid;
99

1010
void setupBLE(const char* manufacturer, const char* model, int8_t power)
11+
{
12+
setupBLE( manufacturer, model, power,0);
13+
}
14+
15+
void setupBLE(const char* manufacturer, const char* model, int8_t power, int8_t BLEProfile)
1116
{
1217
Bluefruit.begin();
1318
Bluefruit.setTxPower(power); // Check bluefruit.h for supported values
1419
bledis.setManufacturer(manufacturer);
1520
Bluefruit.setName(model);
1621
bledis.setModel(model);
22+
23+
24+
if (BLEProfile > 0)
25+
{
26+
ble_gap_addr_t gap_addr;
27+
gap_addr = Bluefruit.getAddr();
28+
gap_addr.addr[0] += BLEProfile;
29+
Bluefruit.setAddr(&gap_addr);
30+
}
31+
32+
1733
bledis.begin();
1834
blehid.begin();
1935
blehid.setKeyboardLedCallback(set_keyboard_led);
@@ -48,6 +64,8 @@ void startAdv(void)
4864
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
4965
}
5066

67+
68+
5169
void set_keyboard_led(uint16_t conn_handle, uint8_t led_bitmap)
5270
{
5371
(void) conn_handle;

src/bluetooth.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <bluefruit.h>
1010
extern BLEDis bledis;
1111
extern BLEHidAdafruit blehid;
12+
void setupBLE(const char* manufacturer, const char* model, int8_t power, int8_t BLEProfile);
1213
void setupBLE(const char* manufacturer, const char* model, int8_t power);
1314
void startAdv(void);
1415
void set_keyboard_led(uint16_t conn_handle, uint8_t led_bitmap);

0 commit comments

Comments
 (0)