1st

Dependencies:   BSP_B-L475E-IOT01

Files at this revision

API Documentation at this revision

Comitter:
voltxd
Date:
Fri Dec 04 07:41:12 2020 +0000
Commit message:
1st

Changed in this revision

BSP_B-L475E-IOT01.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-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_B-L475E-IOT01.lib	Fri Dec 04 07:41:12 2020 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/ST/code/BSP_B-L475E-IOT01/#bfe8272ced90
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 04 07:41:12 2020 +0000
@@ -0,0 +1,75 @@
+#include "mbed.h"
+
+// Sensors drivers present in the BSP library
+#include "stm32l475e_iot01_tsensor.h"
+#include "stm32l475e_iot01_hsensor.h"
+#include "stm32l475e_iot01_psensor.h"
+#include "stm32l475e_iot01_magneto.h"
+#include "stm32l475e_iot01_gyro.h"
+#include "stm32l475e_iot01_accelero.h"
+
+#include <math.h>
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+DigitalIn userButton(USER_BUTTON, PullUp);
+
+int main()
+{
+    float sensor_value = 0;
+    int16_t pDataXYZ[3] = {0};
+    float pGyroDataXYZ[3] = {0};
+
+    printf("Start sensor init\r\n");
+
+    BSP_TSENSOR_Init();
+    BSP_HSENSOR_Init();
+    BSP_PSENSOR_Init();
+
+    BSP_MAGNETO_Init();
+    BSP_GYRO_Init();
+    BSP_ACCELERO_Init();
+    
+    led2 = 1;
+    led3 = 0;
+    led4 = 0;
+
+    while(1) {
+        printf("\r\nNew loop, LED1 should blink during sensor read\r\n");
+        
+        if (!userButton.read())
+        {
+            if (!led2.read() && !led3.read() && !led4.read())
+            {
+                led2 = 1;
+            }
+            else if (led2.read() && !led3.read() && !led4.read())
+            {
+                led2 = 0;
+                led3 = 1;
+            }
+            else if (!led2.read() && led3.read() && !led4.read())
+            {
+                led3 = 0;
+                led4 = 1;
+            }
+            else 
+            {
+                led4 = 0;
+                led2 = 1;
+            }
+        }
+        else
+        {
+            led2 = 0;
+            led3 = 0;
+            led4 = 0;
+        }
+
+        ThisThread::sleep_for(1);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Fri Dec 04 07:41:12 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#b81aeff1a3e171c6421984faa2cc18d0e35746c0