Skip to content

Commit d952a0f

Browse files
authored
Merge pull request stm32duino#18 from cparata/master
Add support to X-NUCLEO-IDB05A2
2 parents 61138fc + 0d936a4 commit d952a0f

File tree

12 files changed

+95
-26
lines changed

12 files changed

+95
-26
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# STM32duinoBLE
22

33
This library is a fork of ArduinoBLE library to add the support of SPBTLE-RF and SPBTLE-1S BLE modules.
4-
It was successfully tested with the X-NUCLEO-IDB05A1 or X-NUCLEO-BNRG2A1 expansion board and a NUCLEO-F401RE
4+
It was successfully tested with the X-NUCLEO-IDB05A2 or X-NUCLEO-IDB05A1 or X-NUCLEO-BNRG2A1 expansion board and a NUCLEO-F401RE
55
or NUCLEO-L476RG or NUCLEO-L053R8, with B-L475E-IOT01A and with STEVAL-MKSBOX1V1.
66
In order to use this library with STEVAL-MKSBOX1V1, you need to update the firmware of the SPBTLE-1S BLE module
77
mounted on that board as described in the following wiki page:

Diff for: examples/Central/LedControl/LedControl.ino

+12-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000,
2929
BLELocalDevice BLE(&HCISpiTransport);
3030
const int buttonPin = PC13; // set buttonPin to digital pin PC13
3131
#else
32-
/* Shield IDB05A1 with SPI clock on D3 */
32+
/* Shield IDB05A2 with SPI clock on D3 */
3333
SPIClass SpiHCI(D11, D12, D3);
34-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
34+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3535
BLELocalDevice BLE(&HCISpiTransport);
3636
const int buttonPin = PC13; // set buttonPin to digital pin PC13
37+
/* Shield IDB05A2 with SPI clock on D13 */
38+
/*#define SpiHCI SPI
39+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
40+
BLELocalDevice BLE(&HCISpiTransport);
41+
const int buttonPin = PC13; // set buttonPin to digital pin PC13 */
42+
/* Shield IDB05A1 with SPI clock on D3 */
43+
/*SPIClass SpiHCI(D11, D12, D3);
44+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
45+
BLELocalDevice BLE(&HCISpiTransport);
46+
const int buttonPin = PC13; // set buttonPin to digital pin PC13 */
3747
/* Shield IDB05A1 with SPI clock on D13 */
3848
/*#define SpiHCI SPI
3949
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Central/PeripheralExplorer/PeripheralExplorer.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@ SPIClass SpiHCI(PC12, PC11, PC10);
2626
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
2727
BLELocalDevice BLE(&HCISpiTransport);
2828
#else
29-
/* Shield IDB05A1 with SPI clock on D3 */
29+
/* Shield IDB05A2 with SPI clock on D3 */
3030
SPIClass SpiHCI(D11, D12, D3);
31-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
31+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3232
BLELocalDevice BLE(&HCISpiTransport);
33+
/* Shield IDB05A2 with SPI clock on D13 */
34+
/*#define SpiHCI SPI
35+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
36+
BLELocalDevice BLE(&HCISpiTransport); */
37+
/* Shield IDB05A1 with SPI clock on D3 */
38+
/*SPIClass SpiHCI(D11, D12, D3);
39+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
40+
BLELocalDevice BLE(&HCISpiTransport); */
3341
/* Shield IDB05A1 with SPI clock on D13 */
3442
/*#define SpiHCI SPI
3543
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Central/Scan/Scan.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@ SPIClass SpiHCI(PC12, PC11, PC10);
2323
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
2424
BLELocalDevice BLE(&HCISpiTransport);
2525
#else
26-
/* Shield IDB05A1 with SPI clock on D3 */
26+
/* Shield IDB05A2 with SPI clock on D3 */
2727
SPIClass SpiHCI(D11, D12, D3);
28-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
28+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
2929
BLELocalDevice BLE(&HCISpiTransport);
30+
/* Shield IDB05A2 with SPI clock on D13 */
31+
/*#define SpiHCI SPI
32+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
33+
BLELocalDevice BLE(&HCISpiTransport); */
34+
/* Shield IDB05A1 with SPI clock on D3 */
35+
/*SPIClass SpiHCI(D11, D12, D3);
36+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
37+
BLELocalDevice BLE(&HCISpiTransport); */
3038
/* Shield IDB05A1 with SPI clock on D13 */
3139
/*#define SpiHCI SPI
3240
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Central/ScanCallback/ScanCallback.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,18 @@ SPIClass SpiHCI(PC12, PC11, PC10);
2525
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
2626
BLELocalDevice BLE(&HCISpiTransport);
2727
#else
28-
/* Shield IDB05A1 with SPI clock on D3 */
28+
/* Shield IDB05A2 with SPI clock on D3 */
2929
SPIClass SpiHCI(D11, D12, D3);
30-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
30+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3131
BLELocalDevice BLE(&HCISpiTransport);
32+
/* Shield IDB05A2 with SPI clock on D13 */
33+
/*#define SpiHCI SPI
34+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
35+
BLELocalDevice BLE(&HCISpiTransport); */
36+
/* Shield IDB05A1 with SPI clock on D3 */
37+
/*SPIClass SpiHCI(D11, D12, D3);
38+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
39+
BLELocalDevice BLE(&HCISpiTransport); */
3240
/* Shield IDB05A1 with SPI clock on D13 */
3341
/*#define SpiHCI SPI
3442
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Central/SensorTagButton/SensorTagButton.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@ SPIClass SpiHCI(PC12, PC11, PC10);
2727
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
2828
BLELocalDevice BLE(&HCISpiTransport);
2929
#else
30-
/* Shield IDB05A1 with SPI clock on D3 */
30+
/* Shield IDB05A2 with SPI clock on D3 */
3131
SPIClass SpiHCI(D11, D12, D3);
32-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
32+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3333
BLELocalDevice BLE(&HCISpiTransport);
34+
/* Shield IDB05A2 with SPI clock on D13 */
35+
/*#define SpiHCI SPI
36+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
37+
BLELocalDevice BLE(&HCISpiTransport); */
38+
/* Shield IDB05A1 with SPI clock on D3 */
39+
/*SPIClass SpiHCI(D11, D12, D3);
40+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
41+
BLELocalDevice BLE(&HCISpiTransport); */
3442
/* Shield IDB05A1 with SPI clock on D13 */
3543
/*#define SpiHCI SPI
3644
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Peripheral/ButtonLED/ButtonLED.ino

+12-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,21 @@ HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000,
3030
BLELocalDevice BLE(&HCISpiTransport);
3131
const int buttonPin = PC13; // set buttonPin to digital pin PC13
3232
#else
33-
/* Shield IDB05A1 with SPI clock on D3 */
33+
/* Shield IDB05A2 with SPI clock on D3 */
3434
SPIClass SpiHCI(D11, D12, D3);
35-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
35+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3636
BLELocalDevice BLE(&HCISpiTransport);
3737
const int buttonPin = PC13; // set buttonPin to digital pin PC13
38+
/* Shield IDB05A2 with SPI clock on D13 */
39+
/*#define SpiHCI SPI
40+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
41+
BLELocalDevice BLE(&HCISpiTransport);
42+
const int buttonPin = PC13; // set buttonPin to digital pin PC13 */
43+
/* Shield IDB05A1 with SPI clock on D3 */
44+
/*SPIClass SpiHCI(D11, D12, D3);
45+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
46+
BLELocalDevice BLE(&HCISpiTransport);
47+
const int buttonPin = PC13; // set buttonPin to digital pin PC13 */
3848
/* Shield IDB05A1 with SPI clock on D13 */
3949
/*#define SpiHCI SPI
4050
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Peripheral/CallbackLED/CallbackLED.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ SPIClass SpiHCI(PC12, PC11, PC10);
2828
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
2929
BLELocalDevice BLE(&HCISpiTransport);
3030
#else
31-
/* Shield IDB05A1 with SPI clock on D3 */
31+
/* Shield IDB05A2 with SPI clock on D3 */
3232
SPIClass SpiHCI(D11, D12, D3);
33-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
33+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3434
BLELocalDevice BLE(&HCISpiTransport);
35+
/* Shield IDB05A2 with SPI clock on D13 */
36+
/*#define SpiHCI SPI
37+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
38+
BLELocalDevice BLE(&HCISpiTransport); */
39+
/* Shield IDB05A1 with SPI clock on D3 */
40+
/*SPIClass SpiHCI(D11, D12, D3);
41+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
42+
BLELocalDevice BLE(&HCISpiTransport); */
3543
/* Shield IDB05A1 with SPI clock on D13 */
3644
/*SPIClass SpiHCI(D11, D12, D13);
3745
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: examples/Peripheral/LED/LED.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@ SPIClass SpiHCI(PC12, PC11, PC10);
2626
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
2727
BLELocalDevice BLE(&HCISpiTransport);
2828
#else
29-
/* Shield IDB05A1 with SPI clock on D3 */
29+
/* Shield IDB05A2 with SPI clock on D3 */
3030
SPIClass SpiHCI(D11, D12, D3);
31-
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
31+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
3232
BLELocalDevice BLE(&HCISpiTransport);
33+
/* Shield IDB05A2 with SPI clock on D13 */
34+
/*#define SpiHCI SPI
35+
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
36+
BLELocalDevice BLE(&HCISpiTransport); */
37+
/* Shield IDB05A1 with SPI clock on D3 */
38+
/*SPIClass SpiHCI(D11, D12, D3);
39+
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
40+
BLELocalDevice BLE(&HCISpiTransport); */
3341
/* Shield IDB05A1 with SPI clock on D13 */
3442
/*#define SpiHCI SPI
3543
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);

Diff for: library.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name=STM32duinoBLE
2-
version=1.2.1
2+
version=1.3.0
33
author=Arduino, SRA
44
maintainer=stm32duino
5-
sentence=Fork of ArduinoBLE library to add the support of SPBTLE-RF and SPBTLE-1S BLE modules.
5+
sentence=Fork of ArduinoBLE library to add the support of SPBTLE-RF, SPBTLE-1S, BLUENRG-M2SP and BLUENRG-M0 BLE modules.
66
paragraph=This library supports creating a BLE peripheral and BLE central mode.
77
category=Communication
88
url=https://github.com/stm32duino/STM32duinoBLE

Diff for: src/utility/HCISpiTransport.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int HCISpiTransportClass::begin()
6666
digitalWrite(_ble_rst, HIGH);
6767
delay(5);
6868

69-
if (_ble_chip == SPBTLE_RF)
69+
if (_ble_chip == SPBTLE_RF || _ble_chip == BLUENRG_M0)
7070
{
7171
// Wait for Blue Initialize
7272
wait_for_blue_initialize();
@@ -102,7 +102,7 @@ void HCISpiTransportClass::wait(unsigned long timeout)
102102

103103
int HCISpiTransportClass::available()
104104
{
105-
if(_ble_chip != SPBTLE_RF && _ble_chip !=SPBTLE_1S && _ble_chip !=BLUENRG_M2SP)
105+
if(_ble_chip != SPBTLE_RF && _ble_chip != SPBTLE_1S && _ble_chip != BLUENRG_M2SP && _ble_chip != BLUENRG_M0)
106106
{
107107
return 0;
108108
}
@@ -137,7 +137,7 @@ int HCISpiTransportClass::available()
137137
/* Write the header */
138138
_spi->transfer(header_master, 5);
139139

140-
if (_ble_chip == SPBTLE_RF)
140+
if (_ble_chip == SPBTLE_RF || _ble_chip == BLUENRG_M0)
141141
{
142142
/* device is ready */
143143
if(header_master[0] == 0x02)
@@ -262,7 +262,7 @@ int HCISpiTransportClass::available()
262262

263263
if(ble_reset)
264264
{
265-
if (_ble_chip == SPBTLE_RF)
265+
if (_ble_chip == SPBTLE_RF || _ble_chip == BLUENRG_M0)
266266
{
267267
/* BLE chip was reset: we need to enable LL_ONLY */
268268
enable_ll_only();
@@ -330,14 +330,14 @@ size_t HCISpiTransportClass::write(const uint8_t* data, size_t length)
330330
int result = 0;
331331
uint32_t tickstart = millis();
332332

333-
if(_ble_chip != SPBTLE_RF && _ble_chip !=SPBTLE_1S && _ble_chip !=BLUENRG_M2SP)
333+
if(_ble_chip != SPBTLE_RF && _ble_chip != SPBTLE_1S && _ble_chip != BLUENRG_M2SP && _ble_chip != BLUENRG_M0)
334334
{
335335
return 0;
336336
}
337337

338338
do
339339
{
340-
if (_ble_chip == SPBTLE_RF)
340+
if (_ble_chip == SPBTLE_RF || _ble_chip == BLUENRG_M0)
341341
{
342342
result = 0;
343343

Diff for: src/utility/HCISpiTransport.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
typedef enum BLEChip_s {
2727
SPBTLE_RF,
2828
SPBTLE_1S,
29-
BLUENRG_M2SP
29+
BLUENRG_M2SP,
30+
BLUENRG_M0
3031
} BLEChip_t;
3132

3233
#ifndef BLE_SPI_BYTE_ORDER

0 commit comments

Comments
 (0)