diff --git a/examples/Peripheral/CallbackLED/CallbackLED.ino b/examples/Peripheral/CallbackLED/CallbackLED.ino index 59bda5ed..f5840117 100644 --- a/examples/Peripheral/CallbackLED/CallbackLED.ino +++ b/examples/Peripheral/CallbackLED/CallbackLED.ino @@ -82,6 +82,10 @@ void blePeripheralDisconnectHandler(BLEDevice central) { } void switchCharacteristicWritten(BLEDevice central, BLECharacteristic characteristic) { + // unused parameters + (void)central; + (void)characteristic; + // central wrote new value to characteristic, update LED Serial.print("Characteristic event, written: "); diff --git a/examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino b/examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino index dfc9f4a0..4cb98763 100644 --- a/examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino +++ b/examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino @@ -18,9 +18,10 @@ #include -#define PAIR_BUTTON 3 // button for pairing +#define PAIR_BUTTON 3 // button for pairing #define PAIR_LED 24 // LED used to signal pairing #define PAIR_LED_ON LOW // Blue LED on Nano BLE has inverted logic +#define PAIR_LED_OFF HIGH // ... so these are inverted as well #define PAIR_INTERVAL 30000 // interval for pairing after button press in ms #define CTRL_LED LED_BUILTIN @@ -59,13 +60,13 @@ void setup() { BLE.setDisplayCode([](uint32_t confirmCode){ Serial.println("New device pairing request."); Serial.print("Confirm code matches pairing device: "); - char code[6]; + char code[7]; sprintf(code, "%06d", confirmCode); Serial.println(code); }); // Callback to allow accepting or rejecting pairing - BLE.setBinaryConfirmPairing([&acceptOrReject](){ + BLE.setBinaryConfirmPairing([](){ Serial.print("Should we confirm pairing? "); delay(5000); if(acceptOrReject){ @@ -176,8 +177,7 @@ void setup() { BLE.addService(batteryService); // Add the battery service batteryLevelChar.writeValue(oldBatteryLevel); // set initial value for this characteristic - char* stringCharValue = new char[32]; - stringCharValue = "string"; + const char* stringCharValue = "string"; stringcharacteristic.writeValue(stringCharValue); secretValue.writeValue(0); @@ -219,9 +219,10 @@ void loop() { BLE.setPairable(false); Serial.println("No longer accepting pairing"); } - // Make LED blink while pairing is allowed - digitalWrite(PAIR_LED, (BLE.pairable() ? (millis()%400)<200 : BLE.paired()) ? PAIR_LED_ON : !PAIR_LED_ON); + // Make LED blink while pairing is allowed, steady ON when paired + bool led_status = BLE.pairable() ? (millis()%400)<200 : BLE.paired(); + digitalWrite(PAIR_LED, led_status ? PAIR_LED_ON : PAIR_LED_OFF); // if a central is connected to the peripheral: if (central && central.connected()) { @@ -262,4 +263,4 @@ void updateBatteryLevel() { batteryLevelChar.writeValue(batteryLevel); // and update the battery level characteristic oldBatteryLevel = batteryLevel; // save the level for next comparison } -} \ No newline at end of file +} diff --git a/src/utility/HCIVirtualTransportZephyr.cpp b/src/utility/HCIVirtualTransportZephyr.cpp index bf278235..51216a17 100644 --- a/src/utility/HCIVirtualTransportZephyr.cpp +++ b/src/utility/HCIVirtualTransportZephyr.cpp @@ -91,7 +91,7 @@ static int cyw4343_download_firmware(const struct device *uart) { } // Load the firmware image. - for (size_t offset=0; offset < brcm_patch_ram_length;) { + for (int offset=0; offset < brcm_patch_ram_length;) { uint8_t length = brcm_patchram_buf[offset + 2]; uint16_t opcode = (brcm_patchram_buf[offset + 0]) | (brcm_patchram_buf[offset + 1] << 8);