Skip to content

Commit 50769d2

Browse files
author
Donatien Garnier
authored
Merge pull request ARMmbed#245 from paul-szczepanek-arm/master
Fix name of template for IAR
2 parents c026024 + f084976 commit 50769d2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

BLE_GAP/source/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static const DemoScanParam_t scanning_params[] = {
8686

8787
/* helper that gets the number of items in arrays */
8888
template<class T, size_t N>
89-
size_t size(const T (&)[N])
89+
size_t arraysize(const T (&)[N])
9090
{
9191
return N;
9292
}
@@ -107,7 +107,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
107107
_on_duration_end_id(0),
108108
_scan_count(0),
109109
_blink_event(0) {
110-
for (uint8_t i = 0; i < size(_adv_handles); ++i) {
110+
for (uint8_t i = 0; i < arraysize(_adv_handles); ++i) {
111111
_adv_handles[i] = ble::INVALID_ADVERTISING_HANDLE;
112112
}
113113
}
@@ -268,7 +268,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
268268
/* how many sets */
269269
uint8_t max_adv_set = std::min(
270270
_gap.getMaxAdvertisingSetNumber(),
271-
(uint8_t) size(_adv_handles)
271+
(uint8_t) arraysize(_adv_handles)
272272
);
273273

274274
/* one advertising set is reserved for legacy advertising */
@@ -315,7 +315,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
315315
/* set different name for each set */
316316
MBED_ASSERT(i < 9);
317317
char device_name[] = "Advertiser x";
318-
snprintf(device_name, size(device_name), "Advertiser %d", i%10);
318+
snprintf(device_name, arraysize(device_name), "Advertiser %d", i%10);
319319
error = adv_data_builder.setName(device_name);
320320
if (error) {
321321
print_error(error, "AdvertisingDataBuilder::setName() failed");
@@ -601,7 +601,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
601601

602602
/* switch between advertising and scanning when we go
603603
* through all the params in the array */
604-
if (_set_index >= (_is_in_scanning_mode ? size(scanning_params) : size(advertising_params))) {
604+
if (_set_index >= (_is_in_scanning_mode ? arraysize(scanning_params) : arraysize(advertising_params))) {
605605
_set_index = 0;
606606
_is_in_scanning_mode = !_is_in_scanning_mode;
607607
}
@@ -636,7 +636,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
636636
void end_extended_advertising()
637637
{
638638
/* iterate over the advertising handles */
639-
for (uint8_t i = 0; i < size(_adv_handles); ++i) {
639+
for (uint8_t i = 0; i < arraysize(_adv_handles); ++i) {
640640
/* check if the set has been sucesfully created */
641641
if (_adv_handles[i] == ble::INVALID_ADVERTISING_HANDLE) {
642642
continue;
@@ -691,7 +691,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
691691
uint16_t duration_ms = _demo_duration.read_ms();
692692
uint8_t number_of_active_sets = 0;
693693

694-
for (uint8_t i = 0; i < size(_adv_handles); ++i) {
694+
for (uint8_t i = 0; i < arraysize(_adv_handles); ++i) {
695695
if (_adv_handles[i] != ble::INVALID_ADVERTISING_HANDLE) {
696696
if (_gap.isAdvertisingActive(_adv_handles[i])) {
697697
number_of_active_sets++;

0 commit comments

Comments
 (0)