rev_20211121

Dependencies:   HEPTA_SENSOR mbed HEPTA_EPS HEPTA_COM HEPTA_CDH

Files at this revision

API Documentation at this revision

Comitter:
heptasat2021
Date:
Fri Dec 03 11:09:33 2021 +0000
Parent:
29:eb84063fe5c9
Commit message:
20211203_changeinterrupt

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r eb84063fe5c9 -r f300d1e88f4c main.cpp
--- a/main.cpp	Sun Nov 21 02:23:58 2021 +0000
+++ b/main.cpp	Fri Dec 03 11:09:33 2021 +0000
@@ -13,25 +13,6 @@
 Serial sat(USBTX,USBRX,9600);
 Timer sattime;
 int rcmd = 0,cmdflag = 0; //command variable
- 
-//getting command and flag
-void commandget()
-{
-    rcmd=com.getc();
-    cmdflag = 1;
-}
-//interrupting 
-void receive(int rcmd, int cmdflag)
-{
-    com.xbee.attach(commandget,Serial::RxIrq);
-}
-//initialzing
-void initialize()
-{
-    rcmd = 0;
-    cmdflag = 0;
-    condition = 0;
-}
 
 int main() {
     sat.printf("From Sat : Nominal Operation\r\n");
@@ -41,9 +22,10 @@
     float batvol, temp; //voltage, temperature 
     int rcmd=0,cmdflag=0;  //command variable
     sattime.start();
-    receive(rcmd,cmdflag); //interupting by ground station command
     eps.turn_on_regulator();//turn on 3.3V conveter
     for(int i = 0; i < 100; i++) {
+        com.xbee_receive(&rcmd,&cmdflag);//interupting by ground station command
+        
         //satellite condition led
         condition = !condition;
         
@@ -107,7 +89,7 @@
                 //Please insert your answer
 
             }
-            initialize();
+            com.initialize();
         }
     }
     sattime.stop();