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
Diff: DefinitionIO.h
- Revision:
- 0:0861bf46efe4
- Child:
- 1:e1f3b4b8b99b
diff -r 000000000000 -r 0861bf46efe4 DefinitionIO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DefinitionIO.h Fri Feb 12 20:54:38 2016 +0000 @@ -0,0 +1,68 @@ +#include "mbed.h" +#include "DataFile.h" + +#include "SDFileSystem.h" +#include "COMPASS_DISCO_L476VG.h" + + +DigitalOut LedEnreg(LED1); +DigitalIn InterEnreg(PD_0,PullDown); + +COMPASS_DISCO_L476VG compass ; + + //Create an SDFileSystem object + SDFileSystem sd(PE_15, PE_14, PE_13, PE_12, "sd"); + tDataFile DataFile; + bool EnregistrementEnCours; + + //COMPASS_DISCO_L476VG compass ;//=new COMPASS_DISCO_L476VG(); + + tMesure Mesures(&compass); + + +void Init() +{ + printf("avant Compass created\n"); + //pcompass =new COMPASS_DISCO_L476VG(); + printf("Compass created\n"); + // delete pcompass; + EnregistrementEnCours=false; + LedEnreg=0; + printf("Compass started\n"); + + //Mount the filesystem + sd.mount(); + printf("mounted\n\r"); +} + +void CheckEnreg() +{ + if (InterEnreg.read()==1) + { + //printf("InterEnreg\n\r"); + if (!EnregistrementEnCours) + { + EnregistrementEnCours=true; + DataFile.New(); + printf("enregistrement started\n\r"); + } + else + { + DataFile.SaveMesures(&Mesures); + //printf("Enregistrement\n\r"); + } + LedEnreg=!LedEnreg; + + } + else + { + //printf("Not InterEnreg\n\r"); + if (EnregistrementEnCours) + { + EnregistrementEnCours=false; + DataFile.Close(); + printf("enregistrement stopped\n\r"); + } + LedEnreg=0; + } +} \ No newline at end of file