forked RemoteIR

Fork of RemoteIR by Shinichiro Nakamura

Files at this revision

API Documentation at this revision

Comitter:
shintamainjp
Date:
Fri Sep 17 21:44:01 2010 +0000
Parent:
9:dcfdac59ef74
Child:
11:268cc2ab63bd
Commit message:

Changed in this revision

ReceiverIR.cpp Show annotated file Show diff for this revision Revisions of this file
ReceiverIR.h Show annotated file Show diff for this revision Revisions of this file
Semaphore.h Show diff for this revision Revisions of this file
TransmitterIR.cpp Show annotated file Show diff for this revision Revisions of this file
TransmitterIR.h Show annotated file Show diff for this revision Revisions of this file
--- a/ReceiverIR.cpp	Fri Sep 17 20:22:38 2010 +0000
+++ b/ReceiverIR.cpp	Fri Sep 17 21:44:01 2010 +0000
@@ -7,8 +7,8 @@
 
 #include "ReceiverIR.h"
 
-#define LOCK() sem.take()
-#define UNLOCK() sem.release()
+#define LOCK()
+#define UNLOCK()
 
 #define InRange(x,y)   ((((y) * 0.7) < (x)) && ((x) < ((y) * 1.3)))
 
@@ -40,7 +40,6 @@
     LOCK();
     State s = work.state;
     UNLOCK();
-    wait_ms(10);
     return s;
 }
 
--- a/ReceiverIR.h	Fri Sep 17 20:22:38 2010 +0000
+++ b/ReceiverIR.h	Fri Sep 17 21:44:01 2010 +0000
@@ -10,7 +10,6 @@
 
 #include <mbed.h>
 
-#include "Semaphore.h"
 #include "RemoteIR.h"
 
 /**
@@ -82,7 +81,6 @@
     InterruptIn evt;    /**< Interrupt based input for input. */
     Timer timer;        /**< Timer for WDT. */
     Ticker ticker;      /**< Tciker for tick. */
-    Semaphore sem;      /**< Semaphore for data. */
     Timeout timeout;    /**< Timeout for tail. */
 
     data_t data;
--- a/Semaphore.h	Fri Sep 17 20:22:38 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#ifndef _SEMAPHORE_H_
-#define _SEMAPHORE_H_
-
-/*
- * http://mbed.org/forum/mbed/topic/181/#comment-799
- */
-
-class Semaphore {
-public:
-    Semaphore(): s(SemFree) {}
-
-    bool take(bool block = true) {
-        int oldval;
-        do {
-            oldval = __ldrex(&s);
-        } while ((block && oldval == SemTaken) || __strex(SemTaken, &s) != 0);
-        if (!block) {
-            __clrex();
-        }
-        return (oldval == SemFree);
-    }
-
-    void release() {
-        s = SemFree;
-    }
-
-private:
-    enum { SemFree, SemTaken };
-    volatile int s;
-};
-
-#endif
\ No newline at end of file
--- a/TransmitterIR.cpp	Fri Sep 17 20:22:38 2010 +0000
+++ b/TransmitterIR.cpp	Fri Sep 17 21:44:01 2010 +0000
@@ -7,8 +7,8 @@
 
 #include "TransmitterIR.h"
 
-#define LOCK() sem.take()
-#define UNLOCK() sem.release()
+#define LOCK()
+#define UNLOCK()
 
 TransmitterIR::TransmitterIR(PinName txpin) : tx(txpin) {
     tx.write(0.0);
@@ -31,7 +31,6 @@
     LOCK();
     State s = work.state;
     UNLOCK();
-    wait_ms(10);
     return s;
 }
 
--- a/TransmitterIR.h	Fri Sep 17 20:22:38 2010 +0000
+++ b/TransmitterIR.h	Fri Sep 17 21:44:01 2010 +0000
@@ -10,7 +10,6 @@
 
 #include <mbed.h>
 
-#include "Semaphore.h"
 #include "RemoteIR.h"
 
 /**
@@ -76,8 +75,7 @@
     Ticker ticker;
     data_t data;
     work_t work;
-    Semaphore sem;
-
+    
     static const int TUS_NEC = 562;
     static const int TUS_AEHA = 425;
     static const int TUS_SONY = 600;