Receiver interface for the fischertechnik IR control set

Dependencies:   NeedfulThings

Receiver interface for the fischertechnik IR control set.

An mbed port of the code found on this ft community WIKI page The ft IR remote control uses some kind of RC-MM Protocol . When any of the controls is applied the remote control sends updates at a rate of at 1/120ms or 1/90ms depending on the senders frequency setting. Each message delivers the complete remote control status encoded into 30 bits. The structure of the message can be seen in FtControlSetMessage.h.

I assume that the ft control set works fine with standard 38kHz IR detectors. I have used a CHQ0038 from a broken DVD Player. It can be connected directly to the mbed: GND, VCC->3.3V and the signal line to any of the numbered mbed gpios.

The PDM timing of the ft IR control set isn't that exact. Thus receive errors occur quite frequently. I am observing an error rate somewhere between 3% and 5%. This driver "ignores" up to 3 consecutive receive errors, i.e. it just indicates an error but still provides the last correctly received message, before it resets the message to zero after the fourth error.

Files at this revision

API Documentation at this revision

Comitter:
humlet
Date:
Mon Mar 25 21:08:37 2013 +0000
Parent:
4:c1517188f6ec
Child:
6:3cce31050c90
Commit message:
introduction of NeedfulThings lib

Changed in this revision

FtControlSetReceiver.cpp Show annotated file Show diff for this revision Revisions of this file
FtControlSetReceiver.h Show annotated file Show diff for this revision Revisions of this file
--- a/FtControlSetReceiver.cpp	Sat Mar 23 21:51:13 2013 +0000
+++ b/FtControlSetReceiver.cpp	Mon Mar 25 21:08:37 2013 +0000
@@ -20,13 +20,10 @@
     m_pulseIRQ.mode(PullNone); // the CHQ0038 does't like the default pull down
     m_pulseIRQ.fall(this, &FtControlSetReceiver::pulseISR); // we are measuring the distances of falling edges
 
-    // just attch the callbacks here
-    m_messageTimeout.attach_us(this,&FtControlSetReceiver::messageTimeoutISR, 1e9);
-    m_messageTimeout.remove();
-    m_receiveTimeout.attach_us(this,&FtControlSetReceiver::handleReceiveError, 1e9);
-    m_receiveTimeout.remove();
-    m_recoverTimeout.attach_us(this,&FtControlSetReceiver::recoverISR, 1e9);
-    m_recoverTimeout.remove();
+    //  attch the callbacks 
+    m_messageTimeout.attach(this,&FtControlSetReceiver::messageTimeoutISR);
+    m_receiveTimeout.attach(this,&FtControlSetReceiver::handleReceiveError);
+    m_recoverTimeout.attach(this,&FtControlSetReceiver::recoverISR);
 }
 
 /// called on each falling edge on the IR receivers signal line
--- a/FtControlSetReceiver.h	Sat Mar 23 21:51:13 2013 +0000
+++ b/FtControlSetReceiver.h	Mon Mar 25 21:08:37 2013 +0000
@@ -4,24 +4,10 @@
 #include "FtControlSetMessage.h"
 #include "InterruptIn.h"
 #include "FunctionPointer.h"
-#include "Timeout.h"
+#include "TimeoutTweaked.h"
 
 using namespace mbed;
 
-/// Tweaked Timeout class, that publishes the protected TimerEvent methods
-/// remove and insert, which are a bit faster than detach and attach.
-struct TimeoutTweaked : public Timeout {
-    /// calls protected TimerEvent::remove()that
-    /// just removes the timer event from the schedule but keeps the handler attached before
-    inline void remove() {
-        TimerEvent::remove();
-    }
-    /// calls proteccted TimerEvent::insert() that inserts a new timeout event to the schedule at the given timestamp 
-    inline void insert(unsigned int timestamp) {
-        TimerEvent::insert(timestamp);
-    }
-};
-
 /// Receiver interface for the fischertechnik IR control set
 ///
 /// An mbed port of the code found on this <A HREF="http://www.ftcommunity.de/wiki.php?action=show&topic_id=36">ft community WIKI page</a>