Changes to the library related to interrupt mode.

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   Display_53L0A1_IntSatelites Display_53L0A1_InterruptMode

Fork of X_NUCLEO_53L0A1 by ST

Files at this revision

API Documentation at this revision

Comitter:
JerrySzczurak
Date:
Wed Jun 14 14:10:45 2017 +0000
Parent:
11:c955adfbb19b
Commit message:
Library change to work in interrupt continuous ranging mode

Changed in this revision

Components/VL53L0X/vl53l0x_class.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Components/VL53L0X/vl53l0x_class.cpp	Wed Jun 14 13:35:05 2017 +0000
+++ b/Components/VL53L0X/vl53l0x_class.cpp	Wed Jun 14 14:10:45 2017 +0000
@@ -5191,23 +5191,31 @@
 	uint8_t preRangeVcselPeriod = 14;
 	uint8_t finalRangeVcselPeriod = 10;
 
-	if (operating_mode == range_continuous_interrupt)
-	{
+    if (operating_mode == range_continuous_interrupt)
+    {
         if (gpio1Int==NULL) 
         {
-        	printf ("GPIO1 Error\r\n");
-        	return 1;
+            printf ("GPIO1 Error\r\n");
+            return 1;
         }
         printf ("Setting up GPIO Config\r\n");
-        Status = VL53L0X_SetDeviceMode(Device, VL53L0X_DEVICEMODE_GPIO_DRIVE);
-		if (Status == VL53L0X_ERROR_NONE) {
-			Status = RangeConfigInterrupt(VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_NEW_SAMPLE_READY);
-		}
-		if (Status == VL53L0X_ERROR_NONE) {
-			Status = RangeMeasIntContinuousMode(fptr);
-		}
-		return Status;
-	}
+        Status = VL53L0X_SetDeviceMode(Device, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING);
+        
+        if (Status == VL53L0X_ERROR_NONE) {
+        	Status = RangeConfigInterrupt(VL53L0X_REG_SYSTEM_INTERRUPT_GPIO_NEW_SAMPLE_READY);
+        }
+        if (Status == VL53L0X_ERROR_NONE) {
+            Status = RangeMeasIntContinuousMode(fptr);
+        }
+                        
+        if(Status == VL53L0X_ERROR_NONE)
+        {
+	        printf ("Call of VL53L0X_StartMeasurement\n");
+	        Status = VL53L0X_StartMeasurement(Device);
+        }        
+            return Status;
+    }
+
     if (operating_mode == range_single_shot_polling)
     {
         // singelshot, polled ranging