Skip to content

Commit 2c0e228

Browse files
committed
misc: fix compiler warnings
Fix various compiler warnings about unused parameters, signed-unsigned comparisons and enum/int mismatches. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
1 parent 07dcca4 commit 2c0e228

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

examples/Peripheral/CallbackLED/CallbackLED.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ void blePeripheralDisconnectHandler(BLEDevice central) {
8282
}
8383

8484
void switchCharacteristicWritten(BLEDevice central, BLECharacteristic characteristic) {
85+
// unused parameters
86+
(void)central;
87+
(void)characteristic;
88+
8589
// central wrote new value to characteristic, update LED
8690
Serial.print("Characteristic event, written: ");
8791

examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
#include <ArduinoBLE.h>
1919

2020

21-
#define PAIR_BUTTON 3 // button for pairing
21+
#define PAIR_BUTTON 3 // button for pairing
2222
#define PAIR_LED 24 // LED used to signal pairing
2323
#define PAIR_LED_ON LOW // Blue LED on Nano BLE has inverted logic
24+
#define PAIR_LED_OFF HIGH // ... so these are inverted as well
2425
#define PAIR_INTERVAL 30000 // interval for pairing after button press in ms
2526

2627
#define CTRL_LED LED_BUILTIN
@@ -65,7 +66,7 @@ void setup() {
6566
});
6667

6768
// Callback to allow accepting or rejecting pairing
68-
BLE.setBinaryConfirmPairing([&acceptOrReject](){
69+
BLE.setBinaryConfirmPairing([](){
6970
Serial.print("Should we confirm pairing? ");
7071
delay(5000);
7172
if(acceptOrReject){
@@ -218,9 +219,10 @@ void loop() {
218219
BLE.setPairable(false);
219220
Serial.println("No longer accepting pairing");
220221
}
221-
// Make LED blink while pairing is allowed
222-
digitalWrite(PAIR_LED, (BLE.pairable() ? (millis()%400)<200 : BLE.paired()) ? PAIR_LED_ON : !PAIR_LED_ON);
223222

223+
// Make LED blink while pairing is allowed, steady ON when paired
224+
bool led_status = BLE.pairable() ? (millis()%400)<200 : BLE.paired();
225+
digitalWrite(PAIR_LED, led_status ? PAIR_LED_ON : PAIR_LED_OFF);
224226

225227
// if a central is connected to the peripheral:
226228
if (central && central.connected()) {
@@ -261,4 +263,4 @@ void updateBatteryLevel() {
261263
batteryLevelChar.writeValue(batteryLevel); // and update the battery level characteristic
262264
oldBatteryLevel = batteryLevel; // save the level for next comparison
263265
}
264-
}
266+
}

src/utility/HCIVirtualTransportZephyr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int cyw4343_download_firmware(const struct device *uart) {
9191
}
9292

9393
// Load the firmware image.
94-
for (size_t offset=0; offset < brcm_patch_ram_length;) {
94+
for (int offset=0; offset < brcm_patch_ram_length;) {
9595
uint8_t length = brcm_patchram_buf[offset + 2];
9696
uint16_t opcode = (brcm_patchram_buf[offset + 0]) |
9797
(brcm_patchram_buf[offset + 1] << 8);

0 commit comments

Comments
 (0)