Log measurements on SD card added on DISCO-L476VG board acceleration, omega, compass & 5 Analog values

Dependencies:   BSP_DISCO_L476VG COMPASS_DISCO_L476VG ConfigFile GYRO_DISCO_L476VG SDFileSystem mbed

Committer:
flowh
Date:
Fri Feb 12 20:54:38 2016 +0000
Revision:
0:0861bf46efe4
Child:
1:e1f3b4b8b99b
enregistrement Acc et boussole sur sd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
flowh 0:0861bf46efe4 1 #include "Mesure.h"
flowh 0:0861bf46efe4 2
flowh 0:0861bf46efe4 3 tMesure::tMesure(COMPASS_DISCO_L476VG * apCompass)
flowh 0:0861bf46efe4 4 {
flowh 0:0861bf46efe4 5 pCompass=apCompass;
flowh 0:0861bf46efe4 6 GainMag[0]=1.0;
flowh 0:0861bf46efe4 7 GainMag[1]=1.0;
flowh 0:0861bf46efe4 8 GainMag[2]=1.0;
flowh 0:0861bf46efe4 9 OffsetMag[0]=0.0;
flowh 0:0861bf46efe4 10 OffsetMag[1]=0.0;
flowh 0:0861bf46efe4 11 OffsetMag[2]=0.0;
flowh 0:0861bf46efe4 12
flowh 0:0861bf46efe4 13 GainAcc[0]=1.0;
flowh 0:0861bf46efe4 14 GainAcc[1]=1.0;
flowh 0:0861bf46efe4 15 GainAcc[2]=1.0;
flowh 0:0861bf46efe4 16 OffsetAcc[0]=0.0;
flowh 0:0861bf46efe4 17 OffsetAcc[1]=0.0;
flowh 0:0861bf46efe4 18 OffsetAcc[2]=0.0;
flowh 0:0861bf46efe4 19
flowh 0:0861bf46efe4 20 }
flowh 0:0861bf46efe4 21
flowh 0:0861bf46efe4 22 void tMesure::Update()
flowh 0:0861bf46efe4 23 {
flowh 0:0861bf46efe4 24 int16_t lMag[3];
flowh 0:0861bf46efe4 25 int16_t lAcc[3];
flowh 0:0861bf46efe4 26 pCompass->AccGetXYZ(lAcc);
flowh 0:0861bf46efe4 27 pCompass->MagGetXYZ(lMag);
flowh 0:0861bf46efe4 28
flowh 0:0861bf46efe4 29 for (int i = 0;i<3;i++)
flowh 0:0861bf46efe4 30 {
flowh 0:0861bf46efe4 31 Mag[i]= (lMag[i]*GainMag[i])+ OffsetMag[i];
flowh 0:0861bf46efe4 32 Acc[i]= (lAcc[i]*GainAcc[i])+ OffsetAcc[i];
flowh 0:0861bf46efe4 33 }
flowh 0:0861bf46efe4 34 }
flowh 0:0861bf46efe4 35
flowh 0:0861bf46efe4 36 void tMesure::Save(FILE * apFile)
flowh 0:0861bf46efe4 37 {
flowh 0:0861bf46efe4 38 fprintf(apFile,"%f\t",Acc[0]);
flowh 0:0861bf46efe4 39 fprintf(apFile,"%f\t",Acc[1]);
flowh 0:0861bf46efe4 40 fprintf(apFile,"%f\t",Acc[2]);
flowh 0:0861bf46efe4 41
flowh 0:0861bf46efe4 42 fprintf(apFile,"%f\t",Mag[0]);
flowh 0:0861bf46efe4 43 fprintf(apFile,"%f\t",Mag[1]);
flowh 0:0861bf46efe4 44 fprintf(apFile,"%f\t",Mag[2]);
flowh 0:0861bf46efe4 45
flowh 0:0861bf46efe4 46 fprintf(apFile,"\n");
flowh 0:0861bf46efe4 47
flowh 0:0861bf46efe4 48 }