Sam Walsh / X_NUCLEO_6180XA1

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   Ultrasound_And_IMU

Fork of X_NUCLEO_6180XA1 by ST

Revision:
54:17f3bb228b13
Parent:
49:f0dd44dd59c5
--- a/x_nucleo_6180xa1.h	Tue Sep 27 12:18:09 2016 +0000
+++ b/x_nucleo_6180xa1.h	Wed Nov 30 08:25:04 2016 +0000
@@ -63,6 +63,9 @@
 {
 protected:
      /** Constructor 1
+    * @brief       x_nucleo_6180xa1 board Constructor. Default the INT gpio \
+    * configuration as the electrical schematic. Self sensing for optional \
+    * expansion sensors (L/B/R). 
      * @param[in] &i2c device I2C to be used for communication
      */
     X_NUCLEO_6180XA1(DevI2C *ext_i2c) : dev_i2c(ext_i2c)
@@ -83,6 +86,10 @@
        
        gpio0_right=new STMPE1600DigiOut(*dev_i2c, GPIO_15);
        sensor_right=new VL6180X(*dev_i2c, *gpio0_right, D2);
+       
+       if (InitBoard()) {   // init failed
+       	   printf ("ERROR Init X-NUCLEO-6180XA1 Board\n\r");
+       	}      
     }
     
     /** Constructor 2
@@ -145,7 +152,6 @@
 	 */					         
     static X_NUCLEO_6180XA1 *Instance(DevI2C *ext_i2c, PinName gpio1_top, PinName gpio1_bottom,
                                              PinName gpio1_left, PinName gpio1_right);
-
     
 	/**
 	 * @brief       Initialize the board and sensors with deft values
@@ -160,6 +166,42 @@
     bool RdSwitch () {
 	     return Switch->RdSwitch();	
     }
+    
+	/**
+	 * @brief       Check the presence of sensor top. To be called after InitBoard
+	 * @return      true is present, false if absent
+	 */				
+	bool isSensorTopPresent() {
+		if (sensor_top) return true;
+		return false;
+	} 
+
+	/**
+	 * @brief       Check the presence of sensor bottom.  To be called after InitBoard
+	 * @return      true is present, false if absent
+	 */				
+	bool isSensorBottomPresent() {
+		if (sensor_bottom) return true;
+		return false;
+	} 
+	
+	/**
+	 * @brief       Check the presence of sensor left.  To be called after InitBoard
+	 * @return      true is present, false if absent
+	 */				
+	bool isSensorLeftPresent() {
+		if (sensor_left) return true;
+		return false;
+	} 
+	
+	/**
+	 * @brief       Check the presence of sensor right.  To be called after InitBoard
+	 * @return      true is present, false if absent
+	 */				
+	bool isSensorRightPresent() {
+		if (sensor_right) return true;
+		return false;
+	} 
 
     DevI2C *dev_i2c;
     VL6180X *sensor_top;