![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
MODSERIAL
Dependencies: HCSR04_2 MODSERIAL MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_22 by
Diff: main.cpp
- Revision:
- 19:870b3004bc23
- Parent:
- 18:f3dcb174b563
- Child:
- 20:5befe788d303
--- a/main.cpp Mon Sep 17 10:33:13 2018 +0000 +++ b/main.cpp Tue Sep 18 06:01:03 2018 +0000 @@ -2,6 +2,7 @@ #include "mbed.h" #include "FATFileSystem.h" #include "SDFileSystem.h" +#include "MODSERIAL.h" //C #include "math.h" //sensor @@ -121,7 +122,7 @@ //PwmOut servo7(PB_8); // TIM4_CH3 //PB_8 new echo //PwmOut servo8(PB_9); // TIM4_CH4 //new trigger -RawSerial pc(PA_2,PA_3, 115200); //tx,rx.baudrate pin;PA_2=UART2_TX, PA_3=UART2_RX +MODSERIAL pc(PA_2,PA_3, 115200); //tx,rx.baudrate pin;PA_2=UART2_TX, PA_3=UART2_RX //RawSerial pc2(PB_6,PB_7, 115200); //sbus確認用 SDFileSystem sd(PB_15, PB_14, PB_13, PB_12, "sd"); @@ -189,7 +190,7 @@ Timeout RerurnChickenServo2; /*-----関数のプロトタイプ宣言-----*/ -void setup(); +void setup(MODSERIAL_IRQ_INFO *info); void loop(); void Init_PWM(); @@ -278,7 +279,7 @@ int main() { - setup(); + setup(&info); while(1){ @@ -286,18 +287,20 @@ loop(); - + NVIC_DisableIRQ(USART1_IRQn); if(!CheckSW_Up(Ch7)){ led3=0; }else{ led3=1; } + NVIC_EnableIRQ(USART1_IRQn); } } -void setup(){ +void setup(MODSERIAL_IRQ_INFO *info){ //buzzer = 0; + MODSERIAL *pc = info->serial; led1 = 1; led2 = 1; led3 = 1; @@ -326,7 +329,7 @@ Init_sbus(); Init_sensors(); //switch2.rise(ResetTrim); - pc.attach(getSF_Serial, Serial::RxIrq); + pc.attach(&getSF_Serial, PA_2); //USsensor.attach(&UpdateDist, 0.05); NVIC_SetPriority(USART1_IRQn,0);