00001 /*----------------------------------------------------------------------------*/ 00010 /*----------------------------------------------------------------------------*/ 00011 #include <ProgConfig.h> 00012 #include <cc2420.h> 00013 00014 unsigned int BOUTON1=0; 00015 unsigned int BOUTON2=0; 00016 unsigned int BOUTON3=0; 00017 unsigned int BOUTON4=0; 00018 PT_THREAD (gestionBouton (struct pt *pt)) 00019 { 00020 PT_BEGIN (pt) ; 00021 while (1) 00022 { 00023 /*expect for having flag*/ 00024 PT_WAIT_UNTIL (pt, Flag_PT.gestionBouton >0); 00025 if (pt, Flag_PT.gestionBouton == 1) 00026 { 00027 Flag_PT.gestionBouton= 0 ; 00028 /*******************/ 00029 /*Handling Button 1*/ 00030 /*******************/ 00031 if(ETAT_BOUTON1==0) 00032 { 00033 if(BOUTON1==0) 00034 { 00035 BOUTON1=1; 00036 //LED_TEST1_TOG; 00037 } 00038 } 00039 else 00040 { 00041 if (BOUTON1 == 1) 00042 { 00043 BOUTON1 = 0; 00044 //LED_TEST1_TOG; 00045 /*TODO : Positionning the flags for the tested message by pressing Button1*/ 00046 /***********************************USER DEFINED*******************************/ 00047 #if defined(NOEUD) 00048 Flag_PT.Test_NWK_Node = 1; 00049 #endif 00050 /******************************************************************************/ 00051 } 00052 } 00053 /*******************/ 00054 /*Handling Button 2*/ 00055 /*******************/ 00056 if(ETAT_BOUTON2==0) 00057 { 00058 if(BOUTON2==0) 00059 { 00060 BOUTON2=1; 00061 //LED_TEST2_TOG; 00062 } 00063 } 00064 else 00065 { 00066 if (BOUTON2 == 1) 00067 { 00068 BOUTON2 = 0; 00069 //LED_TEST2_TOG; 00070 /*TODO : Positionning the flags for the tested message by pressing Button2*/ 00071 /***********************************USER DEFINED*******************************/ 00072 #if defined(NOEUD) 00073 Flag_PT.Test_NWK_Node = 2; 00074 #endif 00075 /******************************************************************************/ 00076 } 00077 } 00078 /*******************/ 00079 /*Handling Button 3*/ 00080 /*******************/ 00081 if(ETAT_BOUTON3==0) 00082 { 00083 if(BOUTON3==0) 00084 { 00085 BOUTON3=1; 00086 //LED_TEST3_TOG; 00087 } 00088 } 00089 else 00090 { 00091 if (BOUTON3 == 1) 00092 { 00093 BOUTON3 = 0; 00094 //LED_TEST3_TOG; 00095 /*TODO : Positionning the flags for the tested message by pressing Button3*/ 00096 /***********************************USER DEFINED*******************************/ 00097 #if defined(NOEUD) 00098 Flag_PT.Test_NWK_Node = 3; 00099 #endif 00100 /******************************************************************************/ 00101 } 00102 } 00103 /*******************/ 00104 /*Handling Button 4*/ 00105 /*******************/ 00106 if(ETAT_BOUTON4==0) 00107 { 00108 if(BOUTON4==0) 00109 { 00110 BOUTON4=1; 00111 //LED_TEST4_TOG; 00112 } 00113 } 00114 else 00115 { 00116 if (BOUTON4 == 1) 00117 { 00118 BOUTON4 = 0; 00119 //LED_TEST4_TOG; 00120 /*TODO : Positionning the flags for the tested message by pressing Button4*/ 00121 /***********************************USER DEFINED*******************************/ 00122 #if defined(NOEUD) 00123 F_TimeOut.Test_NWK = 4; 00124 #endif 00125 /******************************************************************************/ 00126 } 00127 } 00128 } 00129 } 00130 PT_END (pt) ; 00131 }