PPM loopback test of PulsePosition library
Dependencies: PulsePosition mbed
Revision 0:4685db4893be, committed 2016-04-21
- Comitter:
- manitou
- Date:
- Thu Apr 21 16:35:13 2016 +0000
- Commit message:
- initial version of loopback test of PulsePosition library
Changed in this revision
diff -r 000000000000 -r 4685db4893be PulsePosition.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PulsePosition.lib Thu Apr 21 16:35:13 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/manitou/code/PulsePosition/#3b67d4bc53ca
diff -r 000000000000 -r 4685db4893be main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 21 16:35:13 2016 +0000 @@ -0,0 +1,41 @@ +// ppmtest port of teensy 3 PulsePosition lib +// use PWM pins on FTM0 D3,D5,D6,D7,D8,D9 +#include "mbed.h" +#include "PulsePosition.h" + +volatile extern uint32_t ticks; +// Simple loopback test: create 1 output to transmit +// test pulses, and 1 input to receive the pulses +PulsePositionOutput myOut; +PulsePositionInput myIn; + +main() { + printf("\nSystemCoreClock %d %s %s\n",SystemCoreClock,__TIME__,__DATE__); + myOut.begin(D3); // connect pins D3 D5 + myIn.begin(D5); + printf("%0X\n",PORTA_PCR1); + myOut.write(1, 600.03); + myOut.write(2, 1500); + myOut.write(3, 759.24); + // slots 4 and 5 will default to 1500 us + myOut.write(6, 1234.56); + + printf("looping\n"); + while(true) { + static int count=0; + int i, num; + + // Every time new data arrives, simply print it + + num = myIn.available(); + if (num > 0) { + count = count + 1; + printf("%d : ",count); + for (i=1; i <= num; i++) { + float val = myIn.read(i); + printf("%f ",val); + } + printf("\n"); + } + } +} \ No newline at end of file
diff -r 000000000000 -r 4685db4893be mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 21 16:35:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file