Skip to content

Commit 3dcb4bb

Browse files
Clear compile errors if BT needed but not on (#1371)
Fixes #1370 Adds a simple helper assertion to tell the user how to enable BT if it's not enabled, instead of some odd compilation warnings about undefined functions.
1 parent 59981ae commit 3dcb4bb

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

cores/rp2040/_needsbt.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Simple helper header to ensure pico libs support ?BT
2+
3+
#ifndef ENABLE_CLASSIC
4+
#define ENABLE_CLASSIC 0
5+
#endif
6+
7+
static_assert(ENABLE_CLASSIC, "This library needs Bluetooth enabled. Use the 'Tools->IP/Bluetooth Stack' menu in the IDE to enable it.");

libraries/BTstackLib/src/BTstackLib.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/**
22
Arduino Wrapper for BTstack
33
*/
4+
5+
#include <_needsbt.h>
6+
47
#ifndef __ARDUINO_BTSTACK_H
58
#define __ARDUINO_BTSTACK_H
69

@@ -198,4 +201,4 @@ extern "C" {
198201
}
199202
#endif
200203

201-
#endif // __ARDUINO_BTSTACK_H
204+
#endif // __ARDUINO_BTSTACK_H

libraries/HID_Bluetooth/src/PicoBluetoothBLEHID.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#pragma once
2323

24+
#include <_needsbt.h>
2425
#include <Arduino.h>
2526
#include <functional>
2627
#include <pico/cyw43_arch.h>

libraries/HID_Bluetooth/src/PicoBluetoothHID.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#pragma once
2323

24+
#include <_needsbt.h>
2425
#include <Arduino.h>
2526
#include <functional>
2627
#include <pico/cyw43_arch.h>

libraries/SerialBT/src/SerialBT.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#pragma once
2222

23+
#include <_needsbt.h>
2324
#include <Arduino.h>
2425
#include <api/HardwareSerial.h>
2526
#include <stdarg.h>

0 commit comments

Comments
 (0)