]> cloudbase.mooo.com Git - irmp.git/blobdiff - irsnd.c
version 2.0.0-pre1: added NEC42 protocol
[irmp.git] / irsnd.c
diff --git a/irsnd.c b/irsnd.c
index da0996086486018b4d35fff6163d696a3f7988bb..5f471a6c2f965504edfebb3b0a0f37ea99f065d0 100644 (file)
--- a/irsnd.c
+++ b/irsnd.c
@@ -3,7 +3,7 @@
  *\r
  * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irsnd.c,v 1.29 2011/01/18 13:02:15 fm Exp $\r
+ * $Id: irsnd.c,v 1.32 2011/02/22 17:05:57 fm Exp $\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
@@ -153,15 +153,15 @@ typedef uint8_t     IRSND_PAUSE_LEN;
 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN      (uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME + 0.5)\r
 #define BANG_OLUFSEN_FRAME_REPEAT_PAUSE_LEN     (uint16_t)(F_INTERRUPTS * BANG_OLUFSEN_FRAME_REPEAT_PAUSE_TIME + 0.5)       // use uint16_t!\r
 \r
-#define GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN          (uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_PRE_PAUSE_TIME + 0.5)\r
-#define GRUNDIG_OR_NOKIA_BIT_LEN                (uint8_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_BIT_TIME + 0.5)\r
+#define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN  (uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME + 0.5)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN        (uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME + 0.5)\r
 #define GRUNDIG_AUTO_REPETITION_PAUSE_LEN       (uint16_t)(F_INTERRUPTS * GRUNDIG_AUTO_REPETITION_PAUSE_TIME + 0.5)         // use uint16_t!\r
 #define NOKIA_AUTO_REPETITION_PAUSE_LEN         (uint16_t)(F_INTERRUPTS * NOKIA_AUTO_REPETITION_PAUSE_TIME + 0.5)           // use uint16_t!\r
-#define GRUNDIG_OR_NOKIA_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * GRUNDIG_OR_NOKIA_FRAME_REPEAT_PAUSE_TIME + 0.5)   // use uint16_t!\r
+#define GRUNDIG_NOKIA_IR60_FRAME_REPEAT_PAUSE_LEN (uint16_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_FRAME_REPEAT_PAUSE_TIME + 0.5)   // use uint16_t!\r
 \r
-#define SIEMENS_START_BIT_LEN                   (uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME + 0.5)\r
-#define SIEMENS_BIT_LEN                         (uint8_t)(F_INTERRUPTS * SIEMENS_BIT_TIME + 0.5)\r
-#define SIEMENS_FRAME_REPEAT_PAUSE_LEN          (uint16_t)(F_INTERRUPTS * SIEMENS_FRAME_REPEAT_PAUSE_TIME + 0.5)            // use uint16_t!\r
+#define SIEMENS_START_BIT_LEN                   (uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_START_BIT_PULSE_TIME + 0.5)\r
+#define SIEMENS_BIT_LEN                         (uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PULSE_TIME + 0.5)\r
+#define SIEMENS_FRAME_REPEAT_PAUSE_LEN          (uint16_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_FRAME_REPEAT_PAUSE_TIME + 0.5)  // use uint16_t!\r
 \r
 #define IRSND_FREQ_32_KHZ                       (uint8_t) ((F_CPU / 32000 / 2) - 1)\r
 #define IRSND_FREQ_36_KHZ                       (uint8_t) ((F_CPU / 36000 / 2) - 1)\r
@@ -1050,15 +1050,15 @@ irsnd_ISR (void)
 #if IRSND_SUPPORT_GRUNDIG_PROTOCOL == 1\r
                     case IRMP_GRUNDIG_PROTOCOL:\r
                     {\r
-                        startbit_pulse_len          = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                        startbit_pause_len          = GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN - 1;\r
-                        pulse_len                   = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                        pause_len                   = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                        has_stop_bit                = GRUNDIG_OR_NOKIA_STOP_BIT;\r
+                        startbit_pulse_len          = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                        startbit_pause_len          = GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN - 1;\r
+                        pulse_len                   = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                        pause_len                   = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                        has_stop_bit                = GRUNDIG_NOKIA_IR60_STOP_BIT;\r
                         complete_data_len           = GRUNDIG_COMPLETE_DATA_LEN;\r
                         n_auto_repetitions          = GRUNDIG_FRAMES;                               // 2 frames\r
                         auto_repetition_pause_len   = GRUNDIG_AUTO_REPETITION_PAUSE_LEN;            // 20m sec pause\r
-                        repeat_frame_pause_len      = GRUNDIG_OR_NOKIA_FRAME_REPEAT_PAUSE_LEN;      // 117 msec pause\r
+                        repeat_frame_pause_len      = GRUNDIG_NOKIA_IR60_FRAME_REPEAT_PAUSE_LEN;      // 117 msec pause\r
                         irsnd_set_freq (IRSND_FREQ_38_KHZ);\r
 \r
                         break;\r
@@ -1067,15 +1067,15 @@ irsnd_ISR (void)
 #if IRSND_SUPPORT_NOKIA_PROTOCOL == 1\r
                     case IRMP_NOKIA_PROTOCOL:\r
                     {\r
-                        startbit_pulse_len          = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                        startbit_pause_len          = GRUNDIG_OR_NOKIA_PRE_PAUSE_LEN - 1;\r
-                        pulse_len                   = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                        pause_len                   = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                        has_stop_bit                = GRUNDIG_OR_NOKIA_STOP_BIT;\r
+                        startbit_pulse_len          = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                        startbit_pause_len          = GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN - 1;\r
+                        pulse_len                   = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                        pause_len                   = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                        has_stop_bit                = GRUNDIG_NOKIA_IR60_STOP_BIT;\r
                         complete_data_len           = NOKIA_COMPLETE_DATA_LEN;\r
                         n_auto_repetitions          = NOKIA_FRAMES;                                 // 2 frames\r
                         auto_repetition_pause_len   = NOKIA_AUTO_REPETITION_PAUSE_LEN;              // 20 msec pause\r
-                        repeat_frame_pause_len      = GRUNDIG_OR_NOKIA_FRAME_REPEAT_PAUSE_LEN;      // 117 msec pause\r
+                        repeat_frame_pause_len      = GRUNDIG_NOKIA_IR60_FRAME_REPEAT_PAUSE_LEN;      // 117 msec pause\r
                         irsnd_set_freq (IRSND_FREQ_38_KHZ);\r
                         break;\r
                     }\r
@@ -1087,7 +1087,7 @@ irsnd_ISR (void)
                         startbit_pause_len          = SIEMENS_BIT_LEN;\r
                         pulse_len                   = SIEMENS_BIT_LEN;\r
                         pause_len                   = SIEMENS_BIT_LEN;\r
-                        has_stop_bit                = SIEMENS_STOP_BIT;\r
+                        has_stop_bit                = SIEMENS_OR_RUWIDO_STOP_BIT;\r
                         complete_data_len           = SIEMENS_COMPLETE_DATA_LEN - 1;\r
                         n_auto_repetitions          = 1;                                            // 1 frame\r
                         auto_repetition_pause_len   = 0;\r
@@ -1419,7 +1419,7 @@ irsnd_ISR (void)
 \r
                                 if (repeat_counter > 0)\r
                                 {                                       // set 117 msec pause time\r
-                                    auto_repetition_pause_len = GRUNDIG_OR_NOKIA_FRAME_REPEAT_PAUSE_LEN;\r
+                                    auto_repetition_pause_len = GRUNDIG_NOKIA_IR60_FRAME_REPEAT_PAUSE_LEN;\r
                                 }\r
 \r
                                 if (repeat_counter < n_repeat_frames)       // tricky: repeat n info frames per auto repetition before sending last stop frame\r
@@ -1464,8 +1464,8 @@ irsnd_ISR (void)
                             }\r
                             else                                                                        // send n'th bit\r
                             {\r
-                                pulse_len = GRUNDIG_OR_NOKIA_BIT_LEN;\r
-                                pause_len = GRUNDIG_OR_NOKIA_BIT_LEN;\r
+                                pulse_len = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
+                                pause_len = GRUNDIG_NOKIA_IR60_BIT_LEN;\r
                                 first_pulse = (irsnd_buffer[current_bit / 8] & (1<<(7-(current_bit % 8)))) ? TRUE : FALSE;\r
                             }\r
                         }\r