pre commentaire

Dependencies:   mbed

Fork of Code_APP3_R by Éric Bisson

Revision:
9:dc81d8ee4a97
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sensors/Accelerometer.cpp	Tue Feb 14 04:11:07 2017 +0000
@@ -0,0 +1,25 @@
+#include "Accelerometer.h"
+
+I2C accel(p28, p27);
+bool bIsInitialized = false;
+
+//--------------------------------------------------------------//
+// Fonction pour l'envoie de données de l'accéléromètre
+// Testé et fonctionnel
+//--------------------------------------------------------------//
+void func_accel(CArray* DATA_TO_SEND)
+{
+    if (!bIsInitialized)
+    {
+        char activation[2] = {0x2A, 0x03};
+        char fullScale[2] = {0x0E, 0x00};
+        accel.write(0x3A, activation, 2, true);
+        accel.write(0x3A, fullScale, 2, true);
+        bIsInitialized = true;
+    }
+    DATA_TO_SEND->_ptr = new char[3];
+    accel.write(0x3A, DATA_TO_SEND->_ptr, 1, true);
+    accel.read(0x3A, DATA_TO_SEND->_ptr, 3);
+    DATA_TO_SEND->size = 3;
+}
+//--------------------------------------------------------------//
\ No newline at end of file