Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_53L1A2
Revision 7:242f30acc456, committed 2021-05-21
- Comitter:
- johnAlexander
- Date:
- Fri May 21 08:38:45 2021 +0000
- Parent:
- 6:19d56b30bfa7
- Child:
- 8:ac303cd2d35f
- Commit message:
- Match autonomous setup to C, ULD driver example's settings.; Update board class.; Target MbedOS v6.10.0.
Changed in this revision
--- a/X_NUCLEO_53L1A2.lib Wed May 12 09:00:10 2021 +0000 +++ b/X_NUCLEO_53L1A2.lib Fri May 21 08:38:45 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/ST-Expansion-SW-Team/code/X_NUCLEO_53L1A2/#074d411a56f3 +https://os.mbed.com/teams/ST-Expansion-SW-Team/code/X_NUCLEO_53L1A2/#57998dc85ed4
--- a/main.cpp Wed May 12 09:00:10 2021 +0000
+++ b/main.cpp Fri May 21 08:38:45 2021 +0000
@@ -50,10 +50,10 @@
// the satellite pins depend on solder blobs on the back of the shield.
// they may not exist or may be one of two sets.
// the centre pin always exists
-PinName LeftIntPin = D8;
+//PinName LeftIntPin = D8;
PinName RightIntPin = D2;
// alternate set
-//PinName LeftIntPin = D9;
+PinName LeftIntPin = D9;
//PinName RightIntPin = D4;
static XNucleo53L1A2 *board=NULL;
@@ -104,24 +104,17 @@
/* Device Initialization and setting */
status = Sensor->vl53L1_DataInit();
status = Sensor->vl53L1_StaticInit();
+
status = Sensor->vl53L1_SetPresetMode(VL53L1_PRESETMODE_AUTONOMOUS);
status = Sensor->vl53L1_SetDistanceMode(VL53L1_DISTANCEMODE_LONG);
- status = Sensor->vl53L1_SetMeasurementTimingBudgetMicroSeconds( 200 * 1000);
-
- // set the ranging and signal rate filter
- VL53L1_DetectionConfig_t thresholdconfig;
+ status = Sensor->vl53L1_SetInterMeasurementPeriodMilliSeconds(500);
- thresholdconfig.DetectionMode = VL53L1_DETECTION_DISTANCE_ONLY; /// type VL53L1_DetectionMode in vl53l1_def.h
- thresholdconfig.Distance.CrossMode = VL53L1_THRESHOLD_IN_WINDOW; // type VL53L1_ThresholdMode. ignore if distance outside high and low
- thresholdconfig.Distance.High = 300; // high distance in mm
- thresholdconfig.Distance.Low = 200; // low distance in mm
- thresholdconfig.Rate.CrossMode=0; // type VL53L1_ThresholdMode VL53L1_THRESHOLD_CROSSED_LOW VL53L1_THRESHOLD_CROSSED_HIGH VL53L1_THRESHOLD_OUT_OF_WINDOW VL53L1_THRESHOLD_IN_WINDOW
- thresholdconfig.Rate.High = 0;
- thresholdconfig.Rate.Low = 0;
- thresholdconfig.IntrNoTarget = 0 ;// if 1 produce an interrupt even if there is no target found e.g out of range
+ status = Sensor->vl53L1_SetMeasurementTimingBudgetMicroSeconds(45000);
- status = Sensor->vl53L1_SetThresholdConfig(&thresholdconfig);
+ status = Sensor->vl53L1_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM1, 0);
+ status = Sensor->vl53L1_SetSequenceStepEnable(VL53L1_SEQUENCESTEP_MM2, 0);
+
// create interrupt handler and start measurements
if (board->sensor_centre!= NULL) {
@@ -188,17 +181,12 @@
if (int_sensor) {
int_sensor = false;
- status = board->sensor_centre->vl53L1_GetMultiRangingData( pMultiRangingData);
- if (status == 0) {
+ status = board->sensor_centre->vl53L1_GetMultiRangingData( pMultiRangingData);
+
print_results( devCentre.i2c_slave_address, pMultiRangingData );
- }
- status = board->sensor_centre->VL53L1_ClearInterrupt();
- board->sensor_centre->enable_interrupt_measure_detection_irq();
- }
- if (int_stop) {
- printf("\r\nEnding loop mode \r\n");
- break;
+ status = board->sensor_centre->VL53L1_ClearInterrupt();
+ board->sensor_centre->enable_interrupt_measure_detection_irq();
}
}
@@ -209,11 +197,11 @@
// print what ever results are required
void print_results( int devNumber, VL53L1_MultiRangingData_t *pMultiRangingData )
{
- int no_of_object_found=pMultiRangingData->NumberOfObjectsFound;
+ int no_of_object_found = pMultiRangingData->NumberOfObjectsFound;
int signal_rate = 0;
int ambient_rate = 0;
- int RoiNumber=pMultiRangingData->RoiNumber;
+ int RoiNumber = pMultiRangingData->RoiNumber;
if (( no_of_object_found < 10 ) && ( no_of_object_found != 0)) {
for(int j=0; j<no_of_object_found; j++) {
--- a/mbed-os.lib Wed May 12 09:00:10 2021 +0000 +++ b/mbed-os.lib Fri May 21 08:38:45 2021 +0000 @@ -1,1 +1,1 @@ -https://github.com/armmbed/mbed-os/#aa70f680bb5755e8fea3f93fc6e04d9b3de235bb +https://github.com/armmbed/mbed-os/#9738b27c7df897c29e9769911d6794ba3e5b3f19