Trial program, to test 3 sensors together, in polling / autonomous mode.
Dependencies: X_NUCLEO_53L1A2
Diff: main.cpp
- Revision:
- 10:2da1507fa8c2
- Parent:
- 8:ac303cd2d35f
- Child:
- 12:140677759b2c
--- a/main.cpp Wed Jun 09 17:47:42 2021 +0100 +++ b/main.cpp Wed Jun 09 18:10:00 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 @@ -123,7 +123,7 @@ return status; } - status = Sensor->vl53L1_StartMeasurement(); + status = Sensor->VL53L1CB_StartMeasurement(); if (status != 0) { return status; } @@ -142,7 +142,6 @@ int main() { int status; - uint16_t distance = 0; pc.baud(115200); // baud rate is important as printf statements take a lot of time @@ -179,14 +178,14 @@ while (true) { pMultiRangingData = &MultiRangingData; - status = board->sensor_centre->vl53L1_WaitMeasurementDataReady(); + status = board->sensor_centre->VL53L1CB_WaitMeasurementDataReady(); // 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(); // } }