summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorukw2010-07-01 08:53:53 +0000
committerukw2010-07-01 08:53:53 +0000
commit6db2522c3e6c0e2cf0958dc4bdcdaf5ed0fbbcc2 (patch)
tree1c5f906867c9b00778547142b5d2609a8c198c51
parente7b45b7b6b6a498b2b78f462155aa0d0af980e0a (diff)
downloadirmp-6db2522c3e6c0e2cf0958dc4bdcdaf5ed0fbbcc2.zip
Version 1.7.2: added timeout for NEC repetition frames
git-svn-id: svn://mikrocontroller.net/irmp@41 aeb2e35e-bfc4-4214-b83c-9e8de998ed28
-rw-r--r--IR-Data/nec-repetition.txt10
-rw-r--r--IR-Data/nec.txt14
-rw-r--r--README.txt2
-rw-r--r--irmp.aps2
-rw-r--r--irmp.c37
-rw-r--r--irmp.exebin19968 -> 19968 bytes
6 files changed, 37 insertions, 28 deletions
diff --git a/IR-Data/nec-repetition.txt b/IR-Data/nec-repetition.txt
index 93fdc90..c3bf2e7 100644
--- a/IR-Data/nec-repetition.txt
+++ b/IR-Data/nec-repetition.txt
@@ -1,8 +1,2 @@
-# NEC HOME
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111110000001111100000001111000000011111111111111110000001111100000001111000000011111000000111110000001111111111111111000000011111111111111110000001111100000001111000000011111111111111110000001111111111111111000000011111111111111110000001111111111111111000000011111000000111110000000111111111111111000000011111111111111110000001111100000001111000000011111000000111110000001111100000001111111111111111000000111110000000111100000001111111111111111000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000111111111111111
-# rep:
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
-# rep:
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
-# rep:
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
+# NEC HOME + 3 x repetition
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111110000001111100000001111000000011111111111111110000001111100000001111000000011111000000111110000001111111111111111000000011111111111111110000001111100000001111000000011111111111111110000001111111111111111000000011111111111111110000001111111111111111000000011111000000111110000000111111111111111000000011111111111111110000001111100000001111000000011111000000111110000001111100000001111111111111111000000111110000000111100000001111111111111111000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
diff --git a/IR-Data/nec.txt b/IR-Data/nec.txt
index 4310c76..4753fb9 100644
--- a/IR-Data/nec.txt
+++ b/IR-Data/nec.txt
@@ -1,10 +1,4 @@
-0000# -10 - IR-cmd: 0x00E0
-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111100000001111100000011111000000011110000000111110000000111100000001111000000011111000000111110000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000011111111111111110000001111111111111111000000011111111111111110000000111111111111111100000011111111111111110000000111111111111111100000001111111111111111000000111110000000111110000001111100000011111000000011111000000111110000001111100000001111100000011111111111111110000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000011111111111111111111
-# repetion frame
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000111111111111111111111111111
-# repetion frame
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000111111111111111111111111111
-# play/pause - IR-cmd: 0x0060
-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111110000001111100000001111100000011111000000111110000000111110000001111100000011111000000011111000000111111111111111100000001111111111111111000000011111111111111110000001111111111111111000000011111111111111110000000111111111111111100000011111111111111110000000111111111111111100000001111000000011111111111111110000000111111111111111100000001111000000011111000000111110000000111100000001111100000011111111111111110000000111110000001111100000001111111111111111000000011111111111111100000001111111111111111000000011111111111111110000000111111111111111100000001111111111111111111
-# repetion frame
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000111111111111111111111111111
+0000# -10 - IR-cmd: 0x00E0 + 2 repetition frames
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111100000001111100000011111000000011110000000111110000000111100000001111000000011111000000111110000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000011111111111111110000001111111111111111000000011111111111111110000000111111111111111100000011111111111111110000000111111111111111100000001111111111111111000000111110000000111110000001111100000011111000000011111000000111110000001111100000001111100000011111111111111110000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000111111111111111111111111111
+# play/pause - IR-cmd: 0x0060 + 1 repetition frame
+000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111110000001111100000001111100000011111000000111110000000111110000001111100000011111000000011111000000111111111111111100000001111111111111111000000011111111111111110000001111111111111111000000011111111111111110000000111111111111111100000011111111111111110000000111111111111111100000001111000000011111111111111110000000111111111111111100000001111000000011111000000111110000000111100000001111100000011111111111111110000000111110000001111100000001111111111111111000000011111111111111100000001111111111111111000000011111111111111110000000111111111111111100000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000111111111111111111111111111
diff --git a/README.txt b/README.txt
index e5b3992..0050468 100644
--- a/README.txt
+++ b/README.txt
@@ -1,7 +1,7 @@
IRMP - Infrared Multi Protocol Decoder
--------------------------------------
-Version IRMP: 1.7.1 26.06.2010
+Version IRMP: 1.7.2 01.07.2010
Version IRSND: 1.7.0 25.06.2010
Dokumentation:
diff --git a/irmp.aps b/irmp.aps
index 65904eb..fd607a2 100644
--- a/irmp.aps
+++ b/irmp.aps
@@ -1 +1 @@
-<AVRStudio><MANAGEMENT><ProjectName>irmp</ProjectName><Created>07-Jan-2010 20:23:49</Created><LastEdit>23-Jun-2010 08:52:11</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>07-Jan-2010 20:23:49</Created><Version>4</Version><Build>4, 18, 0, 670</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\irmp.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\avr\irmp\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega88.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>irmp.c</SOURCEFILE><HEADERFILE>irmp.h</HEADERFILE><HEADERFILE>irmpconfig.h</HEADERFILE><OTHERFILE>default\irmp.lss</OTHERFILE><OTHERFILE>default\irmp.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega88</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>irmp.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\WinAVR-20090313\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\WinAVR-20090313\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>C:\avr\irmp\irmp.h</Name><Name>C:\avr\irmp\irmpconfig.h</Name><Name>C:\avr\irmp\main.c</Name><Name>C:\avr\irmp\irmp.c</Name></Files></ProjectFiles><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>irmp.c</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>irmp.h</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>irmpconfig.h</FileName><Status>1</Status></File00003></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
+<AVRStudio><MANAGEMENT><ProjectName>irmp</ProjectName><Created>07-Jan-2010 20:23:49</Created><LastEdit>29-Jun-2010 11:22:31</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>07-Jan-2010 20:23:49</Created><Version>4</Version><Build>4, 18, 0, 670</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\irmp.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\avr\irmp\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega88.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>irmp.c</SOURCEFILE><HEADERFILE>irmp.h</HEADERFILE><HEADERFILE>irmpconfig.h</HEADERFILE><OTHERFILE>default\irmp.lss</OTHERFILE><OTHERFILE>default\irmp.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega88</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>irmp.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>irmp.c</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>irmp.h</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>irmpconfig.h</FileName><Status>1</Status></File00003></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
diff --git a/irmp.c b/irmp.c
index 99439d6..861836c 100644
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.c,v 1.73 2010/06/26 18:13:11 fm Exp $
+ * $Id: irmp.c,v 1.75 2010/07/01 09:00:16 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -352,7 +352,7 @@ typedef uint8_t PAUSE_LEN;
#endif
#define IRMP_TIMEOUT_LEN (PAUSE_LEN)(F_INTERRUPTS * IRMP_TIMEOUT_TIME + 0.5)
-#define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
+#define IRMP_KEY_REPETITION_LEN (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5) // autodetect key repetition within 150 msec
#define MIN_TOLERANCE_00 1.0 // -0%
#define MAX_TOLERANCE_00 1.0 // +0%
@@ -404,6 +404,13 @@ typedef uint8_t PAUSE_LEN;
#define NEC_1_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
#define NEC_0_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)
#define NEC_0_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)
+// autodetect nec repetition frame within 50 msec:
+// NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms
+#if 0
+#define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * NEC_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)
+#else
+#define NEC_FRAME_REPEAT_PAUSE_LEN_MAX (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)
+#endif
#define SAMSUNG_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)
#define SAMSUNG_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SAMSUNG_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)
@@ -630,9 +637,9 @@ irmp_uart_init (void)
UART0_UBRRL = UBRRL_VALUE;
#if USE_2X
- UART0_UCSRA = (1<<U2X);
+ UART0_UCSRA |= (1<<U2X);
#else
- UART0_UCSRA = 0;
+ UART0_UCSRA &= ~(1<<U2X);
#endif
UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;
@@ -1460,7 +1467,10 @@ irmp_ISR (void)
}
else
{
- repetition_counter++;
+ if (repetition_counter < 0xFFFF) // avoid overflow of counter
+ {
+ repetition_counter++;
+ }
}
}
}
@@ -2391,9 +2401,20 @@ irmp_ISR (void)
#if IRMP_SUPPORT_NEC_PROTOCOL == 1
if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame
{
- irmp_tmp_address = last_irmp_address; // address is last address
- irmp_tmp_command = last_irmp_command; // command is last command
- irmp_flags |= IRMP_FLAG_REPETITION;
+ if (repetition_counter < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)
+ {
+ ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_counter = %d\n", repetition_counter);
+ irmp_tmp_address = last_irmp_address; // address is last address
+ irmp_tmp_command = last_irmp_command; // command is last command
+ irmp_flags |= IRMP_FLAG_REPETITION;
+ repetition_counter = 0;
+ }
+ else
+ {
+ ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_counter = %d > %d\n",
+ repetition_counter, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);
+ irmp_ir_detected = FALSE;
+ }
}
#endif // IRMP_SUPPORT_NEC_PROTOCOL
irmp_protocol = irmp_param.protocol;
diff --git a/irmp.exe b/irmp.exe
index def6a75..8c536cc 100644
--- a/irmp.exe
+++ b/irmp.exe
Binary files differ