Sample program for 3 sensors using polling in autonomous mode.

Dependencies:   X_NUCLEO_53L1A2

Committer:
johnAlexander
Date:
Fri Jun 18 10:23:52 2021 +0000
Revision:
12:140677759b2c
Parent:
10:2da1507fa8c2
Child:
13:a7113560e4cd
Initial release, using VL53L1 sensor class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
charlesmn 0:020912dfa221 1 /*
johnAlexander 5:b233bdf91671 2 * This VL53L1CB Expansion board test application performs range measurements
johnAlexander 8:ac303cd2d35f 3 * using the onboard embedded sensor, in polling mode.
johnAlexander 2:f0ec92af4b5f 4 * Measured ranges are ouput on the Serial Port, running at 115200 baud.
charlesmn 0:020912dfa221 5 *
johnAlexander 5:b233bdf91671 6 * This is designed to work with MBed v2.x, & MBedOS v5.x / v6.x.
johnAlexander 5:b233bdf91671 7 *
johnAlexander 5:b233bdf91671 8 * The Reset button can be used to restart the program.
charlesmn 0:020912dfa221 9 *
johnAlexander 5:b233bdf91671 10 * *** NOTE :
johnAlexander 5:b233bdf91671 11 * Default Mbed build system settings disable printf() floating-point support.
johnAlexander 5:b233bdf91671 12 * Offline builds can enable this, again.
johnAlexander 5:b233bdf91671 13 * https://github.com/ARMmbed/mbed-os/blob/master/platform/source/minimal-printf/README.md
johnAlexander 5:b233bdf91671 14 * .\mbed-os\platform\mbed_lib.json
charlesmn 0:020912dfa221 15 *
johnAlexander 5:b233bdf91671 16 * *** NOTE : By default hardlinks U10, U11, U15 & U18, on the underside of
johnAlexander 5:b233bdf91671 17 * the X-NUCELO-53L1A1 expansion board are not made/OFF.
johnAlexander 5:b233bdf91671 18 * These links must be made to allow interrupts from the Satellite boards
johnAlexander 5:b233bdf91671 19 * to be received.
johnAlexander 5:b233bdf91671 20 * U11 and U18 must be made/ON to allow interrupts to be received from the
johnAlexander 5:b233bdf91671 21 * INT_L & INT_R positions; or
johnAlexander 5:b233bdf91671 22 * U10 and U15 must be made/ON to allow interrupts to be received from the
johnAlexander 5:b233bdf91671 23 * Alternate INT_L & INT_R positions.
johnAlexander 5:b233bdf91671 24 * The X_NUCLEO_53L1A2 library defaults to use the INT_L/INT_R positions.
johnAlexander 5:b233bdf91671 25 * INT_L is available on expansion board Arduino Connector CN5, pin 1 as D8.
johnAlexander 5:b233bdf91671 26 * Alternate INT_L is on CN5 Connector pin 2 as D9.
johnAlexander 5:b233bdf91671 27 * INT_R is available on expansion board Arduino Connector CN9, pin 3 as D2.
johnAlexander 5:b233bdf91671 28 * Alternate INT_R is on CN9 Connector pin 5 as D4.
johnAlexander 5:b233bdf91671 29 * The pinouts are shown here : https://developer.mbed.org/components/X-NUCLEO-53L1A2/
johnAlexander 2:f0ec92af4b5f 30 *
charlesmn 0:020912dfa221 31 */
johnAlexander 5:b233bdf91671 32
charlesmn 0:020912dfa221 33 #include <stdio.h>
johnAlexander 2:f0ec92af4b5f 34 #include <time.h>
charlesmn 0:020912dfa221 35
charlesmn 0:020912dfa221 36 #include "mbed.h"
johnAlexander 2:f0ec92af4b5f 37
charlesmn 1:ff48a20de191 38 #include "XNucleo53L1A2.h"
charlesmn 0:020912dfa221 39 #include "ToF_I2C.h"
charlesmn 0:020912dfa221 40
charlesmn 0:020912dfa221 41 // i2c comms port pins
johnAlexander 5:b233bdf91671 42 #define I2C_SDA D14
johnAlexander 5:b233bdf91671 43 #define I2C_SCL D15
charlesmn 0:020912dfa221 44
charlesmn 0:020912dfa221 45
charlesmn 0:020912dfa221 46 #define NUM_SENSORS 3
charlesmn 0:020912dfa221 47
johnAlexander 6:19d56b30bfa7 48 // define interrupt pins
johnAlexander 6:19d56b30bfa7 49 PinName CentreIntPin = A2;
johnAlexander 6:19d56b30bfa7 50 // the satellite pins depend on solder blobs on the back of the shield.
johnAlexander 6:19d56b30bfa7 51 // they may not exist or may be one of two sets.
johnAlexander 6:19d56b30bfa7 52 // the centre pin always exists
johnAlexander 7:242f30acc456 53 //PinName LeftIntPin = D8;
johnAlexander 6:19d56b30bfa7 54 PinName RightIntPin = D2;
johnAlexander 6:19d56b30bfa7 55 // alternate set
johnAlexander 7:242f30acc456 56 PinName LeftIntPin = D9;
johnAlexander 6:19d56b30bfa7 57 //PinName RightIntPin = D4;
charlesmn 0:020912dfa221 58
charlesmn 1:ff48a20de191 59 static XNucleo53L1A2 *board=NULL;
charlesmn 0:020912dfa221 60
johnAlexander 5:b233bdf91671 61 #if (MBED_VERSION > 60300)
johnAlexander 5:b233bdf91671 62 UnbufferedSerial pc(USBTX, USBRX);
johnAlexander 5:b233bdf91671 63 extern "C" void wait_ms(int ms);
charlesmn 0:020912dfa221 64 #else
johnAlexander 5:b233bdf91671 65 Serial pc(SERIAL_TX, SERIAL_RX);
charlesmn 0:020912dfa221 66 #endif
charlesmn 0:020912dfa221 67
johnAlexander 3:c1e893e6752f 68 void print_results(int devNumber, VL53L1_MultiRangingData_t *pMultiRangingData );
charlesmn 0:020912dfa221 69
johnAlexander 3:c1e893e6752f 70
johnAlexander 3:c1e893e6752f 71 VL53L1_Dev_t devCentre;
johnAlexander 12:140677759b2c 72 VL53L1_DEV DevC = &devCentre;
johnAlexander 12:140677759b2c 73
johnAlexander 12:140677759b2c 74 VL53L1_Dev_t devLeft;
johnAlexander 12:140677759b2c 75 VL53L1_DEV DevL = &devLeft;
johnAlexander 5:b233bdf91671 76
johnAlexander 12:140677759b2c 77 VL53L1_Dev_t devRight;
johnAlexander 12:140677759b2c 78 VL53L1_DEV DevR = &devRight;
johnAlexander 12:140677759b2c 79
johnAlexander 12:140677759b2c 80 VL53L1 *Sensor;
johnAlexander 4:0ac9998b69ac 81
charlesmn 0:020912dfa221 82
johnAlexander 5:b233bdf91671 83
johnAlexander 3:c1e893e6752f 84 /* flags that handle interrupt request for sensor and user blue button*/
johnAlexander 3:c1e893e6752f 85 volatile bool int_sensor = false;
johnAlexander 3:c1e893e6752f 86 volatile bool int_stop = false;
johnAlexander 3:c1e893e6752f 87
johnAlexander 3:c1e893e6752f 88 /* ISR callback function of the centre sensor */
johnAlexander 3:c1e893e6752f 89 void sensor_irq(void)
johnAlexander 3:c1e893e6752f 90 {
johnAlexander 3:c1e893e6752f 91 int_sensor = true;
johnAlexander 3:c1e893e6752f 92 board->sensor_centre->disable_interrupt_measure_detection_irq();
johnAlexander 3:c1e893e6752f 93 }
johnAlexander 3:c1e893e6752f 94
johnAlexander 3:c1e893e6752f 95 /* Start the sensor ranging */
johnAlexander 3:c1e893e6752f 96 int init_sensor()
johnAlexander 3:c1e893e6752f 97 {
johnAlexander 3:c1e893e6752f 98 int status = 0;
johnAlexander 5:b233bdf91671 99
johnAlexander 12:140677759b2c 100 DevC=&devCentre;
johnAlexander 12:140677759b2c 101 DevC->comms_speed_khz = 400;
johnAlexander 12:140677759b2c 102 DevC->comms_type = 1;
johnAlexander 12:140677759b2c 103 DevC->i2c_slave_address = NEW_SENSOR_CENTRE_ADDRESS;
johnAlexander 12:140677759b2c 104 devCentre.i2c_slave_address = NEW_SENSOR_CENTRE_ADDRESS;
johnAlexander 12:140677759b2c 105 // Sensor=board->sensor_centre;
johnAlexander 5:b233bdf91671 106
johnAlexander 12:140677759b2c 107 DevL=&devLeft;
johnAlexander 12:140677759b2c 108 // Sensor=board->sensor_left;
johnAlexander 4:0ac9998b69ac 109 // configure the sensors
johnAlexander 12:140677759b2c 110 DevL->comms_speed_khz = 400;
johnAlexander 12:140677759b2c 111 DevL->comms_type = 1;
johnAlexander 12:140677759b2c 112 DevL->i2c_slave_address = NEW_SENSOR_LEFT_ADDRESS;
johnAlexander 12:140677759b2c 113 devLeft.i2c_slave_address = NEW_SENSOR_LEFT_ADDRESS;
johnAlexander 5:b233bdf91671 114
johnAlexander 12:140677759b2c 115 DevR=&devLeft;
johnAlexander 12:140677759b2c 116 // configure the sensors
johnAlexander 12:140677759b2c 117 DevR->comms_speed_khz = 400;
johnAlexander 12:140677759b2c 118 DevR->comms_type = 1;
johnAlexander 12:140677759b2c 119 DevR->i2c_slave_address = NEW_SENSOR_RIGHT_ADDRESS;
johnAlexander 12:140677759b2c 120 devRight.i2c_slave_address = NEW_SENSOR_RIGHT_ADDRESS;
johnAlexander 5:b233bdf91671 121
johnAlexander 12:140677759b2c 122 for (int i = 0; i < 3; i++)
johnAlexander 12:140677759b2c 123 {
johnAlexander 12:140677759b2c 124 if (i == 0) { Sensor=board->sensor_centre; }
johnAlexander 12:140677759b2c 125 if (i == 1) { Sensor=board->sensor_left; }
johnAlexander 12:140677759b2c 126 if (i == 2) { Sensor=board->sensor_right; }
johnAlexander 12:140677759b2c 127
johnAlexander 12:140677759b2c 128 if (Sensor != NULL)
johnAlexander 12:140677759b2c 129 {
johnAlexander 12:140677759b2c 130 if (i == 0) { printf("configuring centre channel \n"); }
johnAlexander 12:140677759b2c 131 if (i == 1) { printf("configuring left channel \n"); }
johnAlexander 12:140677759b2c 132 if (i == 2) { printf("configuring right channel \n"); }
johnAlexander 12:140677759b2c 133
johnAlexander 12:140677759b2c 134 /* Device Initialization and setting */
johnAlexander 12:140677759b2c 135 status = Sensor->vl53L1_DataInit();
johnAlexander 12:140677759b2c 136 status = Sensor->vl53L1_StaticInit();
johnAlexander 4:0ac9998b69ac 137
johnAlexander 12:140677759b2c 138 status = Sensor->vl53L1_SetPresetMode(VL53L1_PRESETMODE_AUTONOMOUS);
johnAlexander 12:140677759b2c 139 status = Sensor->vl53L1_SetDistanceMode(VL53L1_DISTANCEMODE_LONG);
johnAlexander 4:0ac9998b69ac 140
johnAlexander 12:140677759b2c 141 status = Sensor->vl53L1_SetInterMeasurementPeriodMilliSeconds(500);
johnAlexander 5:b233bdf91671 142
johnAlexander 12:140677759b2c 143 status = Sensor->vl53L1_SetMeasurementTimingBudgetMicroSeconds(45000);
johnAlexander 7:242f30acc456 144
johnAlexander 12:140677759b2c 145 status = Sensor->vl53L1_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM1, 0);
johnAlexander 12:140677759b2c 146 status = Sensor->vl53L1_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM2, 0);
johnAlexander 12:140677759b2c 147 }
johnAlexander 12:140677759b2c 148 }
johnAlexander 5:b233bdf91671 149
johnAlexander 4:0ac9998b69ac 150 // create interrupt handler and start measurements
johnAlexander 5:b233bdf91671 151 if (board->sensor_centre!= NULL) {
johnAlexander 3:c1e893e6752f 152 status = board->sensor_centre->stop_measurement();
johnAlexander 3:c1e893e6752f 153 if (status != 0) {
johnAlexander 4:0ac9998b69ac 154 return status;
johnAlexander 3:c1e893e6752f 155 }
johnAlexander 3:c1e893e6752f 156
johnAlexander 12:140677759b2c 157 status = board->sensor_centre->vl53L1_StartMeasurement();
johnAlexander 3:c1e893e6752f 158 if (status != 0) {
johnAlexander 3:c1e893e6752f 159 return status;
johnAlexander 3:c1e893e6752f 160 }
johnAlexander 3:c1e893e6752f 161 }
johnAlexander 12:140677759b2c 162
johnAlexander 12:140677759b2c 163 // create interrupt handler and start measurements
johnAlexander 12:140677759b2c 164 if (board->sensor_left!= NULL) {
johnAlexander 12:140677759b2c 165 status = board->sensor_left->stop_measurement();
johnAlexander 12:140677759b2c 166 if (status != 0) {
johnAlexander 12:140677759b2c 167 return status;
johnAlexander 12:140677759b2c 168 }
johnAlexander 12:140677759b2c 169
johnAlexander 12:140677759b2c 170 status = board->sensor_left->vl53L1_StartMeasurement();
johnAlexander 12:140677759b2c 171 if (status != 0) {
johnAlexander 12:140677759b2c 172 return status;
johnAlexander 12:140677759b2c 173 }
johnAlexander 12:140677759b2c 174 }
johnAlexander 12:140677759b2c 175
johnAlexander 12:140677759b2c 176 // create interrupt handler and start measurements
johnAlexander 12:140677759b2c 177 if (board->sensor_right!= NULL) {
johnAlexander 12:140677759b2c 178 status = board->sensor_right->stop_measurement();
johnAlexander 12:140677759b2c 179 if (status != 0) {
johnAlexander 12:140677759b2c 180 return status;
johnAlexander 12:140677759b2c 181 }
johnAlexander 12:140677759b2c 182
johnAlexander 12:140677759b2c 183 status = board->sensor_right->vl53L1_StartMeasurement();
johnAlexander 12:140677759b2c 184 if (status != 0) {
johnAlexander 12:140677759b2c 185 return status;
johnAlexander 12:140677759b2c 186 }
johnAlexander 12:140677759b2c 187 }
johnAlexander 12:140677759b2c 188
johnAlexander 3:c1e893e6752f 189 return status;
johnAlexander 3:c1e893e6752f 190 }
johnAlexander 3:c1e893e6752f 191
johnAlexander 3:c1e893e6752f 192 /* ISR callback function of the user blue button to switch measuring sensor. */
johnAlexander 3:c1e893e6752f 193 void measuring_stop_irq(void)
johnAlexander 3:c1e893e6752f 194 {
johnAlexander 3:c1e893e6752f 195 int_stop = true;
johnAlexander 3:c1e893e6752f 196 }
johnAlexander 3:c1e893e6752f 197
charlesmn 0:020912dfa221 198 /*=================================== Main ==================================
charlesmn 0:020912dfa221 199 =============================================================================*/
charlesmn 0:020912dfa221 200 int main()
johnAlexander 5:b233bdf91671 201 {
charlesmn 0:020912dfa221 202 int status;
johnAlexander 5:b233bdf91671 203
charlesmn 0:020912dfa221 204 pc.baud(115200); // baud rate is important as printf statements take a lot of time
johnAlexander 5:b233bdf91671 205
johnAlexander 5:b233bdf91671 206 printf("mbed version : %d \r\n",MBED_VERSION);
charlesmn 0:020912dfa221 207
charlesmn 0:020912dfa221 208 // create i2c interface
charlesmn 0:020912dfa221 209 ToF_DevI2C *dev_I2C = new ToF_DevI2C(I2C_SDA, I2C_SCL);
johnAlexander 3:c1e893e6752f 210 /* creates the 53L1A2 expansion board singleton obj */
johnAlexander 6:19d56b30bfa7 211 board = XNucleo53L1A2::instance(dev_I2C, CentreIntPin, LeftIntPin, RightIntPin);
johnAlexander 5:b233bdf91671 212
charlesmn 0:020912dfa221 213 printf("board created!\r\n");
charlesmn 0:020912dfa221 214
charlesmn 0:020912dfa221 215 /* init the 53L1A1 expansion board with default values */
charlesmn 0:020912dfa221 216 status = board->init_board();
charlesmn 0:020912dfa221 217 if (status) {
charlesmn 0:020912dfa221 218 printf("Failed to init board!\r\n");
johnAlexander 5:b233bdf91671 219 return status;
charlesmn 0:020912dfa221 220 }
johnAlexander 5:b233bdf91671 221
charlesmn 0:020912dfa221 222 printf("board initiated! - %d\r\n", status);
johnAlexander 5:b233bdf91671 223
johnAlexander 3:c1e893e6752f 224 /* init an array with chars to id the sensors */
johnAlexander 3:c1e893e6752f 225 status = init_sensor();
johnAlexander 3:c1e893e6752f 226 if (status != 0) {
johnAlexander 3:c1e893e6752f 227 printf("Failed to init sensors!\r\n");
johnAlexander 3:c1e893e6752f 228 return status;
johnAlexander 3:c1e893e6752f 229 }
johnAlexander 3:c1e893e6752f 230
johnAlexander 5:b233bdf91671 231 printf("loop forever\n");
johnAlexander 3:c1e893e6752f 232
johnAlexander 4:0ac9998b69ac 233 VL53L1_MultiRangingData_t MultiRangingData;
johnAlexander 5:b233bdf91671 234 VL53L1_MultiRangingData_t *pMultiRangingData = NULL;
johnAlexander 5:b233bdf91671 235
johnAlexander 3:c1e893e6752f 236 while (true) {
johnAlexander 5:b233bdf91671 237 pMultiRangingData = &MultiRangingData;
johnAlexander 5:b233bdf91671 238
johnAlexander 12:140677759b2c 239 if (board->sensor_centre!= NULL) {
johnAlexander 12:140677759b2c 240 printf("Range result from Centre sensor\n");
johnAlexander 12:140677759b2c 241 status = board->sensor_centre->vl53L1_WaitMeasurementDataReady();
johnAlexander 12:140677759b2c 242
johnAlexander 12:140677759b2c 243 status = board->sensor_centre->vl53L1_GetMultiRangingData( pMultiRangingData);
johnAlexander 12:140677759b2c 244
johnAlexander 12:140677759b2c 245 print_results( devCentre.i2c_slave_address, pMultiRangingData );
johnAlexander 12:140677759b2c 246
johnAlexander 12:140677759b2c 247 status = board->sensor_centre->VL53L1_ClearInterrupt();
johnAlexander 12:140677759b2c 248 }
johnAlexander 12:140677759b2c 249
johnAlexander 12:140677759b2c 250 if (board->sensor_left!= NULL) {
johnAlexander 12:140677759b2c 251 printf("Range result from Left Satellite\n");
johnAlexander 12:140677759b2c 252 status = board->sensor_left->vl53L1_WaitMeasurementDataReady();
johnAlexander 12:140677759b2c 253
johnAlexander 12:140677759b2c 254 status = board->sensor_left->vl53L1_GetMultiRangingData( pMultiRangingData);
johnAlexander 12:140677759b2c 255
johnAlexander 12:140677759b2c 256 print_results( devLeft.i2c_slave_address, pMultiRangingData );
johnAlexander 12:140677759b2c 257
johnAlexander 12:140677759b2c 258 status = board->sensor_left->VL53L1_ClearInterrupt();
johnAlexander 12:140677759b2c 259 }
johnAlexander 12:140677759b2c 260
johnAlexander 12:140677759b2c 261 // create interrupt handler and start measurements
johnAlexander 12:140677759b2c 262 if (board->sensor_right!= NULL) {
johnAlexander 12:140677759b2c 263 printf("Range result from Right Satellite\n");
johnAlexander 12:140677759b2c 264 status = board->sensor_right->vl53L1_WaitMeasurementDataReady();
johnAlexander 12:140677759b2c 265
johnAlexander 12:140677759b2c 266 status = board->sensor_right->vl53L1_GetMultiRangingData( pMultiRangingData);
johnAlexander 12:140677759b2c 267
johnAlexander 12:140677759b2c 268 print_results( devRight.i2c_slave_address, pMultiRangingData );
johnAlexander 12:140677759b2c 269
johnAlexander 12:140677759b2c 270 status = board->sensor_right->VL53L1_ClearInterrupt();
johnAlexander 12:140677759b2c 271 }
charlesmn 0:020912dfa221 272 }
johnAlexander 5:b233bdf91671 273
johnAlexander 5:b233bdf91671 274 printf("Terminating.\n");
johnAlexander 3:c1e893e6752f 275 }
johnAlexander 5:b233bdf91671 276
johnAlexander 5:b233bdf91671 277
johnAlexander 5:b233bdf91671 278 // print what ever results are required
johnAlexander 2:f0ec92af4b5f 279 void print_results( int devNumber, VL53L1_MultiRangingData_t *pMultiRangingData )
charlesmn 0:020912dfa221 280 {
johnAlexander 7:242f30acc456 281 int no_of_object_found = pMultiRangingData->NumberOfObjectsFound;
johnAlexander 6:19d56b30bfa7 282 int signal_rate = 0;
johnAlexander 6:19d56b30bfa7 283 int ambient_rate = 0;
johnAlexander 5:b233bdf91671 284
johnAlexander 7:242f30acc456 285 int RoiNumber = pMultiRangingData->RoiNumber;
johnAlexander 12:140677759b2c 286
johnAlexander 12:140677759b2c 287 printf("no_of_object_found : %d\n", no_of_object_found);
charlesmn 0:020912dfa221 288
johnAlexander 5:b233bdf91671 289 if (( no_of_object_found < 10 ) && ( no_of_object_found != 0)) {
johnAlexander 5:b233bdf91671 290 for(int j=0; j<no_of_object_found; j++) {
johnAlexander 12:140677759b2c 291 printf("RangeStatus : %d\n", pMultiRangingData->RangeData[j].RangeStatus);
johnAlexander 5:b233bdf91671 292 if ((pMultiRangingData->RangeData[j].RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID) ||
johnAlexander 5:b233bdf91671 293 (pMultiRangingData->RangeData[j].RangeStatus == VL53L1_RANGESTATUS_RANGE_VALID_NO_WRAP_CHECK_FAIL)) {
johnAlexander 6:19d56b30bfa7 294 signal_rate = pMultiRangingData->RangeData[j].SignalRateRtnMegaCps / 65535;
johnAlexander 6:19d56b30bfa7 295 ambient_rate = pMultiRangingData->RangeData[j].AmbientRateRtnMegaCps / 65535;
johnAlexander 6:19d56b30bfa7 296 printf("\t i2cAddr=%d \t RoiNumber=%d \t status=%d, \t D=%5dmm, \t Signal=%d Mcps, \t Ambient=%d Mcps \n",
johnAlexander 6:19d56b30bfa7 297 devNumber, RoiNumber,
johnAlexander 6:19d56b30bfa7 298 pMultiRangingData->RangeData[j].RangeStatus,
johnAlexander 6:19d56b30bfa7 299 pMultiRangingData->RangeData[j].RangeMilliMeter,
johnAlexander 6:19d56b30bfa7 300 signal_rate,
johnAlexander 6:19d56b30bfa7 301 ambient_rate);
johnAlexander 6:19d56b30bfa7 302 /*
johnAlexander 6:19d56b30bfa7 303 // online compiler disables printf() / floating-point support, for code-size reasons.
johnAlexander 6:19d56b30bfa7 304 // offline compiler can switch it on.
johnAlexander 2:f0ec92af4b5f 305 printf("\t i2cAddr=%d \t RoiNumber=%d \t status=%d, \t D=%5dmm, \t Signal=%2.2f Mcps, \t Ambient=%2.2f Mcps \n",
johnAlexander 5:b233bdf91671 306 devNumber, RoiNumber,
johnAlexander 5:b233bdf91671 307 pMultiRangingData->RangeData[j].RangeStatus,
johnAlexander 5:b233bdf91671 308 pMultiRangingData->RangeData[j].RangeMilliMeter,
johnAlexander 5:b233bdf91671 309 pMultiRangingData->RangeData[j].SignalRateRtnMegaCps / 65535.0,
johnAlexander 5:b233bdf91671 310 pMultiRangingData->RangeData[j].AmbientRateRtnMegaCps / 65535.0);
johnAlexander 6:19d56b30bfa7 311 */
johnAlexander 2:f0ec92af4b5f 312 }
johnAlexander 2:f0ec92af4b5f 313 }
johnAlexander 5:b233bdf91671 314 } // if (( no_of_object_found < 10 ) && ( no_of_object_found != 0))
johnAlexander 5:b233bdf91671 315 }
charlesmn 0:020912dfa221 316
johnAlexander 5:b233bdf91671 317
charlesmn 0:020912dfa221 318 #if (MBED_VERSION > 60300)
charlesmn 0:020912dfa221 319 extern "C" void wait_ms(int ms)
johnAlexander 5:b233bdf91671 320 {
charlesmn 0:020912dfa221 321 thread_sleep_for(ms);
johnAlexander 5:b233bdf91671 322 }
johnAlexander 5:b233bdf91671 323 #endif
johnAlexander 5:b233bdf91671 324
johnAlexander 5:b233bdf91671 325