91
91
#define AD_TYPE_COMPLETE_LOCAL_NAME (0x09 )
92
92
93
93
94
-
95
- #ifdef ARDUINO_NUCLEO_F401RE
96
- #define STM32_UUID ((uint32_t *)0x1FFF7A10 )
97
- #endif
98
-
99
- #ifdef ARDUINO_NUCLEO_L476RG
100
- #define STM32_UUID ((uint32_t *)0x1FFF7590 )
101
- #endif
102
-
103
- #ifdef ARDUINO_NUCLEO_L053R8
104
- #define STM32_UUID ((uint32_t *)0x1FF8007C )
105
- #endif
106
-
107
- #ifdef ARDUINO_NUCLEO_L152RE
108
- #define STM32_UUID ((uint32_t *)0x1FF80050 )
109
- #endif
110
-
111
-
112
- /* BlueNRG Board Type */
113
- #define IDB04A1 0
114
- #define IDB05A1 1
115
-
116
- /* Mems Board Type */
117
- #define IKS01A1 0
118
- #define IKS01A2 1
119
-
120
94
/* SPI Configuration*/
121
95
#define IDB0XA1_PIN_SPI_MOSI (11 )
122
96
#define IDB0XA1_PIN_SPI_MISO (12 )
@@ -189,34 +163,21 @@ class Flight1Service
189
163
BlueNRG_RST ();
190
164
/* get the BlueNRG HW and FW versions */
191
165
getBlueNRGVersion (&hwVersion, &fwVersion);
192
- if (hwVersion > 0x30 ) {
193
- /* X-NUCLEO-IDB05A1 expansion board is used */
194
- bnrg_expansion_board = IDB05A1;
195
- } else {
196
- /* X-NUCLEO-IDB0041 expansion board is used */
197
- bnrg_expansion_board = IDB04A1;
198
- }
166
+
199
167
BlueNRG_RST ();
200
168
201
169
/* Generate MAC Address*/
202
- bdaddr[0 ] = (STM32_UUID[1 ]>>24 )&0xFF ;
203
- bdaddr[1 ] = (STM32_UUID[0 ] )&0xFF ;
204
- bdaddr[2 ] = (STM32_UUID[2 ] >>8 )&0xFF ;
205
- bdaddr[3 ] = (STM32_UUID[0 ]>>16 )&0xFF ;
206
- bdaddr[4 ] = (hwVersion > 0x30 ) ?
207
- ((((FLIGHT1_VERSION_MAJOR-48 )*10 ) + (FLIGHT1_VERSION_MINOR-48 )+100 )&0xFF ) :
208
- ((((FLIGHT1_VERSION_MAJOR-48 )*10 ) + (FLIGHT1_VERSION_MINOR-48 ) )&0xFF ) ;
209
- bdaddr[5 ] = 0xC0 ; /* for a Legal BLE Random MAC */
170
+ uint8_t data_len_out;
171
+ ret = aci_hal_read_config_data (CONFIG_DATA_RANDOM_ADDRESS, 6 , &data_len_out, bdaddr);
172
+
210
173
ret = aci_gatt_init ();
211
174
if (ret){
212
175
FLIGHT1_PRINTF (" \r\n GATT_Init failed\r\n " );
213
176
goto fail;
214
177
}
215
- if (bnrg_expansion_board == IDB05A1) {
216
- ret = aci_gap_init_IDB05A1 (GAP_PERIPHERAL_ROLE_IDB05A1, 0 , 0x07 , &service_handle, &dev_name_char_handle, &appearance_char_handle);
217
- }else {
218
- ret = aci_gap_init_IDB04A1 (GAP_PERIPHERAL_ROLE_IDB04A1, &service_handle, &dev_name_char_handle, &appearance_char_handle);
219
- }
178
+
179
+ ret = aci_gap_init_IDB05A1 (GAP_PERIPHERAL_ROLE_IDB05A1, 0 , 0x07 , &service_handle, &dev_name_char_handle, &appearance_char_handle);
180
+
220
181
if (ret != BLE_STATUS_SUCCESS){
221
182
FLIGHT1_PRINTF (" \r\n GAP_Init failed\r\n " );
222
183
goto fail;
@@ -254,7 +215,7 @@ class Flight1Service
254
215
hwVersion,
255
216
fwVersion>>8 ,
256
217
(fwVersion>>4 )&0xF ,
257
- (hwVersion > 0x30 ) ? ( ' a' +(fwVersion&0xF )-1 ) : ' a ' ,
218
+ (' a' +(fwVersion&0xF )-1 ),
258
219
BoardName,
259
220
bdaddr[5 ],bdaddr[4 ],bdaddr[3 ],bdaddr[2 ],bdaddr[1 ],bdaddr[0 ]);
260
221
@@ -503,7 +464,7 @@ class Flight1Service
503
464
return BLE_STATUS_SUCCESS;
504
465
505
466
fail:
506
- // FLIGHT1_PRINTF("Error while adding HW's Characteristcs service.\n");
467
+ FLIGHT1_PRINTF (" Error while adding HW's Characteristcs service.\n " );
507
468
return BLE_STATUS_ERROR;
508
469
}
509
470
@@ -512,7 +473,6 @@ class Flight1Service
512
473
513
474
514
475
/* Private variables*/
515
- uint8_t bnrg_expansion_board;
516
476
uint8_t bdaddr[6 ];
517
477
uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
518
478
uint32_t PinForParing;
@@ -617,12 +577,6 @@ LSM303AGR_MAG_Sensor *Mag;
617
577
void SetupSingleShot (VL53L1_X_NUCLEO_53L1A1 *sensor){
618
578
int status;
619
579
620
- // First set high timing value in order to change distance mode
621
- status = sensor->VL53L1X_SetTimingBudgetInMs (100 );
622
- if ( status ){
623
- SerialPort.println (" SetMeasurementTimingBudgetMicroSeconds 1 failed" );
624
- }
625
-
626
580
// Change distance mode to short range
627
581
status = sensor->VL53L1X_SetDistanceMode (1 );
628
582
if ( status ){
0 commit comments