AR-610 Receiver

Dependents:   DAQuadrocopter

Revision:
0:7450fa6b4ac5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AR610_LIB.cpp	Wed Mar 06 17:26:54 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "AR610_LIB.h"
+
+Receiver_obj::Receiver_obj(PinName _InterruptPin): _interruptin(_InterruptPin){
+    
+    _interruptin.mode(PullUp);
+    _interruptin.rise(callback(this, &Receiver_obj::STARTTIMER));
+    _interruptin.fall(callback(this, &Receiver_obj::STOPTIMER));
+    
+    }
+    
+double Receiver_obj::CurVal(){
+    return _CurrentPulseWidth_us * CORVALRECIVER;
+    }
+    
+void Receiver_obj::STARTTIMER(void){
+    t_Runtime.reset();
+    t_Runtime.start();
+    }
+    
+void Receiver_obj::STOPTIMER(void){
+    _CurrentPulseWidth_us = t_Runtime;
+    t_Runtime.stop();
+    }
\ No newline at end of file