Files at this revision

API Documentation at this revision

Comitter:
fabienlepoutre
Date:
Mon Jan 23 12:55:16 2012 +0000
Child:
1:e184fce6da0d
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 23 12:55:16 2012 +0000
@@ -0,0 +1,60 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+Timeout timeout;
+AnalogIn voltage(p20);
+
+
+typedef struct CHAINECH{
+    float fValEch;
+    struct CHAINECH* suivant;
+    }ChainEch;
+    
+    
+typedef struct HEADECH{
+    ChainEch *FirstEch;
+    int NbEch;
+    }HeadEch;
+    
+    
+HeadEch Head;    
+    
+
+int main() {
+}
+
+
+void vTimeoutEch(){
+    ChainEch* ValEch = (ChainEch*)malloc(sizeof(ChainEch));         //Cr�ation maillon valeur CAN
+    ValEch->fValEch = voltage;                                       // R�cup�ration valeur -> ?!: valeur entre 0 et 1 -->> CONVERTIR
+    ValEch->suivant = NULL;                                    
+    if(Head->NbEch == 0){                                           // Test si Premier maillon
+        Head->FirstEch = ValEch;                                    // Atribu. premier maillon
+        Head->NbEch++;
+    }
+    else{
+        ChainEch* maillon = Head->FirstEch;                         // On va au bou de la chaine
+        while(maillon->suivant !=NULL){
+            maillon = maillon->suivant;
+            }
+        maillon->suivant = ValEch;                                  // Ajout a la chaine
+        Head->NbEch++;
+        }
+}
+            
+    
+    
+HeadEch* Echantillonnage(int freq){
+    float time = 1/freq;                                            // periode echantillonnage
+    HeadEch* Echanti = (HeadEch*)malloc(sizeof(HeadEch));   // Cr�ation t�te maillon 
+    Echanti->NbEch =0;                                                 // Initialisation
+    Echanti->FirstEch = NULL;
+    
+    
+    timeout.attach(&vTimeoutEch, time);                             // Init Timeout
+    }
+    
+
+    
+    
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 23 12:55:16 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5364839841bd