more clean up
This commit is contained in:
30 files changed
+34
-64
No files matched your search
@@ -25,9 +25,7 @@ void setup()
|
||||
// Initialize Bluefruit with maximum connections as Peripheral = 0, Central = 1
|
||||
// SRAM usage required by SoftDevice will increase dramatically with number of connections
|
||||
Bluefruit.begin(0, 1);
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Start Central Scan
|
||||
|
||||
+1
-3
@@ -29,9 +29,7 @@ void setup()
|
||||
// Initialize Bluefruit with maximum connections as Peripheral = 0, Central = 1
|
||||
// SRAM usage required by SoftDevice will increase dramatically with number of connections
|
||||
Bluefruit.begin(0, 1);
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
|
||||
/* Set the device name */
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
@@ -41,8 +41,7 @@ void setup()
|
||||
// Initialize Bluefruit with max concurrent connections as Peripheral = 1, Central = 1
|
||||
// SRAM usage required by SoftDevice will increase with number of connections
|
||||
Bluefruit.begin(1, 1);
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52 duo");
|
||||
|
||||
// Callbacks for Peripheral
|
||||
|
||||
+1
-3
@@ -791,9 +791,7 @@ void setup()
|
||||
|
||||
Bluefruit.begin();
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
|
||||
// try to go as fast as possible, could be rejected by some central, increase it if needed
|
||||
// iOS won't negotitate and will mostly use 30ms
|
||||
|
||||
@@ -35,8 +35,7 @@ void setup()
|
||||
Serial.println("----------------------------------------\n");
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Set up and start advertising
|
||||
|
||||
@@ -51,9 +51,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -96,8 +96,7 @@ void setup()
|
||||
//Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -43,9 +43,7 @@ void setup()
|
||||
|
||||
// off Blue LED for lowest power consumption
|
||||
Bluefruit.autoConnLed(false);
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(0);
|
||||
Bluefruit.setTxPower(0); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Manufacturer ID is required for Manufacturer Specific Data
|
||||
|
||||
@@ -51,7 +51,7 @@ void setup()
|
||||
|
||||
Bluefruit.begin();
|
||||
Bluefruit.setName("Bluefruit52 MIDI");
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
|
||||
// Setup the on board blue LED to be enabled on CONNECT
|
||||
Bluefruit.autoConnLed(true);
|
||||
|
||||
@@ -38,8 +38,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
//Bluefruit.setName(getMcuUniqueID()); // useful testing with multiple central connections
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
|
||||
@@ -36,8 +36,7 @@ void setup()
|
||||
|
||||
// Initialize Bluefruit with max concurrent connections as Peripheral = 2, Central = 0
|
||||
Bluefruit.begin(MAX_PRPH_CONNECTION, 0);
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -26,8 +26,7 @@ void setup()
|
||||
Serial.println("--------------------------\n");
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// To be consistent OTA DFU should be added first if it exists
|
||||
|
||||
@@ -47,8 +47,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -53,8 +53,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -37,8 +37,7 @@ void setup(void)
|
||||
Serial.println(F("-------------------------------------------"));
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// To be consistent OTA DFU should be added first if it exists
|
||||
|
||||
@@ -27,8 +27,7 @@ void setup()
|
||||
Serial.println("---------------------------------\n");
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Setup the advertising packet
|
||||
|
||||
+1
-2
@@ -43,8 +43,7 @@ void setup()
|
||||
Serial.println();
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Configure and start DIS (Device Information Service)
|
||||
|
||||
@@ -35,8 +35,7 @@ void setup()
|
||||
Serial.println();
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Configure and Start Device Information Service
|
||||
|
||||
@@ -53,8 +53,7 @@ void setup()
|
||||
Serial.println();
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Configure and Start Device Information Service
|
||||
|
||||
@@ -37,8 +37,7 @@ void setup()
|
||||
Bluefruit.begin();
|
||||
// HID Device can have a min connection interval of 9*1.25 = 11.25 ms
|
||||
Bluefruit.Periph.setConnInterval(9, 16); // min = 9*1.25=11.25 ms, max = 16*1.25=20ms
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Configure and Start Device Information Service
|
||||
|
||||
@@ -86,8 +86,7 @@ void setup()
|
||||
|
||||
// Init Bluefruit
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ void setup()
|
||||
|
||||
// Init Bluefruit
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -34,8 +34,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
@@ -44,8 +44,7 @@ void setup(void)
|
||||
Bluefruit.autoConnLed(true);
|
||||
|
||||
Bluefruit.begin();
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
+1
-3
@@ -120,9 +120,7 @@ void setup()
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
|
||||
Bluefruit.begin();
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
//InternalFS.remove(CRYPTO_KEYFILE);
|
||||
|
||||
+1
-2
@@ -184,8 +184,7 @@ void setup()
|
||||
Serial.println("Bluefruit initialized (central mode)");
|
||||
}
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
|
||||
/* Set the device name */
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
+1
-2
@@ -74,8 +74,7 @@ void setup()
|
||||
Serial.println("Bluefruit initialized (peripheral mode)");
|
||||
}
|
||||
|
||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Set up and start advertising
|
||||
|
||||
@@ -82,7 +82,7 @@ class BLEConnection
|
||||
|
||||
bool disconnect(void);
|
||||
|
||||
bool setTxPower(int8_t power);
|
||||
bool setTxPower(int8_t power); // set power for this connection
|
||||
|
||||
bool monitorRssi(uint8_t threshold = BLE_GAP_RSSI_THRESHOLD_INVALID);
|
||||
int8_t getRssi(void);
|
||||
|
||||
@@ -105,7 +105,7 @@ extern "C"
|
||||
class AdafruitBluefruit
|
||||
{
|
||||
public:
|
||||
typedef void (*rssi_callback_t ) (uint16_t conn_hdl, int8_t rssi);
|
||||
typedef void (*rssi_callback_t) (uint16_t conn_hdl, int8_t rssi);
|
||||
|
||||
AdafruitBluefruit(void); // Constructor
|
||||
|
||||
@@ -147,6 +147,9 @@ class AdafruitBluefruit
|
||||
void setName (const char* str);
|
||||
uint8_t getName (char* name, uint16_t bufsize);
|
||||
|
||||
// Supported tx_power values depending on mcu:
|
||||
// - nRF52832: -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +3dBm and +4dBm.
|
||||
// - nRF52840: -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +2dBm, +3dBm, +4dBm, +5dBm, +6dBm, +7dBm and +8dBm.
|
||||
bool setTxPower (int8_t power);
|
||||
int8_t getTxPower (void);
|
||||
|
||||
@@ -184,7 +187,7 @@ class AdafruitBluefruit
|
||||
/* Callbacks
|
||||
*------------------------------------------------------------------*/
|
||||
void setRssiCallback(rssi_callback_t fp);
|
||||
void setEventCallback ( void (*fp) (ble_evt_t*) );
|
||||
void setEventCallback( void (*fp) (ble_evt_t*) );
|
||||
|
||||
COMMENT_OUT ( bool setPIN(const char* pin); )
|
||||
|
||||
|
||||
Reference in new issue
Block a user