![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Problems with compilation of MODSERIAL
Revision 0:177adc0899a6, committed 2011-04-08
- Comitter:
- kinemax
- Date:
- Fri Apr 08 20:03:33 2011 +0000
- Commit message:
- Starting test for PwmIn and MODSERIAL libraries
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Fri Apr 08 20:03:33 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AjK/code/MODSERIAL/#6c9b57c14868
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PwmIn.lib Fri Apr 08 20:03:33 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/PwmIn/#6d68eb9b6bbb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 08 20:03:33 2011 +0000 @@ -0,0 +1,55 @@ +// Example PwmIn class to detect PWM inputs, sford +// - Note: uses InterruptIn, so not available on p19/p20 + +#include "mbed.h" +#include "PwmIn.h" +#include "MODSERIAL.h" + +#define BAUD 115200 +#define TX_PIN p9 +#define RX_PIN p10 + + DigitalOut led1(LED1); + DigitalOut led2(LED2); + DigitalOut led3(LED3); + DigitalOut led4(LED4); + + Serial pc(USBTX, USBRX); + MODSERIAL uart(TX_PIN, RX_PIN); + + bool newpacket = false; + +PwmIn a(p21); +PwmIn b(p22), c(p23), d(p24), e(p25); + +int yaw=0,pitch=0,roll=0, Dyaw=0,Dpitch=0,Droll=0,chk=0; + +int main() +{ char ileB=0,kan1=0,kan2=0; + pc.baud(BAUD); + uart.baud(BAUD); + // uart.attach(&rxCallback, MODSERIAL::RxIrq); + pc.printf("Start\n\r"); + + while(1) + { while( uart.rxBufferGetCount() < 21); + + { led1 = 1; // Show start of sending with LED1. + if(uart.getc()=='s') + { led2 =1; + if(uart.getc()=='n') + if(uart.getc()=='p') + if(uart.getc()==0xB7) + { uart.scanf("%c%c%c%2d%2d%2d%2d%2d%2d%2d", ileB,kan1,kan2, yaw,pitch,roll, Dyaw,Dpitch,Droll,chk); + led3=1; newpacket=1; + } + } + } + pc.printf("Bajty= %2d, YPR = %5d %5d %5d Delty = %5d %5d %5d Chk %3d\n\r", ileB, yaw,pitch,roll, Dyaw,Dpitch,Droll,chk); + pc.printf("Kanaly= %5.3f %5.3f %5.3f %5.3f %5.3f\n\r", a.pulsewidth()*1000, a.pulsewidth()*1000, b.pulsewidth()*1000, c.pulsewidth()*1000, d.pulsewidth()*1000, e.pulsewidth()*1000); + wait(1); + + } +} + + // higher than "uart" baud rate below.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 08 20:03:33 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0