IRM2121のfork

Fork of IRM2121 by Fumiya Fujisawa

Files at this revision

API Documentation at this revision

Comitter:
bousiya03
Date:
Sat Nov 15 00:38:54 2014 +0000
Parent:
0:fd5c1ea78a7c
Commit message:
test

Changed in this revision

IRM2121.cpp Show annotated file Show diff for this revision Revisions of this file
IRM2121.h Show annotated file Show diff for this revision Revisions of this file
diff -r fd5c1ea78a7c -r 1f7a3a98a5f5 IRM2121.cpp
--- a/IRM2121.cpp	Sun Nov 09 11:11:37 2014 +0000
+++ b/IRM2121.cpp	Sat Nov 15 00:38:54 2014 +0000
@@ -7,13 +7,15 @@
 #include "IRM2121.h"
 #include "mbed.h"
 
+
 IRM2121::IRM2121(PinName IRM_PIN)
         : _event(IRM_PIN)
         , _timer()
         {
-            _event.rise(this,&IRM2121::_Stop );
-            _event.fall(this,&IRM2121::_Start );
-            _event.disable_irq();
+            //_event.rise(this,&IRM2121::_Stop );
+            //_event.fall(this,&IRM2121::_Start );
+            //_event.disable_irq();
+            
             _Flag = false;
         } 
         
@@ -33,14 +35,18 @@
         _Valid = true;  // When it stops, update the time
         _Busy  = false;
         _Time  = _timer.read_us()-_Time;
-        _event.disable_irq();
+        //_event.rise(this, 0);
+        //_event.fall(this, 0);
+        _event.rise_disable(this,&IRM2121::_Stop);
+        _event.fall_disable(this,&IRM2121::_Start);
       }
 }
 
 void IRM2121::Set()
 {
-     _event.enable_irq();
-     
+     //_event.enable_irq();
+    _event.rise(this,&IRM2121::_Stop);
+    _event.fall(this,&IRM2121::_Start);
 }
 
 int IRM2121::Read()
diff -r fd5c1ea78a7c -r 1f7a3a98a5f5 IRM2121.h
--- a/IRM2121.h	Sun Nov 09 11:11:37 2014 +0000
+++ b/IRM2121.h	Sat Nov 15 00:38:54 2014 +0000
@@ -4,6 +4,8 @@
  #define MBED_IRM_H
 
 #include "mbed.h"
+#include "interruptin_mod.h"
+
 /** IRM2121  class, based on an InterruptIn pin, and a timer
  *  use RoboCup Junior Soccer to find PULSE BALL.
  
@@ -50,7 +52,7 @@
     
   protected:
     
-    InterruptIn     _event;
+    interruptin_mod     _event;
     Timer           _timer;
 
     bool _Flag;
@@ -61,6 +63,9 @@
     void _Start(void);
     void _Stop (void);
     
+    void (*_start_ptr)();
+    void (*_stop_ptr)();
+    
   };
   
   #endif
\ No newline at end of file