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.

Revision:
3:038f86bac6cc
Parent:
2:1ae8bb468515
--- a/FtControlSetMessage.h	Mon Mar 18 22:00:53 2013 +0000
+++ b/FtControlSetMessage.h	Wed Mar 20 21:55:20 2013 +0000
@@ -5,27 +5,28 @@
 #include "mbed.h"
 
 /// interface class that translates the raw message of ft IR remote control
+/// @note just a wrapper arround an evil bitfield, not really portable, ... but they are so handy
 class FtControlSetMessage
 {
-    union {
-        /// message structure 2 status bit added by receiver ISR plus 30 payload bits
-        struct {
-            unsigned status:2;      /// @see Status
-            unsigned tail:1;        /// should be 0
-            unsigned parity:1;      /// set if parity even
-            unsigned leftXDir:1;    /// direction left x
-            unsigned leftYDir:1;    /// direction left y
-            unsigned rightXDir:1;   /// direction right x
-            unsigned rightYDir:1;   /// direction right y
-            unsigned leftXSpd:4;    /// speed left x
-            unsigned leftYSpd:4;    /// speed left y
-            unsigned rightXSpd:4;   /// speed right x
-            unsigned rightYSpd:4;   /// speed right y
-            unsigned onBut:1;       /// ON button
-            unsigned offBut:1;      /// OFF button
-            unsigned switch1:1;     /// switch 1
-            unsigned switch2:1;     /// switch 1
-            unsigned header:4;      /// should be 8;
+    union { 
+        //  message structure: 30 payload bits plus 2 status bit added by receiver ISR plus 
+        struct { 
+            unsigned status:2;      // @see Status
+            unsigned tail:1;        // should be 0
+            unsigned parity:1;      // set if parity even
+            unsigned leftXDir:1;    // direction left x
+            unsigned leftYDir:1;    // direction left y
+            unsigned rightXDir:1;   // direction right x
+            unsigned rightYDir:1;   // direction right y
+            unsigned leftXSpd:4;    // speed left x
+            unsigned leftYSpd:4;    // speed left y
+            unsigned rightXSpd:4;   // speed right x
+            unsigned rightYSpd:4;   // speed right y
+            unsigned onBut:1;       // ON button
+            unsigned offBut:1;      // OFF button
+            unsigned switch1:1;     // switch 1
+            unsigned switch2:1;     // switch 1
+            unsigned header:4;      // should be 8;
         };
         uint32_t m_rawMessage;
     };