![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
a
Dependencies: mbed
Fork of GIMBAL_SAMPLE4_PPM by
PPM/PPMIn.cpp
- Committer:
- halusis
- Date:
- 2018-05-25
- Revision:
- 1:dd6e70abeb8e
- Parent:
- 0:f0b20f502059
File content as of revision 1:dd6e70abeb8e:
#include "mbed.h" #include "PPMIn.h" #include "Pin_Assign.h" PpmIn::PpmIn(PinName pin): ppm(pin)//, pc_com(USBTX, USBRX) { //pc_com.printf("Constructor say hi!"); current_channel = 0; state = false; timer.start(); ppm.rise(this, &PpmIn::rise); } uint16_t* PpmIn::getPpm() { uint16_t* p_out[CHANNELS+2]; *p_out = &channels[0]; //pc_com.printf("%d",channels[0]); return *p_out; } void PpmIn::rise() { uint16_t time = timer.read_us(); //pc.printf("%d\n",time); //pc_com.printf("Rise say hi!"); // we are in synchro zone if(time > 2500) { current_channel = 0; // return values state = true; } else { channels[current_channel] = timer.read_us(); current_channel += 1; } timer.reset(); //if (current_channel > (CHANNELS + 2 - 1)); //+frame and - 1 indexing of channels list }