Skip to content

Commit

Permalink
Use mbed::callback typedef for BLE handlers on ARDUINO_ARCH_MBED
Browse files Browse the repository at this point in the history
This allows using capturing lambdas for BLE handlers on mbed-based
devices.
  • Loading branch information
DenebTM committed Feb 12, 2024
1 parent dff9e41 commit 828ceb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BLECharacteristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ enum BLECharacteristicEvent {
class BLECharacteristic;
class BLEDevice;

#ifdef ARDUINO_ARCH_MBED
#include <mbed.h>
typedef mbed::Callback<void (BLEDevice device, BLECharacteristic characteristic)> BLECharacteristicEventHandler;
#else
typedef void (*BLECharacteristicEventHandler)(BLEDevice device, BLECharacteristic characteristic);
#endif

class BLELocalCharacteristic;
class BLERemoteCharacteristic;
Expand Down
5 changes: 5 additions & 0 deletions src/BLEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ enum BLEDeviceEvent {

class BLEDevice;

#ifdef ARDUINO_ARCH_MBED
#include <mbed.h>
typedef mbed::Callback<void (BLEDevice device)> BLEDeviceEventHandler;
#else
typedef void (*BLEDeviceEventHandler)(BLEDevice device);
#endif

class BLEDevice {
public:
Expand Down

0 comments on commit 828ceb8

Please sign in to comment.