Skip to content

Commit 55760a4

Browse files
committed
add Scanner resume()
1 parent 2b229f4 commit 55760a4

File tree

9 files changed

+29
-23
lines changed

9 files changed

+29
-23
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
This repository contains the Arduino BSP for Adafruit nRF52 series:
44

55
- [Bluefruit Feather nRF52832](https://www.adafruit.com/product/3406)
6+
- Bluefruit Feather nRF52840 Express (coming soon)
7+
- [Noric nRF52840DK PCA10056](https://www.nordicsemi.com/eng/Products/nRF52840-DK)
68

79
## BSP Installation
810

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Added nRF52840-based board support (pca10056 and feather nRF52840 express)
66
- Upgrade bootloader to v6.1.0 ( single bank only )
77
- Upgrade BSP code to match SD v6
8-
- Bluefruit.Scanner.start() must be called (often in callback) to resume scanning after received an report.
8+
- Bluefruit.Scanner.resume() must be called in scan callback to resume scanning after received an report.
99
- Upgrade freeRTOS from v8 to v10.0.1
1010
- Upgrade Segger SysView to 2.52d
1111
- Added nrfx to core

libraries/Bluefruit52Lib/examples/Central/central_bleuart/central_bleuart.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
7878
}else
7979
{
8080
// For Softdevice v6: after received a report, scanner will be paused
81-
// We need to call Scanner start() to resume scanning
82-
Bluefruit.Scanner.start();
81+
// We need to call Scanner resume() to continue scanning
82+
Bluefruit.Scanner.resume();
8383
}
8484
}
8585

libraries/Bluefruit52Lib/examples/Central/central_scan/central_scan.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
6363
Serial.println();
6464

6565
// For Softdevice v6: after received a report, scanner will be paused
66-
// We need to call Scanner start() to resume scanning
67-
Bluefruit.Scanner.start();
66+
// We need to call Scanner resume() to continue scanning
67+
Bluefruit.Scanner.resume();
6868
}
6969

7070
void loop()

libraries/Bluefruit52Lib/examples/Central/central_scan_advanced/central_scan_advanced.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
181181
Serial.println();
182182

183183
// For Softdevice v6: after received a report, scanner will be paused
184-
// We need to call Scanner start() to resume scanning
185-
Bluefruit.Scanner.start();
184+
// We need to call Scanner resume() to continue scanning
185+
Bluefruit.Scanner.resume();
186186
}
187187

188188
void printUuid16List(uint8_t* buffer, uint8_t len)

libraries/Bluefruit52Lib/examples/Central/central_ti_sensortag_optical/central_ti_sensortag_optical.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,16 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
144144
else
145145
{
146146
Serial.println("No Match");
147-
Bluefruit.Scanner.start(); // continue scanning
147+
Bluefruit.Scanner.resume(); // continue scanning
148148
}
149149
}
150150
else
151151
{
152152
Serial.println("Failed");
153153

154154
// For Softdevice v6: after received a report, scanner will be paused
155-
// We need to call Scanner start() to resume scanning
156-
Bluefruit.Scanner.start();
155+
// We need to call Scanner resume() to continue scanning
156+
Bluefruit.Scanner.resume();
157157
}
158158
}
159159

libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
364364

365365
Serial.println();
366366
#endif
367+
368+
// For Softdevice v6: after received a report, scanner will be paused
369+
// We need to call Scanner resume() to continue scanning
370+
Bluefruit.Scanner.resume();
367371
}
368372

369373
#if ENABLE_TFT

libraries/Bluefruit52Lib/src/BLEScanner.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,23 @@ bool BLEScanner::start(uint16_t timeout)
118118
_report_data.p_data = _scan_data;
119119
_report_data.len = BLE_GAP_SCAN_BUFFER_MAX;
120120

121-
if (_runnning)
122-
{
123-
// resume scanning after received an report
124-
VERIFY_STATUS( sd_ble_gap_scan_start(NULL, &_report_data), false );
125-
}else
126-
{
127-
// start a new scan
128-
_param.timeout = timeout;
121+
_param.timeout = timeout;
129122

130-
VERIFY_STATUS( sd_ble_gap_scan_start(&_param, &_report_data), false );
123+
VERIFY_STATUS( sd_ble_gap_scan_start(&_param, &_report_data), false );
131124

132-
Bluefruit._startConnLed(); // start blinking
133-
_runnning = true;
134-
}
125+
Bluefruit._startConnLed(); // start blinking
126+
_runnning = true;
135127

136128
return true;
137129
}
138130

131+
bool BLEScanner::resume(void)
132+
{
133+
// resume scanning after received an report
134+
VERIFY_STATUS( sd_ble_gap_scan_start(NULL, &_report_data), false );
135+
return true;
136+
}
137+
139138
bool BLEScanner::stop(void)
140139
{
141140
VERIFY_STATUS( sd_ble_gap_scan_stop(), false );
@@ -377,7 +376,7 @@ void BLEScanner::_eventHandler(ble_evt_t* evt)
377376
}else
378377
{
379378
// continue scanning since report is filtered and callback is not invoked
380-
VERIFY_STATUS( sd_ble_gap_scan_start(NULL, &_report_data), );
379+
this->resume();
381380
}
382381
}
383382
break;

libraries/Bluefruit52Lib/src/BLEScanner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class BLEScanner
7474
void clearFilters(void);
7575

7676
bool start(uint16_t timeout = 0);
77+
bool resume(void);
7778
bool stop(void);
7879

7980
/*------------- Callbacks -------------*/

0 commit comments

Comments
 (0)