Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PPM.cpp
00001 #include "mbed.h" 00002 #include "PPM.h" 00003 00004 PPM::PPM(PinName pin): ppm(pin) 00005 { 00006 for (int i = 0; i < NUM_CHANNELS; i++) 00007 channels[i] = 1500; 00008 currentChannel = 0; 00009 timer.start(); 00010 ppm.rise( callback(this, &PPM::rise) ); 00011 } 00012 00013 void PPM::rise() 00014 { 00015 uint16_t time = timer.read_us(); 00016 timer.reset(); 00017 00018 if ( time > 2500 ) 00019 { 00020 currentChannel = 0; 00021 } 00022 else if ( currentChannel < NUM_CHANNELS ) 00023 { 00024 channels[currentChannel] = time; 00025 currentChannel++; 00026 } 00027 }
Generated on Sun Jul 31 2022 22:47:51 by
1.7.2