]> cloudbase.mooo.com Git - irmp.git/blobdiff - irmp.c
Changed irmp_protocol_names to PROGMEM types, added UART routines to main.c
[irmp.git] / irmp.c
diff --git a/irmp.c b/irmp.c
index 851c270f63beb6976962bae3598495d92798815c..18b523a8a66a332e1d4ee95b63954d9e3cae8c3e 100644 (file)
--- a/irmp.c
+++ b/irmp.c
@@ -1,13 +1,11 @@
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
  * irmp.c - infrared multi-protocol decoder, supports several remote control protocols\r
  *\r
- * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de\r
+ * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmp.c,v 1.159 2014/07/09 15:31:25 fm Exp $\r
+ * $Id: irmp.c,v 1.162 2014/09/15 10:27:37 fm Exp $\r
  *\r
- * ATMEGA88 @ 8 MHz\r
- *\r
- * Supported mikrocontrollers:\r
+ * Supported AVR mikrocontrollers:\r
  *\r
  * ATtiny87,  ATtiny167\r
  * ATtiny45,  ATtiny85\r
@@ -498,52 +496,96 @@ static void                                     (*irmp_callback_ptr) (uint8_t);
  *---------------------------------------------------------------------------------------------------------------------------------------------------\r
  */\r
 #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1\r
-char *\r
-irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =\r
+static const char proto_unknown[]       PROGMEM = "UNKNOWN";\r
+static const char proto_sircs[]         PROGMEM = "SIRCS";\r
+static const char proto_nec[]           PROGMEM = "NEC";\r
+static const char proto_samsung[]       PROGMEM = "SAMSUNG";\r
+static const char proto_matsushita[]    PROGMEM = "MATSUSH";\r
+static const char proto_kaseikyo[]      PROGMEM = "KASEIKYO";\r
+static const char proto_recs80[]        PROGMEM = "RECS80";\r
+static const char proto_rc5[]           PROGMEM = "RC5";\r
+static const char proto_denon[]         PROGMEM = "DENON";\r
+static const char proto_rc6[]           PROGMEM = "RC6";\r
+static const char proto_samsung32[]     PROGMEM = "SAMSG32";\r
+static const char proto_apple[]         PROGMEM = "APPLE";\r
+static const char proto_recs80ext[]     PROGMEM = "RECS80EX";\r
+static const char proto_nubert[]        PROGMEM = "NUBERT";\r
+static const char proto_bang_olufsen[]  PROGMEM = "BANG OLU";\r
+static const char proto_grundig[]       PROGMEM = "GRUNDIG";\r
+static const char proto_nokia[]         PROGMEM = "NOKIA";\r
+static const char proto_siemens[]       PROGMEM = "SIEMENS";\r
+static const char proto_fdc[]           PROGMEM = "FDC";\r
+static const char proto_rccar[]         PROGMEM = "RCCAR";\r
+static const char proto_jvc[]           PROGMEM = "JVC";\r
+static const char proto_rc6a[]          PROGMEM = "RC6A";\r
+static const char proto_nikon[]         PROGMEM = "NIKON";\r
+static const char proto_ruwido[]        PROGMEM = "RUWIDO";\r
+static const char proto_ir60[]          PROGMEM = "IR60";\r
+static const char proto_kathrein[]      PROGMEM = "KATHREIN";\r
+static const char proto_netbox[]        PROGMEM = "NETBOX";\r
+static const char proto_nec16[]         PROGMEM = "NEC16";\r
+static const char proto_nec42[]         PROGMEM = "NEC42";\r
+static const char proto_lego[]          PROGMEM = "LEGO";\r
+static const char proto_thomson[]       PROGMEM = "THOMSON";\r
+static const char proto_bose[]          PROGMEM = "BOSE";\r
+static const char proto_a1tvbox[]       PROGMEM = "A1TVBOX";\r
+static const char proto_ortek[]         PROGMEM = "ORTEK";\r
+static const char proto_telefunken[]    PROGMEM = "TELEFUNKEN";\r
+static const char proto_roomba[]        PROGMEM = "ROOMBA";\r
+static const char proto_rcmm32[]        PROGMEM = "RCMM32";\r
+static const char proto_rcmm24[]        PROGMEM = "RCMM24";\r
+static const char proto_rcmm12[]        PROGMEM = "RCMM12";\r
+static const char proto_speaker[]       PROGMEM = "SPEAKER";\r
+static const char proto_lgair[]         PROGMEM = "LGAIR";\r
+static const char proto_samsung48[]     PROGMEM = "SAMSG48";\r
+static const char proto_radio1[]        PROGMEM = "RADIO1";\r
+\r
+const char * const\r
+irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM =\r
 {\r
-    "UNKNOWN",\r
-    "SIRCS",\r
-    "NEC",\r
-    "SAMSUNG",\r
-    "MATSUSH",\r
-    "KASEIKYO",\r
-    "RECS80",\r
-    "RC5",\r
-    "DENON",\r
-    "RC6",\r
-    "SAMSG32",\r
-    "APPLE",\r
-    "RECS80EX",\r
-    "NUBERT",\r
-    "BANG OLU",\r
-    "GRUNDIG",\r
-    "NOKIA",\r
-    "SIEMENS",\r
-    "FDC",\r
-    "RCCAR",\r
-    "JVC",\r
-    "RC6A",\r
-    "NIKON",\r
-    "RUWIDO",\r
-    "IR60",\r
-    "KATHREIN",\r
-    "NETBOX",\r
-    "NEC16",\r
-    "NEC42",\r
-    "LEGO",\r
-    "THOMSON",\r
-    "BOSE",\r
-    "A1TVBOX",\r
-    "ORTEK",\r
-    "TELEFUNKEN",\r
-    "ROOMBA",\r
-    "RCMM32",\r
-    "RCMM24",\r
-    "RCMM12",\r
-    "SPEAKER",\r
-    "LGAIR",\r
-    "SAMSG48",\r
-    "RADIO1"\r
+    proto_unknown,\r
+    proto_sircs,\r
+    proto_nec,\r
+    proto_samsung,\r
+    proto_matsushita,\r
+    proto_kaseikyo,\r
+    proto_recs80,\r
+    proto_rc5,\r
+    proto_denon,\r
+    proto_rc6,\r
+    proto_samsung32,\r
+    proto_apple,\r
+    proto_recs80ext,\r
+    proto_nubert,\r
+    proto_bang_olufsen,\r
+    proto_grundig,\r
+    proto_nokia,\r
+    proto_siemens,\r
+    proto_fdc,\r
+    proto_rccar,\r
+    proto_jvc,\r
+    proto_rc6a,\r
+    proto_nikon,\r
+    proto_ruwido,\r
+    proto_ir60,\r
+    proto_kathrein,\r
+    proto_netbox,\r
+    proto_nec16,\r
+    proto_nec42,\r
+    proto_lego,\r
+    proto_thomson,\r
+    proto_bose,\r
+    proto_a1tvbox,\r
+    proto_ortek,\r
+    proto_telefunken,\r
+    proto_roomba,\r
+    proto_rcmm32,\r
+    proto_rcmm24,\r
+    proto_rcmm12,\r
+    proto_speaker,\r
+    proto_lgair,\r
+    proto_samsung48,\r
+    proto_radio1\r
 };\r
 \r
 #endif\r
@@ -737,79 +779,6 @@ irmp_uart_putc (unsigned char ch)
 #define ENDBITS                        1000                                 // number of sequenced highbits to detect end\r
 #define DATALEN                         700                                 // log buffer size\r
 \r
-#if 0                                                                       // old log routine\r
-\r
-static void\r
-irmp_log (uint8_t val)\r
-{\r
-    static uint8_t  buf[DATALEN];                                           // logging buffer\r
-    static uint16_t buf_idx;                                                // number of written bits\r
-    static uint8_t  startcycles;                                            // current number of start-zeros\r
-    static uint16_t cnt;                                                    // counts sequenced highbits - to detect end\r
-\r
-    if (! val && (startcycles < STARTCYCLES) && !buf_idx)                   // prevent that single random zeros init logging\r
-    {\r
-        startcycles++;\r
-    }\r
-    else\r
-    {\r
-        startcycles = 0;\r
-\r
-        if (! val || (val && buf_idx != 0))                                 // start or continue logging on "0", "1" cannot init logging\r
-        {\r
-            if (buf_idx < DATALEN * 8)                                      // index in range?\r
-            {                                                               // yes\r
-                if (val)\r
-                {\r
-                    buf[(buf_idx / 8)] |=  (1<<(buf_idx % 8));              // set bit\r
-                }\r
-                else\r
-                {\r
-                    buf[(buf_idx / 8)] &= ~(1<<(buf_idx % 8));              // reset bit\r
-                }\r
-\r
-                buf_idx++;\r
-            }\r
-\r
-            if (val)\r
-            {                                                               // if high received then look at log-stop condition\r
-                cnt++;\r
-\r
-                if (cnt > ENDBITS)\r
-                {                                                           // if stop condition is true, output on uart\r
-                    uint16_t i;\r
-\r
-                    for (i = 0; i < STARTCYCLES; i++)\r
-                    {\r
-                        irmp_uart_putc ('0');                               // the ignored starting zeros\r
-                    }\r
-\r
-                    for (i = 0; i < (buf_idx - ENDBITS + 20) / 8; i++)      // transform bitset into uart chars\r
-                    {\r
-                        uint8_t d = buf[i];\r
-                        uint8_t j;\r
-\r
-                        for (j = 0; j < 8; j++)\r
-                        {\r
-                            irmp_uart_putc ((d & 1) + '0');\r
-                            d >>= 1;\r
-                        }\r
-                    }\r
-\r
-                    irmp_uart_putc ('\n');\r
-                    buf_idx = 0;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                cnt = 0;\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-#else                                                                       // new log routine\r
-\r
 static void\r
 irmp_log (uint8_t val)\r
 {\r
@@ -898,8 +867,6 @@ irmp_log (uint8_t val)
     }\r
 }\r
 \r
-#endif\r
-\r
 #else\r
 #define irmp_log(val)\r
 #endif //IRMP_LOGGING\r