MODSERIAL

Dependencies:   HCSR04_2 MODSERIAL MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_22 by 航空研究会

Revision:
20:5befe788d303
Parent:
19:870b3004bc23
diff -r 870b3004bc23 -r 5befe788d303 main.cpp
--- a/main.cpp	Tue Sep 18 06:01:03 2018 +0000
+++ b/main.cpp	Tue Sep 18 08:04:37 2018 +0000
@@ -181,7 +181,6 @@
 
 unsigned int g_distance;
 //Ticker USsensor;
-static char g_buf[16];
 char g_landingcommand='Z';
 float g_SerialTargetYAW;
 
@@ -190,7 +189,7 @@
 Timeout RerurnChickenServo2;
 
 /*-----関数のプロトタイプ宣言-----*/
-void setup(MODSERIAL_IRQ_INFO *info);
+void setup();
 void loop();
 
 void Init_PWM();
@@ -220,7 +219,7 @@
 void Output_PWM(int16_t pwm[6]);    //pwmをサーボへ出力
 
 //シリアル割り込み
-void getSF_Serial();
+void getSF_Serial(MODSERIAL_IRQ_INFO *info);
 float ConvertByteintoFloat(char high, char low);
 
 
@@ -279,7 +278,7 @@
 
 int main()
 {   
-    setup(&info);
+    setup();
     
     
     while(1){
@@ -298,9 +297,8 @@
     
 }
 
-void setup(MODSERIAL_IRQ_INFO *info){
+void setup(){
     //buzzer = 0;
-    MODSERIAL *pc = info->serial;
     led1 = 1;
     led2 = 1;
     led3 = 1;
@@ -329,7 +327,7 @@
     Init_sbus();    
     Init_sensors();
     //switch2.rise(ResetTrim);
-    pc.attach(&getSF_Serial, PA_2);
+    pc.attach(&getSF_Serial, MODSERIAL::RxIrq);
     //USsensor.attach(&UpdateDist, 0.05);
     
     NVIC_SetPriority(USART1_IRQn,0);
@@ -365,7 +363,6 @@
     led4 = 0;
     wait(0.2);
     
-    
     pc.printf("All initialized\r\n");
 }
 
@@ -452,7 +449,7 @@
                 count_op++;
                 if(count_op > changeModeCount){
                     operation_mode = SemiAuto;
-                    pc.printf("Goto SemiAuto mode\r\n");
+                    pc->printf("Goto SemiAuto mode\r\n");
                     count_op = 0;
                 }
             }else count_op = 0;
@@ -465,7 +462,7 @@
                 if(count_op>changeModeCount){
                     output_status = XXX;
                     led2 = 0;
-                    pc.printf("Goto XXX mode\r\n");
+                    pc->printf("Goto XXX mode\r\n");
                     count_op = 0;
                 }else count_op = 0;
                 ConvertPWMintoRAD(targetAngle);
@@ -1028,7 +1025,7 @@
 }
 
 
-void getSF_Serial(){
+void getSF_Serial(MODSERIAL_IRQ_INFO *info){
     
         static char SFbuf[16];
         static int bufcounter=0;