Sample program for 3 sensors using polling in autonomous mode.

Dependencies:   X_NUCLEO_53L1A2

Committer:
johnAlexander
Date:
Thu Jun 24 12:53:19 2021 +0000
Revision:
15:2d88428ecb44
Parent:
14:18b1d64f6c01
Use sensor class with default constructor enabled.

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