VL53L1CB ranging example, using embedded sensor on X-Nucleo-53L1A2 expansion board, in interrupt mode.
Dependencies: X_NUCLEO_53L1A2
Diff: main.cpp
- Revision:
- 8:24f62fe4ac49
- Parent:
- 7:242f30acc456
- Child:
- 14:a9e411a2f27b
--- a/main.cpp Fri May 21 08:38:45 2021 +0000 +++ b/main.cpp Wed Jun 09 10:20:59 2021 +0100 @@ -71,7 +71,7 @@ VL53L1_Dev_t devCentre; VL53L1_DEV Dev = &devCentre; -VL53L1 *Sensor; +VL53L1CB *Sensor; @@ -102,18 +102,18 @@ printf("configuring centre channel \n"); /* Device Initialization and setting */ - status = Sensor->vl53L1_DataInit(); - status = Sensor->vl53L1_StaticInit(); + status = Sensor->VL53L1CB_DataInit(); + status = Sensor->VL53L1CB_StaticInit(); - status = Sensor->vl53L1_SetPresetMode(VL53L1_PRESETMODE_AUTONOMOUS); - status = Sensor->vl53L1_SetDistanceMode(VL53L1_DISTANCEMODE_LONG); + status = Sensor->VL53L1CB_SetPresetMode(VL53L1_PRESETMODE_AUTONOMOUS); + status = Sensor->VL53L1CB_SetDistanceMode(VL53L1_DISTANCEMODE_LONG); - status = Sensor->vl53L1_SetInterMeasurementPeriodMilliSeconds(500); + status = Sensor->VL53L1CB_SetInterMeasurementPeriodMilliSeconds(500); - status = Sensor->vl53L1_SetMeasurementTimingBudgetMicroSeconds(45000); + status = Sensor->VL53L1CB_SetMeasurementTimingBudgetMicroSeconds(45000); - status = Sensor->vl53L1_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM1, 0); - status = Sensor->vl53L1_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM2, 0); + status = Sensor->VL53L1CB_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM1, 0); + status = Sensor->VL53L1CB_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM2, 0); // create interrupt handler and start measurements @@ -181,11 +181,11 @@ if (int_sensor) { int_sensor = false; - status = board->sensor_centre->vl53L1_GetMultiRangingData( pMultiRangingData); + status = board->sensor_centre->VL53L1CB_GetMultiRangingData( pMultiRangingData); print_results( devCentre.i2c_slave_address, pMultiRangingData ); - status = board->sensor_centre->VL53L1_ClearInterrupt(); + status = board->sensor_centre->VL53L1CB_ClearInterrupt(); board->sensor_centre->enable_interrupt_measure_detection_irq(); } }