Added a new Brand "Kamoona" to be used for other applications that are not a known brand.

Fork of RemoteIR by Shinichiro Nakamura

Files at this revision

API Documentation at this revision

Comitter:
mskamoona
Date:
Sun Apr 19 19:11:32 2015 +0000
Parent:
11:268cc2ab63bd
Child:
13:ddc6f7c92583
Child:
14:257b2f794dc4
Commit message:
Before changing ReceiverIR.cpp

Changed in this revision

ReceiverIR.h Show annotated file Show diff for this revision Revisions of this file
RemoteIR.h Show annotated file Show diff for this revision Revisions of this file
TransmitterIR.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ReceiverIR.h	Mon Sep 20 00:54:59 2010 +0000
+++ b/ReceiverIR.h	Sun Apr 19 19:11:32 2015 +0000
@@ -72,6 +72,7 @@
         int c3;
         int d1;
         int d2;
+        int d3;
     } work_t;
 
     InterruptIn evt;    /**< Interrupt based input for input. */
--- a/RemoteIR.h	Mon Sep 20 00:54:59 2010 +0000
+++ b/RemoteIR.h	Sun Apr 19 19:11:32 2015 +0000
@@ -17,12 +17,17 @@
         NEC_REPEAT,
         AEHA,
         AEHA_REPEAT,
-        SONY
+        SONY,
+        Samsung,
+        Samsung_REPEAT,
+        Nikon,
     } Format;
 
     static const int TUS_NEC = 562;
     static const int TUS_AEHA = 425;
     static const int TUS_SONY = 600;
+    static const int TUS_Samsung = 546;
+    static const int TUS_Nikon = 25;
 
 private:
     RemoteIR();
--- a/TransmitterIR.cpp	Mon Sep 20 00:54:59 2010 +0000
+++ b/TransmitterIR.cpp	Sun Apr 19 19:11:32 2015 +0000
@@ -89,6 +89,14 @@
             ticker.detach();
             ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_SONY);
             break;
+        case RemoteIR::Samsung:
+            ticker.detach();
+            ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_Samsung);
+            break;    
+        case RemoteIR::Nikon:
+            ticker.detach();
+            ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_Nikon);
+            break;
     }
 
     UNLOCK();
@@ -150,6 +158,36 @@
                 if ((LEADER_SONY_HEAD + LEADER_SONY_TAIL) <= work.leader) {
                     work.state = Data;
                 }
+            } else if (data.format == RemoteIR::Samsung) {
+                /*
+                 * SONY.
+                 */
+                static const int LEADER_Samsung_HEAD = 8;
+                static const int LEADER_Samsung_TAIL = 8;
+                if (work.leader < LEADER_Samsung_HEAD) {
+                    tx.write(0.5);
+                } else {
+                    tx.write(0.0);
+                }
+                work.leader++;
+                if ((LEADER_Samsung_HEAD + LEADER_Samsung_TAIL) <= work.leader) {
+                    work.state = Data;
+                }    
+            } else if (data.format == RemoteIR::Nikon) {
+                /*
+                 * Nikon.
+                 */
+                static const int LEADER_Nikon_HEAD = 0;
+                static const int LEADER_Nikon_TAIL = 0;
+                if (work.leader < LEADER_Nikon_HEAD) {
+                    tx.write(0.5);
+                } else {
+                    tx.write(0.0);
+                }
+                work.leader++;
+                if ((LEADER_Nikon_HEAD + LEADER_Nikon_TAIL) <= work.leader) {
+                    work.state = Data;
+                }
             } else {
             }
             break;
@@ -238,7 +276,34 @@
                 if (data.bitlength <= work.bitcount) {
                     work.state = Trailer;
                 }
-            } else {
+            }else if (data.format == RemoteIR::Samsung) {
+                /*
+                 * Samsung.
+                 */
+                if (work.data == 0) {
+                    tx.write(0.5);
+                    work.data++;
+                } else {
+                    tx.write(0.0);
+                    if (0 != (data.buffer[work.bitcount / 8] & (1 << work.bitcount % 8))) {
+                        if (1 <= work.data) {
+                            work.bitcount++;
+                            work.data = 0;
+                        } else {
+                            work.data++;
+                        }
+                    } else {
+                        if (3 <= work.data) {
+                            work.bitcount++;
+                            work.data = 0;
+                        } else {
+                            work.data++;
+                        }
+                    }
+                }
+                if (data.bitlength <= work.bitcount) {
+                    work.state = Trailer;
+                } else {
             }
             break;
         case Trailer:
@@ -290,6 +355,22 @@
                     work.state = Idle;
                     //ticker.detach();
                 }
+            }else if (data.format == RemoteIR::Samsung) {
+                /*
+                 * Samsung.
+                 */
+                static const int TRAILER_Samsung_HEAD = 1;
+                static const int TRAILER_Samsung_TAIL = 55;
+                if (work.trailer < TRAILER_Samsung_HEAD) {
+                    tx.write(0.5);
+                } else {
+                    tx.write(0.0);
+                }
+                work.trailer++;
+                if ((TRAILER_Samsung_HEAD + TRAILER_Samsung_TAIL) <= work.trailer) {
+                    work.state = Idle;
+                    //ticker.detach();
+                }
             } else {
             }
             break;
@@ -298,3 +379,4 @@
     }
     UNLOCK();
 }
+}