ST / HelloWorld_ST_Sensors

Dependencies:   HTS221 LIS3MDL LPS22HB LSM303AGR LSM6DSL VL53L0X

Supports NUCLEO+X-NUCLEO-IKS01A2 , STEVAL-STLKT01V1 (a.k.a. SensorTile) and B-L475E-IOT01A boards.

Files at this revision

API Documentation at this revision

Comitter:
mapellil
Date:
Mon Oct 02 09:30:24 2017 +0200
Parent:
3:82e8968382d6
Child:
5:2fdca1624a33
Commit message:
Added SPI3/3Wires sensor support, some API modifcations

Changed in this revision

HTS221.lib Show annotated file Show diff for this revision Revisions of this file
LIS3MDL.lib Show annotated file Show diff for this revision Revisions of this file
LPS22HB.lib Show annotated file Show diff for this revision Revisions of this file
LSM303AGR.lib Show annotated file Show diff for this revision Revisions of this file
LSM6DSL.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/HTS221.lib	Wed Sep 27 15:32:47 2017 +0000
+++ b/HTS221.lib	Mon Oct 02 09:30:24 2017 +0200
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/HTS221/#c4391f20553e
+https://developer.mbed.org/teams/ST/code/HTS221/#312ee2694a77
--- a/LIS3MDL.lib	Wed Sep 27 15:32:47 2017 +0000
+++ b/LIS3MDL.lib	Mon Oct 02 09:30:24 2017 +0200
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/LIS3MDL/#b3212ad3c306
+https://developer.mbed.org/teams/ST/code/LIS3MDL/#a35a16f3da39
--- a/LPS22HB.lib	Wed Sep 27 15:32:47 2017 +0000
+++ b/LPS22HB.lib	Mon Oct 02 09:30:24 2017 +0200
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/LPS22HB/#33ddb62b31fd
+https://developer.mbed.org/teams/ST/code/LPS22HB/#f7b403c70f6b
--- a/LSM303AGR.lib	Wed Sep 27 15:32:47 2017 +0000
+++ b/LSM303AGR.lib	Mon Oct 02 09:30:24 2017 +0200
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/LSM303AGR/#86d530a7f949
+https://developer.mbed.org/teams/ST/code/LSM303AGR/#e37be5550633
--- a/LSM6DSL.lib	Wed Sep 27 15:32:47 2017 +0000
+++ b/LSM6DSL.lib	Mon Oct 02 09:30:24 2017 +0200
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST/code/LSM6DSL/#c583f32fe272
+https://developer.mbed.org/teams/ST/code/LSM6DSL/#578a45c4dad5
--- a/main.cpp	Wed Sep 27 15:32:47 2017 +0000
+++ b/main.cpp	Mon Oct 02 09:30:24 2017 +0200
@@ -53,14 +53,33 @@
 /* Retrieve the composing elements of the expansion board */
 
 #ifdef TARGET_DISCO_L475VG_IOT01A
-static DevI2C devI2c = DevI2C(PB_11,PB_10);
+static DevI2C devI2c(PB_11,PB_10);
 #else // X-Nucleo-IKS01A2
+//#define SPI3W_TEST  // or SPI4W_TEST
+#ifdef SPI3W_TEST
+SPI devSPI(PB_15, NC, PB_13);  // 3W
+#else
+#ifdef SPI4W_TEST
+SPI devSPI(PB_15, PB_14, PB_13); // 4W
+#else
 static DevI2C devI2c(D14,D15);
 #endif
+#endif
+#endif
 
-//static HTS221Sensor hum_temp = HTS221Sensor(&devI2c);
+//static DevI2C devI2c(D14,D15);  /** FIXME temporary **/
+
 static HTS221Sensor hum_temp(&devI2c);
+#if defined (SPI3W_TEST) || defined (SPI4W_TEST)
+#ifdef SPI3W_TEST
+#define SPI_TYPE LPS22HBSensor::SPI3W
+#else
+#define SPI_TYPE LPS22HBSensor::SPI4W    
+#endif
+static LPS22HBSensor press_temp(&devSPI, PA_10, NC, SPI_TYPE); 
+#else  // target Nucleoxxx + IKS01A2
 static LPS22HBSensor press_temp(&devI2c);
+#endif
 
 #ifdef TARGET_DISCO_L475VG_IOT01A
 static LSM6DSLSensor acc_gyro(&devI2c,LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW,PD_11); // low address
@@ -151,11 +170,11 @@
 
     hum_temp.get_temperature(&value1);
     hum_temp.get_humidity(&value2);
-    printf("HTS221: [temp] %7s C,   [hum] %s%%\r\n", print_double(buffer1, value1), print_double(buffer2, value2));
-    
+    printf("HTS221: [temp] %7f C,   [hum] %f%%\r\n", value1, value2);
+    value1=value2=0;    
     press_temp.get_temperature(&value1);
     press_temp.get_pressure(&value2);
-    printf("LPS22HB: [temp] %7s C, [press] %s mbar\r\n", print_double(buffer1, value1), print_double(buffer2, value2));
+    printf("LPS22HB: [temp] %7f C, [press] %f mbar\r\n", value1, value2);
 
     printf("---\r\n");
 
--- a/mbed.bld	Wed Sep 27 15:32:47 2017 +0000
+++ b/mbed.bld	Mon Oct 02 09:30:24 2017 +0200
@@ -1,1 +1,1 @@
-https://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file
+https://github.com/ARMmbed/mbed-os/#ca661f9d28526ca8f874b05432493a489c9671ea
\ No newline at end of file