Dependencies:   X_NUCLEO_53L0A1 mbed

Fork of HelloWorld_53L0A1 by ST

Revision:
1:3483e701ec59
Parent:
0:ce8359133ae6
Child:
3:b3f70617a6b3
--- a/main.cpp	Mon Nov 28 11:26:38 2016 +0000
+++ b/main.cpp	Mon Nov 28 14:55:05 2016 +0000
@@ -5,12 +5,11 @@
 #include <stdio.h>
 #include <assert.h>
 
-/* This VL6180X Expansion board test application performs a range measurement and an als measurement in interrupt mode
+/* This VL53L0X Expansion board test application performs a range measurement in polling mode
    on the onboard embedded top sensor. 
-   The board red slider select on the flight the measurement type as ALS or RANGE; the measured data is diplayed on the 
-   on bord 4digits display.
+   The measured data is displayed on the on-board 4-digit display.
 
-   User Blue button allows to stop current measurement and the entire program releasing all the resources.
+   User Blue button stops the current measurement and the entire program, releasing all resources.
    Reset button is used to restart the program. */
 
 /* Polling operating modes don`t require callback function that handles IRQ 
@@ -27,7 +26,7 @@
 
 static X_NUCLEO_53L0A1 *board=NULL;
 VL53L0X_RangingMeasurementData_t data_sensor_centre;
-OperatingMode operating_mode, prev_operating_mode;
+OperatingMode operating_mode;
 	
 /* flags that handle interrupt request */
 bool int_sensor_centre=false, int_stop_measure=false;	
@@ -44,11 +43,10 @@
 {
    int_stop_measure=true;
 }
-#define DELAY 100  // 100ms
+
 /* On board 4 digit local display refresh */
 void DisplayRefresh(OperatingMode op_mode)
 {   
-   Timer timer;
    char str[5];
    
    if (op_mode==range_single_shot_polling || op_mode==range_continuous_interrupt || op_mode==range_continuous_polling)
@@ -64,51 +62,9 @@
    }
 	 
    board->display->DisplayString(str);
-/*
-   timer.start();
-   for(int i=0; i<DELAY; i=timer.read_ms())
-   {
-   }
-   timer.stop();
-*/
 }
 
-/* Print on USB Serial the started OperatingMode */
-/*
-void PrintStartMessage(OperatingMode op_mode)
-{
-   if(op_mode==range_continuous_interrupt)
-      printf("\nStarted range continuous interrupt measure\n\r");
-}
-*/
-
-/* Print on USB Serial the stopped OperatingMode */
-/*
-void PrintStopMessage(OperatingMode op_mode)
-{
-   if(op_mode==range_continuous_interrupt)
-      printf("Stopped range continuous interrupt measure\n\r");
-}
-*/
-/* Print on board 4 Digit display the indicated message <= 4 char */
-//#define DELAY 2000  // 2Sec
-/*
-void DisplayMsg(const char * msg)
-{
-   Timer timer;
-   char str[5];
-   
-   timer.start();
-   for(int i=0; i<DELAY; i=timer.read_ms())
-   {
-      sprintf(str,"%s",msg);
-      board->display->DisplayString(str);
-   }
-   timer.stop();
-}
-*/
-
-void ContinousRangeMeasure(DevI2C *device_i2c) {
+void RangeMeasure(DevI2C *device_i2c) {
    int status;
 
    /* creates the 53L0A1 expansion board singleton obj */
@@ -153,7 +109,7 @@
 #endif   
    DevI2C *device_i2c =new DevI2C(VL53L0_I2C_SDA, VL53L0_I2C_SCL);     
 		
-   ContinousRangeMeasure(device_i2c);  // start continuous measures
+   RangeMeasure(device_i2c);  // start continuous measures
 }