ST Expansion SW Team / Mbed 2 deprecated HelloWorld_VL53L1X_Simple_Ranging

Dependencies:   mbed X_NUCLEO_53L1A1_mbed

Revision:
20:0aa91eb13b8f
Parent:
19:92972e54d45c
Child:
21:37399a49b40e
--- a/main.cpp	Fri May 17 10:05:56 2019 +0000
+++ b/main.cpp	Thu Jul 18 13:35:15 2019 +0000
@@ -5,13 +5,14 @@
  *
  *  Measured ranges are ouput on the Serial Port, running at 115200 baud.
  *
- *  The User Blue button stops the current measurement and entire program,
- *  releasing all resources.
+ *  On STM32-Nucleo boards :
+ *      The User Blue button stops the current measurement and entire program,
+ *      releasing all resources.
  *
- *  The Black Reset button is used to restart the program.
+ *      The Black Reset button is used to restart the program.
  *
  *  *** NOTE : By default hardlinks U10, U11, U15 & U18, on the underside of
- *            the X-NUCELO-53L0A1 expansion board are not made/OFF.
+ *            the X-NUCELO-53L1A1 expansion board are not made/OFF.
  *            These links must be made to allow interrupts from the Satellite boards
  *            to be received.
  *            U11 and U18 must be made/ON to allow interrupts to be received from the
@@ -37,7 +38,6 @@
 #define VL53L1_I2C_SCL   D15
 
 static XNucleo53L1A1 *board=NULL;
-Serial pc(SERIAL_TX, SERIAL_RX);
 
 /* flags that handle interrupt request for sensor and user blue button*/
 volatile bool int_sensor = false;
@@ -123,9 +123,11 @@
 =============================================================================*/
 int main()
 {
-#if USER_BUTTON==PC_13  // we are cross compiling for Nucleo-f401
-    InterruptIn stop_button(USER_BUTTON);
-    stop_button.rise(&measuring_stop_irq);
+#if TARGET_STM    
+    #if USER_BUTTON==PC_13  // we are cross compiling for an STM32-Nucleo
+        InterruptIn stop_button(USER_BUTTON);
+        stop_button.rise(&measuring_stop_irq);
+    #endif
 #endif
     vl53L1X_DevI2C *device_i2c = new vl53L1X_DevI2C(VL53L1_I2C_SDA, VL53L1_I2C_SCL);
     range_measure(device_i2c);  // start continuous measures