Skip to content

Commit 0738aab

Browse files
authored
Merge pull request #14710 from noonfom/non-low-power-devices
BLE: support non-low power devices
2 parents 543bcb5 + 8ee7fb8 commit 0738aab

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ void BLEInstanceBase::callDispatcher()
745745

746746
wsfOsDispatcher();
747747

748-
static mbed::LowPowerTimeout nextTimeout;
748+
static Timeout nextTimeout;
749749
mbed::CriticalSectionLock critical_section;
750750

751751
if (wsfOsReadyToSleep()) {

connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@
4545
#include "source/PalPrivateAddressControllerImpl.h"
4646
#include "source/generic/PrivateAddressController.h"
4747

48+
#include "drivers/Timeout.h"
49+
#ifdef DEVICE_LPTICKER
50+
#include "drivers/LowPowerTimeout.h"
4851
#include "drivers/LowPowerTimer.h"
52+
#else
53+
#include "drivers/Timer.h"
54+
#endif
4955

5056
namespace ble {
5157

@@ -57,6 +63,14 @@ namespace impl {
5763
* @see BLEInstanceBase
5864
*/
5965
class BLEInstanceBase final : public ble::BLEInstanceBase {
66+
#ifdef DEVICE_LPTICKER
67+
using Timeout = mbed::LowPowerTimeout;
68+
using Timer = mbed::LowPowerTimer;
69+
#else
70+
using Timeout = mbed::Timeout;
71+
using Timer = mbed::Timer;
72+
#endif
73+
6074
friend PalSigningMonitor;
6175

6276
/**
@@ -200,7 +214,7 @@ class BLEInstanceBase final : public ble::BLEInstanceBase {
200214
} initialization_status;
201215

202216
mutable ble::impl::PalEventQueue _event_queue;
203-
mbed::LowPowerTimer _timer;
217+
Timer _timer;
204218
uint64_t _last_update_us;
205219
};
206220

connectivity/FEATURE_BLE/source/generic/GapImpl.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
#include <algorithm>
2525

26-
#include "drivers/LowPowerTimeout.h"
27-
#include "drivers/LowPowerTicker.h"
2826
#include "platform/mbed_error.h"
2927

3028
#include "ble/common/BLERoles.h"
@@ -43,6 +41,14 @@
4341

4442
#include "ble/Gap.h"
4543

44+
#ifdef DEVICE_LPTICKER
45+
#include "drivers/LowPowerTimeout.h"
46+
#include "drivers/LowPowerTicker.h"
47+
#else
48+
#include "drivers/Timeout.h"
49+
#include "drivers/Ticker.h"
50+
#endif
51+
4652
namespace ble {
4753

4854
class PalGenericAccessService;
@@ -75,6 +81,14 @@ class Gap :
7581
public:
7682
using PreferredConnectionParams_t = ::ble::Gap::PreferredConnectionParams_t ;
7783

84+
#ifdef DEVICE_LPTICKER
85+
using Timeout = mbed::LowPowerTimeout;
86+
using Ticker = mbed::LowPowerTicker;
87+
#else
88+
using Timeout = mbed::Timeout;
89+
using Ticker = mbed::Ticker;
90+
#endif
91+
7892
#if BLE_FEATURE_PRIVACY
7993
#if BLE_ROLE_BROADCASTER
8094
/**
@@ -927,9 +941,9 @@ class Gap :
927941
ConnectionParameters *_connect_to_host_resolved_address_parameters = nullptr;
928942
#endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION
929943

930-
mbed::LowPowerTimeout _advertising_timeout;
931-
mbed::LowPowerTimeout _scan_timeout;
932-
mbed::LowPowerTicker _address_rotation_ticker;
944+
Timeout _advertising_timeout;
945+
Timeout _scan_timeout;
946+
Ticker _address_rotation_ticker;
933947

934948
bool _initiating = false;
935949

connectivity/FEATURE_BLE/source/generic/PrivateAddressController.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@
2222

2323
#include <cstdio>
2424

25-
#include "drivers/LowPowerTicker.h"
2625
#include "ble/common/BLETypes.h"
2726
#include "ble/common/blecommon.h"
2827
#include "source/pal/PalEventQueue.h"
2928
#include "source/pal/PalPrivateAddressController.h"
3029

30+
#ifdef DEVICE_LPTICKER
31+
#include "drivers/LowPowerTicker.h"
32+
#else
33+
#include "drivers/Ticker.h"
34+
#endif
35+
3136
namespace ble {
3237

3338
/**
@@ -38,6 +43,12 @@ namespace ble {
3843
*/
3944
class PrivateAddressController : private PalPrivateAddressController::EventHandler {
4045
public:
46+
#ifdef DEVICE_LPTICKER
47+
using Ticker = mbed::LowPowerTicker;
48+
#else
49+
using Ticker = mbed::Ticker;
50+
#endif
51+
4152
struct EventHandler {
4253
/**
4354
* Called when a new resolvable private address has been generated.
@@ -313,7 +324,7 @@ class PrivateAddressController : private PalPrivateAddressController::EventHandl
313324
bool _generation_started;
314325
irk_t _local_irk = {};
315326
EventHandler *_event_handler = nullptr;
316-
mbed::LowPowerTicker _address_rotation_ticker;
327+
Ticker _address_rotation_ticker;
317328
address_t _resolvable_address = {};
318329
address_t _non_resolvable_address = {};
319330

0 commit comments

Comments
 (0)