Skip to content

Commit

Permalink
Pi Pico W MIDI over BLE support
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Jan 23, 2024
1 parent ae6c109 commit d7a4e69
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/MIDI_Interfaces/BluetoothMIDI_Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct BLEMIDIBackend {};
END_BEGIN_CS_NAMESPACE
/// Indicates whether @ref BLEMIDIBackend and @ref BluetoothMIDI_Interface are
/// defined for this board.
#define CS_BLEMIDI_SUPPORTED 1
#define CS_BLE_MIDI_SUPPORTED 1
/// On ESP32, changes the default MIDI over BLE backend from Bluedroid to NimBLE.
/// This macro should be defined before including any Control Surface headers.
/// Requires the [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino) library.
Expand All @@ -26,17 +26,27 @@ END_BEGIN_CS_NAMESPACE
BEGIN_CS_NAMESPACE
using BLEMIDIBackend = ESP32NimBLEBackend;
END_CS_NAMESPACE
#define CS_BLEMIDI_SUPPORTED 1
#define CS_BLE_MIDI_SUPPORTED 1
#else
// Bluedroid backend (default)
#include "BLEMIDI/ESP32BluedroidBackend.hpp"
BEGIN_CS_NAMESPACE
using BLEMIDIBackend = ESP32BluedroidBackend;
END_CS_NAMESPACE
#define CS_BLEMIDI_SUPPORTED 1
#define CS_BLE_MIDI_SUPPORTED 1
#endif
#endif

#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
// Pico W
#if ENABLE_BLE
#include "BLEMIDI/BTstackBackgroundBackend.hpp"
BEGIN_CS_NAMESPACE
using BLEMIDIBackend = BTstackBackgroundBackend;
END_CS_NAMESPACE
#define CS_BLE_MIDI_SUPPORTED 1
#endif

#elif (defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARDUINO_NANO33BLE)) || \
(defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_RP2040)) || \
(defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_GIGA)) || \
Expand All @@ -48,10 +58,10 @@ END_CS_NAMESPACE
BEGIN_CS_NAMESPACE
using BLEMIDIBackend = ArduinoBLEBackend;
END_CS_NAMESPACE
#define CS_BLEMIDI_SUPPORTED 1
#define CS_BLE_MIDI_SUPPORTED 1
#endif

#ifdef CS_BLEMIDI_SUPPORTED
#ifdef CS_BLE_MIDI_SUPPORTED
#include "GenericBLEMIDI_Interface.hpp"
BEGIN_CS_NAMESPACE
/// @brief A class for MIDI interfaces sending MIDI messages over a Bluetooth
Expand All @@ -65,3 +75,7 @@ BEGIN_CS_NAMESPACE
struct BluetoothMIDI_Interface : GenericBLEMIDI_Interface<BLEMIDIBackend> {};
END_CS_NAMESPACE
#endif

#ifndef CS_BLE_MIDI_SUPPORTED
#define CS_BLE_MIDI_NOT_SUPPORTED
#endif

0 comments on commit d7a4e69

Please sign in to comment.