AR-610 Receiver

Dependents:   DAQuadrocopter

Committer:
lordofthestorm12
Date:
Wed Mar 06 17:26:54 2019 +0000
Revision:
0:7450fa6b4ac5
Receiver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lordofthestorm12 0:7450fa6b4ac5 1 #include "mbed.h"
lordofthestorm12 0:7450fa6b4ac5 2 #include "AR610_LIB.h"
lordofthestorm12 0:7450fa6b4ac5 3
lordofthestorm12 0:7450fa6b4ac5 4 Receiver_obj::Receiver_obj(PinName _InterruptPin): _interruptin(_InterruptPin){
lordofthestorm12 0:7450fa6b4ac5 5
lordofthestorm12 0:7450fa6b4ac5 6 _interruptin.mode(PullUp);
lordofthestorm12 0:7450fa6b4ac5 7 _interruptin.rise(callback(this, &Receiver_obj::STARTTIMER));
lordofthestorm12 0:7450fa6b4ac5 8 _interruptin.fall(callback(this, &Receiver_obj::STOPTIMER));
lordofthestorm12 0:7450fa6b4ac5 9
lordofthestorm12 0:7450fa6b4ac5 10 }
lordofthestorm12 0:7450fa6b4ac5 11
lordofthestorm12 0:7450fa6b4ac5 12 double Receiver_obj::CurVal(){
lordofthestorm12 0:7450fa6b4ac5 13 return _CurrentPulseWidth_us * CORVALRECIVER;
lordofthestorm12 0:7450fa6b4ac5 14 }
lordofthestorm12 0:7450fa6b4ac5 15
lordofthestorm12 0:7450fa6b4ac5 16 void Receiver_obj::STARTTIMER(void){
lordofthestorm12 0:7450fa6b4ac5 17 t_Runtime.reset();
lordofthestorm12 0:7450fa6b4ac5 18 t_Runtime.start();
lordofthestorm12 0:7450fa6b4ac5 19 }
lordofthestorm12 0:7450fa6b4ac5 20
lordofthestorm12 0:7450fa6b4ac5 21 void Receiver_obj::STOPTIMER(void){
lordofthestorm12 0:7450fa6b4ac5 22 _CurrentPulseWidth_us = t_Runtime;
lordofthestorm12 0:7450fa6b4ac5 23 t_Runtime.stop();
lordofthestorm12 0:7450fa6b4ac5 24 }