]> sigrok.org Git - libsigrokdecode.git/blobdiff - irmp/irmp.c
sle44xx: support memory read "to end of capacity"
[libsigrokdecode.git] / irmp / irmp.c
index 05380b9ce3796f3695f4d0d164c0f7a245dd9649..42b04c80d46ddab345e0f0d93105c208cb623226 100644 (file)
@@ -627,15 +627,13 @@ static int                                      silent;
 static int                                      time_counter;
 static int                                      verbose;
 
-/*******************************                not every PIC compiler knows variadic macros :-(
-#else
+#elif 0 /* not every PIC compiler knows variadic macros :-( */
 #  define ANALYZE_PUTCHAR(a)
 #  define ANALYZE_ONLY_NORMAL_PUTCHAR(a)
 #  define ANALYZE_PRINTF(...)
 #  define ANALYZE_ONLY_NORMAL_PRINTF(...)
-#  endif
 #  define ANALYZE_NEWLINE()
-*********************************/
+
 #endif
 
 #if IRMP_USE_CALLBACK == 1
@@ -2978,6 +2976,11 @@ irmp_store_bit2 (uint_fast8_t value)
 }
 #endif // IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)
 
+#ifdef ANALYZE
+static uint32_t s_curSample;
+static uint32_t s_startBitSample;
+#endif
+
 /*---------------------------------------------------------------------------------------------------------------------------------------------------
  *  ISR routine
  *  @details  ISR routine, called 10000 times per second
@@ -3069,6 +3072,7 @@ irmp_ISR (void)
 #ifdef ANALYZE
                 if (! irmp_pulse_time)
                 {
+                    s_startBitSample = s_curSample;
                     ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS);
                 }
 #endif // ANALYZE
@@ -3333,7 +3337,7 @@ irmp_ISR (void)
 #ifdef ANALYZE
                         ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",
                                         NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX,
-                                        NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX);
+                                        (int)NIKON_START_BIT_PAUSE_LEN_MIN, (int)NIKON_START_BIT_PAUSE_LEN_MAX);
 #endif // ANALYZE
                         irmp_param_p = (IRMP_PARAMETER *) &nikon_param;
                     }
@@ -4343,7 +4347,7 @@ irmp_ISR (void)
                                 {
 #ifdef ANALYZE
                                     ANALYZE_PRINTF ("ignoring NEC repetition frame: timeout occured, key_repetition_len = %d > %d\n",
-                                                    key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
+                                                    (int)key_repetition_len, (int)NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
 #endif // ANALYZE
                                     irmp_ir_detected = FALSE;
                                 }
@@ -5189,7 +5193,7 @@ printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN *
                 {
 #ifdef ANALYZE
                     ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
-                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
+                                    repetition_frame_number + 1, (int)key_repetition_len, (int)AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
                     key_repetition_len = 0;
                 }
@@ -5241,7 +5245,7 @@ printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN *
                 {
 #ifdef ANALYZE
                     ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
-                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
+                                    repetition_frame_number + 1, (int)key_repetition_len, (int)AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
                     key_repetition_len = 0;
                 }
@@ -5254,7 +5258,7 @@ printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN *
                 {
 #ifdef ANALYZE
                     ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",
-                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);
+                                    repetition_frame_number + 1, (int)key_repetition_len, (int)AUTO_FRAME_REPETITION_LEN);
 #endif // ANALYZE
                     key_repetition_len = 0;
                 }
@@ -5331,7 +5335,7 @@ printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN *
                             if (key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
                             {
 #ifdef ANALYZE
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len);
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", (int)key_repetition_len);
                                 ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME                ");
 #endif // ANALYZE
                                 irmp_tmp_address = last_irmp_address;                   // address is last address
@@ -5343,7 +5347,7 @@ printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN *
                             {
 #ifdef ANALYZE
                                 ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",
-                                                key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
+                                                (int)key_repetition_len, (int)NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
 #endif // ANALYZE
                                 irmp_ir_detected = FALSE;
                             }
@@ -5556,6 +5560,7 @@ printf ("fm: %d %d\n", irmp_pulse_time * 1000000 / F_INTERRUPTS, RCII_BIT_LEN *
  *---------------------------------------------------------------------------------------------------------------------------------------------------
  */
 
+void print_spectrum (char * text, int * buf, int is_pulse);
 void
 print_spectrum (char * text, int * buf, int is_pulse)
 {
@@ -5677,12 +5682,12 @@ get_fdc_key (uint_fast16_t cmd)
     static uint8_t key_table[128] =
     {
      // 0     1    2    3    4    5    6    7    8     9     A     B     C     D    E    F
-         0,   '^', '1', '2', '3', '4', '5', '6', '7',  '8',  '9',  '0',  0xDF, '´', 0,   '\b',
+         0,   '^', '1', '2', '3', '4', '5', '6', '7',  '8',  '9',  '0',  0xDF, 0xB4, 0,   '\b',
         '\t', 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i',  'o',  'p',  0xFC, '+',   0,   0,   'a',
         's',  'd', 'f', 'g', 'h', 'j', 'k', 'l', 0xF6, 0xE4, '#',  '\r', 0,    '<', 'y', 'x',
         'c',  'v', 'b', 'n', 'm', ',', '.', '-', 0,    0,    0,    0,    0,    ' ', 0,   0,
 
-         0,   '°', '!', '"', '§', '$', '%', '&', '/',  '(',  ')',  '=',  '?',  '`', 0,   '\b',
+         0,   0xB0, '!', '"', 0xA7, '$', '%', '&', '/',  '(',  ')',  '=',  '?',  '`', 0,   '\b',
         '\t', 'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I',  'O',  'P',  0xDC, '*',  0,   0,   'A',
         'S',  'D', 'F', 'G', 'H', 'J', 'K', 'L', 0xD6, 0xC4, '\'', '\r', 0,    '>', 'Y', 'X',
         'C',  'V', 'B', 'N', 'M', ';', ':', '_', 0,    0,    0,    0,    0,    ' ', 0,   0
@@ -5870,7 +5875,7 @@ next_tick (void)
             {
                 if (irmp_data.protocol != expected_protocol ||
                     irmp_data.address  != expected_address  ||
-                    irmp_data.command  != expected_command)
+                    (int)irmp_data.command  != expected_command)
                 {
                     printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",
                             expected_protocol, irmp_protocol_names[expected_protocol], expected_address, expected_command);