Skip to content

Commit

Permalink
added profile constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jpconstantineau committed Jul 29, 2022
1 parent 72502f0 commit cc16174
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@
BLEHidAdafruit blehid;

void setupBLE(const char* manufacturer, const char* model, int8_t power)
{
setupBLE( manufacturer, model, power,0);
}

void setupBLE(const char* manufacturer, const char* model, int8_t power, int8_t BLEProfile)
{
Bluefruit.begin();
Bluefruit.setTxPower(power); // Check bluefruit.h for supported values
bledis.setManufacturer(manufacturer);
Bluefruit.setName(model);
bledis.setModel(model);


if (BLEProfile > 0)
{
ble_gap_addr_t gap_addr;
gap_addr = Bluefruit.getAddr();
gap_addr.addr[0] += BLEProfile;
Bluefruit.setAddr(&gap_addr);
}


bledis.begin();
blehid.begin();
blehid.setKeyboardLedCallback(set_keyboard_led);
Expand Down Expand Up @@ -48,6 +64,8 @@ void startAdv(void)
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
}



void set_keyboard_led(uint16_t conn_handle, uint8_t led_bitmap)
{
(void) conn_handle;
Expand Down
1 change: 1 addition & 0 deletions src/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <bluefruit.h>
extern BLEDis bledis;
extern BLEHidAdafruit blehid;
void setupBLE(const char* manufacturer, const char* model, int8_t power, int8_t BLEProfile);
void setupBLE(const char* manufacturer, const char* model, int8_t power);
void startAdv(void);
void set_keyboard_led(uint16_t conn_handle, uint8_t led_bitmap);
Expand Down

0 comments on commit cc16174

Please sign in to comment.