![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
pre commentaire
Fork of Code_APP3_R by
Sensors/Accelerometer.cpp
- Committer:
- ericbisson
- Date:
- 2017-02-14
- Revision:
- 9:dc81d8ee4a97
File content as of revision 9:dc81d8ee4a97:
#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; } //--------------------------------------------------------------//