@@ -75,15 +75,15 @@ int HCISpiTransportClass::begin()
75
75
digitalWrite (_ble_rst, HIGH);
76
76
delay (5 );
77
77
78
- #if defined(STBTLE_RF )
78
+ #if defined(SPBTLE_RF )
79
79
// Wait for Blue Initialize
80
80
wait_for_blue_initialize ();
81
- #endif /* STBTLE_RF */
81
+ #endif /* SPBTLE_RF */
82
82
83
- #if defined(STBTLE_1S )
83
+ #if defined(SPBTLE_1S )
84
84
// Wait a while for the reset of the BLE module
85
85
delay (300 );
86
- #endif /* STBTLE_1S */
86
+ #endif /* SPBTLE_1S */
87
87
88
88
return 1 ;
89
89
}
@@ -132,11 +132,11 @@ int HCISpiTransportClass::available()
132
132
/* Write the header */
133
133
_spi->transfer (header_master, 5 );
134
134
135
- #if defined(STBTLE_RF )
135
+ #if defined(SPBTLE_RF )
136
136
/* device is ready */
137
137
if (header_master[0 ] == 0x02 )
138
138
{
139
- #endif /* STBTLE_RF */
139
+ #endif /* SPBTLE_RF */
140
140
uint16_t byte_count = (header_master[4 ] << 8 ) | header_master[3 ];
141
141
142
142
if (byte_count > 0 )
@@ -156,7 +156,7 @@ int HCISpiTransportClass::available()
156
156
_write_index_initial++;
157
157
}
158
158
159
- #if defined(STBTLE_RF )
159
+ #if defined(SPBTLE_RF )
160
160
/* Check if the message is a Blue Initialize */
161
161
/* If so we need to send the command to enable LL_ONLY */
162
162
if (byte_count == 6 )
@@ -171,8 +171,8 @@ int HCISpiTransportClass::available()
171
171
ble_reset = 1 ;
172
172
}
173
173
}
174
- #endif /* STBTLE_RF */
175
- #if defined(STBTLE_1S )
174
+ #endif /* SPBTLE_RF */
175
+ #if defined(SPBTLE_1S )
176
176
/* Check if the message is a CMD_COMPLETE */
177
177
/* We suppose that the first CMD is always a HCI_RESET */
178
178
if (byte_count == 7 )
@@ -188,7 +188,7 @@ int HCISpiTransportClass::available()
188
188
ble_reset = 1 ;
189
189
}
190
190
}
191
- #endif /* STBTLE_1S */
191
+ #endif /* SPBTLE_1S */
192
192
} else
193
193
{
194
194
/* avoid to read more data that available size of the buffer */
@@ -207,9 +207,9 @@ int HCISpiTransportClass::available()
207
207
}
208
208
}
209
209
}
210
- #if defined(STBTLE_RF )
210
+ #if defined(SPBTLE_RF )
211
211
}
212
- #endif /* STBTLE_RF */
212
+ #endif /* SPBTLE_RF */
213
213
214
214
digitalWrite (_cs_pin, HIGH);
215
215
@@ -218,15 +218,15 @@ int HCISpiTransportClass::available()
218
218
219
219
if (ble_reset)
220
220
{
221
- #if defined(STBTLE_RF )
221
+ #if defined(SPBTLE_RF )
222
222
/* BLE chip was reset: we need to enable LL_ONLY */
223
223
enable_ll_only ();
224
224
wait_for_enable_ll_only ();
225
- #endif /* STBTLE_RF */
226
- #if defined(STBTLE_1S )
225
+ #endif /* SPBTLE_RF */
226
+ #if defined(SPBTLE_1S )
227
227
/* BLE chip was reset: we need to wait for a while */
228
228
delay (300 );
229
- #endif /* STBTLE_1S */
229
+ #endif /* SPBTLE_1S */
230
230
231
231
/* Now we can update the write index and close the initial phase */
232
232
_write_index = _write_index_initial;
@@ -287,16 +287,16 @@ size_t HCISpiTransportClass::write(const uint8_t* data, size_t length)
287
287
288
288
do
289
289
{
290
- #if defined(STBTLE_1S )
290
+ #if defined(SPBTLE_1S )
291
291
uint32_t tickstart_data_available = millis ();
292
- #endif /* STBTLE_1S */
292
+ #endif /* SPBTLE_1S */
293
293
result = 0 ;
294
294
295
295
_spi->beginTransaction (SPISettings (_frequency, MSBFIRST, _spi_mode));
296
296
297
297
digitalWrite (_cs_pin, LOW);
298
298
299
- #if defined(STBTLE_1S )
299
+ #if defined(SPBTLE_1S )
300
300
/*
301
301
* Wait until BlueNRG-1 is ready.
302
302
* When ready it will raise the IRQ pin.
@@ -316,33 +316,33 @@ size_t HCISpiTransportClass::write(const uint8_t* data, size_t length)
316
316
_spi->endTransaction ();
317
317
break ;
318
318
}
319
- #endif /* STBTLE_1S */
319
+ #endif /* SPBTLE_1S */
320
320
321
321
/* Write the header */
322
322
_spi->transfer (header_master, 5 );
323
323
324
- #if defined(STBTLE_RF )
324
+ #if defined(SPBTLE_RF )
325
325
/* device is ready */
326
326
if (header_master[0 ] == 0x02 )
327
327
{
328
328
if (header_master[1 ] >= length)
329
- #endif /* STBTLE_RF */
330
- #if defined(STBTLE_1S )
329
+ #endif /* SPBTLE_RF */
330
+ #if defined(SPBTLE_1S )
331
331
if ((int )((((uint16_t )header_master[2 ])<<8 ) | ((uint16_t )header_master[1 ])) >= (int )length)
332
- #endif /* STBTLE_1S */
332
+ #endif /* SPBTLE_1S */
333
333
{
334
334
/* Write the data */
335
335
_spi->transfer (my_data, length);
336
336
} else
337
337
{
338
338
result = -2 ;
339
339
}
340
- #if defined(STBTLE_RF )
340
+ #if defined(SPBTLE_RF )
341
341
} else
342
342
{
343
343
result = -1 ;
344
344
}
345
- #endif /* STBTLE_RF */
345
+ #endif /* SPBTLE_RF */
346
346
347
347
digitalWrite (_cs_pin, HIGH);
348
348
@@ -364,7 +364,7 @@ size_t HCISpiTransportClass::write(const uint8_t* data, size_t length)
364
364
}
365
365
}
366
366
367
- #if defined(STBTLE_RF )
367
+ #if defined(SPBTLE_RF )
368
368
void HCISpiTransportClass::wait_for_blue_initialize ()
369
369
{
370
370
int event_blue_initialize = 0 ;
@@ -535,7 +535,7 @@ void HCISpiTransportClass::enable_ll_only()
535
535
_spi->endTransaction ();
536
536
} while (result < 0 );
537
537
}
538
- #endif /* STBTLE_RF */
538
+ #endif /* SPBTLE_RF */
539
539
540
540
#if defined(ARDUINO_STEVAL_MKSBOX1V1)
541
541
HCISpiTransportClass HCISpiTransport (SpiHCI, PD0, PD4, PA8, 1000000 , SPI_MODE1); /* STEVAL_MKSBOX1V1 */
0 commit comments