summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IR-Data/nec-repetition.txt4
-rw-r--r--README.txt2
-rw-r--r--irmp.aps2
-rw-r--r--irmp.c63
-rw-r--r--irmp.h32
-rw-r--r--irmpconfig.h69
-rw-r--r--main.c4
7 files changed, 106 insertions, 70 deletions
diff --git a/IR-Data/nec-repetition.txt b/IR-Data/nec-repetition.txt
index f434b92..93fdc90 100644
--- a/IR-Data/nec-repetition.txt
+++ b/IR-Data/nec-repetition.txt
@@ -2,3 +2,7 @@
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111110000001111100000001111000000011111111111111110000001111100000001111000000011111000000111110000001111111111111111000000011111111111111110000001111100000001111000000011111111111111110000001111111111111111000000011111111111111110000001111111111111111000000011111000000111110000000111111111111111000000011111111111111110000001111100000001111000000011111000000111110000001111100000001111111111111111000000111110000000111100000001111111111111111000000111111111111111100000001111111111111111000000111111111111111100000001111111111111111000000111111111111111
# rep:
00000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
+# rep:
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
+# rep:
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111000000011111111111111
diff --git a/README.txt b/README.txt
index 2e2ade7..3e5520c 100644
--- a/README.txt
+++ b/README.txt
@@ -1,6 +1,8 @@
IRMP - Infrared Multi Protocol Decoder
--------------------------------------
+Version: 1.0
+
Dokumentation:
http://www.mikrocontroller.net/articles/IRMP
diff --git a/irmp.aps b/irmp.aps
index 683f7a7..9ad8f4b 100644
--- a/irmp.aps
+++ b/irmp.aps
@@ -1 +1 @@
-<AVRStudio><MANAGEMENT><ProjectName>irmp</ProjectName><Created>07-Jan-2010 20:23:49</Created><LastEdit>09-Mar-2010 09:29:34</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><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><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></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-Mar-2010 11:32:13</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><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 d9f1c1b..422082b 100644
--- a/irmp.c
+++ b/irmp.c
@@ -3,6 +3,8 @@
*
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de
*
+ * $Id: irmp.c,v 1.14 2010/03/29 09:33:29 fm Exp $
+ *
* ATMEGA88 @ 8 MHz
*
* Typical manufacturers:
@@ -266,49 +268,7 @@ typedef unsigned int16 uint16_t;
#endif // unix
#include "irmp.h"
-
-/*---------------------------------------------------------------------------------------------------------------------------------------------------
- * Change settings from 1 to 0 if you want to disable one or more decoders.
- * This saves program space.
- * 1 enable decoder
- * 0 disable decoder
- *---------------------------------------------------------------------------------------------------------------------------------------------------
- */
-#define IRMP_SUPPORT_SIRCS_PROTOCOL 1 // flag: support SIRCS uses ~100 bytes
-#define IRMP_SUPPORT_NEC_PROTOCOL 1 // flag: support NEC + APPLE uses ~250 bytes
-#define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1 // flag: support Samsung + Samsung32 uses ~250 bytes
-#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1 // flag: support Matsushita uses ~50 bytes
-#define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1 // flag: support Kaseikyo uses ~50 bytes
-#define IRMP_SUPPORT_RECS80_PROTOCOL 1 // flag: support RECS80 uses ~50 bytes
-#define IRMP_SUPPORT_RC5_PROTOCOL 1 // flag: support RC5 uses ~250 bytes
-#define IRMP_SUPPORT_DENON_PROTOCOL 1 // flag: support DENON uses ~250 bytes
-#define IRMP_SUPPORT_RC6_PROTOCOL 1 // flag: support RC6 uses ~200 bytes
-#define IRMP_SUPPORT_RECS80EXT_PROTOCOL 1 // flag: support RECS80EXT uses ~50 bytes
-#define IRMP_SUPPORT_NUBERT_PROTOCOL 1 // flag: support NUBERT uses ~50 bytes
-
-/*---------------------------------------------------------------------------------------------------------------------------------------------------
- * Change hardware pin here:
- *---------------------------------------------------------------------------------------------------------------------------------------------------
- */
-#ifdef PIC_CCS_COMPILER // PIC CCS Compiler:
-
-#define IRMP_PIN PIN_B4 // use PB4 as IR input on PIC
-
-#else // AVR:
-
-#define IRMP_PORT PORTB
-#define IRMP_DDR DDRB
-#define IRMP_PIN PINB
-#define IRMP_BIT 6 // use PB6 as IR input on AVR
-
-#define input(x) ((x) & (1 << IRMP_BIT))
-#endif
-
-/*---------------------------------------------------------------------------------------------------------------------------------------------------
- * Set IRMP_LOGGING to 1 if want to log data to UART with 9600Bd
- *---------------------------------------------------------------------------------------------------------------------------------------------------
- */
-#define IRMP_LOGGING 0 // 1: log IR signal (scan), 0: do not (default)
+#include "irmpconfig.h"
#define IRMP_TIMEOUT 120 // timeout after 12 ms darkness
#define IRMP_REPETITION_TIME (uint16_t)(F_INTERRUPTS * 100.0e-3 + 0.5) // autodetect key repetition within 100 msec
@@ -1649,18 +1609,15 @@ irmp_ISR (void)
}
else
#endif // IRMP_SUPPORT_DENON_PROTOCOL
-
-#if IRMP_SUPPORT_NEC_PROTOCOL == 1
- if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0) // repetition frame
{
- irmp_protocol = irmp_param.protocol;
- irmp_address = last_irmp_address; // address is last address
- irmp_command = last_irmp_command; // command is last command
- irmp_flags |= IRMP_FLAG_REPETITION;
- }
- else
+#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;
+ }
#endif // IRMP_SUPPORT_NEC_PROTOCOL
- {
irmp_protocol = irmp_param.protocol;
irmp_address = irmp_tmp_address; // store address
#if IRMP_SUPPORT_NEC_PROTOCOL == 1
diff --git a/irmp.h b/irmp.h
index 4a0bfbd..960fdd0 100644
--- a/irmp.h
+++ b/irmp.h
@@ -3,6 +3,8 @@
*
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de
*
+ * $Id: irmp.h,v 1.11 2010/03/29 09:33:29 fm Exp $
+ *
* ATMEGA88 @ 8 MHz
*
* This program is free software; you can redistribute it and/or modify
@@ -21,24 +23,22 @@ extern "C"
#endif
/*---------------------------------------------------------------------------------------------------------------------------------------------------
- * Change F_INTERRUPTS if you change the number of interrupts per second, F_INTERRUPTS should be in the range from 10000 to 15000
+ * IR protocols
*---------------------------------------------------------------------------------------------------------------------------------------------------
*/
-#define F_INTERRUPTS 10000 // interrupts per second
-
-#define IRMP_SIRCS_PROTOCOL 1 // Sony
-#define IRMP_NEC_PROTOCOL 2 // NEC, Pioneer, JVC, Toshiba, NoName etc.
-#define IRMP_SAMSUNG_PROTOCOL 3 // Samsung
-#define IRMP_MATSUSHITA_PROTOCOL 4 // Matsushita
-#define IRMP_KASEIKYO_PROTOCOL 5 // Kaseikyo (Panasonic etc)
-#define IRMP_RECS80_PROTOCOL 6 // Philips, Thomson, Nordmende, Telefunken, Saba
-#define IRMP_RC5_PROTOCOL 7 // Philips etc
-#define IRMP_DENON_PROTOCOL 8 // Denon
-#define IRMP_RC6_PROTOCOL 9 // Philips etc
-#define IRMP_SAMSUNG32_PROTOCOL 10 // Samsung32: no sync pulse at bit 16, length 32 instead of 37
-#define IRMP_APPLE_PROTOCOL 11 // Apple, very similar to NEC
-#define IRMP_RECS80EXT_PROTOCOL 12 // Philips, Technisat, Thomson, Nordmende, Telefunken, Saba
-#define IRMP_NUBERT_PROTOCOL 13 // Nubert
+#define IRMP_SIRCS_PROTOCOL 1 // Sony
+#define IRMP_NEC_PROTOCOL 2 // NEC, Pioneer, JVC, Toshiba, NoName etc.
+#define IRMP_SAMSUNG_PROTOCOL 3 // Samsung
+#define IRMP_MATSUSHITA_PROTOCOL 4 // Matsushita
+#define IRMP_KASEIKYO_PROTOCOL 5 // Kaseikyo (Panasonic etc)
+#define IRMP_RECS80_PROTOCOL 6 // Philips, Thomson, Nordmende, Telefunken, Saba
+#define IRMP_RC5_PROTOCOL 7 // Philips etc
+#define IRMP_DENON_PROTOCOL 8 // Denon
+#define IRMP_RC6_PROTOCOL 9 // Philips etc
+#define IRMP_SAMSUNG32_PROTOCOL 10 // Samsung32: no sync pulse at bit 16, length 32 instead of 37
+#define IRMP_APPLE_PROTOCOL 11 // Apple, very similar to NEC
+#define IRMP_RECS80EXT_PROTOCOL 12 // Philips, Technisat, Thomson, Nordmende, Telefunken, Saba
+#define IRMP_NUBERT_PROTOCOL 13 // Nubert
#define SIRCS_START_BIT_PULSE_TIME 2400.0e-6 // 2400 usec pulse
#define SIRCS_START_BIT_PAUSE_TIME 600.0e-6 // 600 usec pause
diff --git a/irmpconfig.h b/irmpconfig.h
new file mode 100644
index 0000000..1b86723
--- /dev/null
+++ b/irmpconfig.h
@@ -0,0 +1,69 @@
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * irmpconfig.h
+ *
+ * Copyright (c) 2010 Frank Meyer - frank(at)fli4l.de
+ *
+ * $Id: irmpconfig.h,v 1.1 2010/03/29 09:35:13 fm Exp $
+ *
+ * ATMEGA88 @ 8 MHz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+
+#ifndef _IRMPCONFIG_H_
+#define _IRMPCONFIG_H_
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Change F_INTERRUPTS if you change the number of interrupts per second, F_INTERRUPTS should be in the range from 10000 to 15000
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#define F_INTERRUPTS 10000 // interrupts per second
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Change settings from 1 to 0 if you want to disable one or more decoders.
+ * This saves program space.
+ * 1 enable decoder
+ * 0 disable decoder
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#define IRMP_SUPPORT_SIRCS_PROTOCOL 1 // flag: support SIRCS uses ~100 bytes
+#define IRMP_SUPPORT_NEC_PROTOCOL 1 // flag: support NEC + APPLE uses ~250 bytes
+#define IRMP_SUPPORT_SAMSUNG_PROTOCOL 1 // flag: support Samsung + Samsung32 uses ~250 bytes
+#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL 1 // flag: support Matsushita uses ~50 bytes
+#define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1 // flag: support Kaseikyo uses ~50 bytes
+#define IRMP_SUPPORT_RECS80_PROTOCOL 1 // flag: support RECS80 uses ~50 bytes
+#define IRMP_SUPPORT_RC5_PROTOCOL 1 // flag: support RC5 uses ~250 bytes
+#define IRMP_SUPPORT_DENON_PROTOCOL 1 // flag: support DENON uses ~250 bytes
+#define IRMP_SUPPORT_RC6_PROTOCOL 1 // flag: support RC6 uses ~200 bytes
+#define IRMP_SUPPORT_RECS80EXT_PROTOCOL 1 // flag: support RECS80EXT uses ~50 bytes
+#define IRMP_SUPPORT_NUBERT_PROTOCOL 1 // flag: support NUBERT uses ~50 bytes
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Change hardware pin here:
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#ifdef PIC_CCS_COMPILER // PIC CCS Compiler:
+
+#define IRMP_PIN PIN_B4 // use PB4 as IR input on PIC
+
+#else // AVR:
+
+#define IRMP_PORT PORTB
+#define IRMP_DDR DDRB
+#define IRMP_PIN PINB
+#define IRMP_BIT 6 // use PB6 as IR input on AVR
+
+#define input(x) ((x) & (1 << IRMP_BIT))
+#endif
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Set IRMP_LOGGING to 1 if want to log data to UART with 9600Bd
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#define IRMP_LOGGING 0 // 1: log IR signal (scan), 0: do not (default)
+
+#endif /* _WC_IRMPCONFIG_H_ */
diff --git a/main.c b/main.c
index 2e05660..faab8ea 100644
--- a/main.c
+++ b/main.c
@@ -3,6 +3,8 @@
*
* Copyright (c) 2009-2010 Frank Meyer - frank(at)fli4l.de
*
+ * $Id: main.c,v 1.5 2010/03/29 09:33:29 fm Exp $
+ *
* ATMEGA88 @ 8 MHz
*
* Fuses: lfuse: 0xE2 hfuse: 0xDC efuse: 0xF9
@@ -45,6 +47,8 @@
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "irmp.h"
+#include "irmpconfig.h"
+
#endif // CODEVISION