summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt4
-rw-r--r--irmp.aps2
-rw-r--r--irmp.c23
-rw-r--r--irmpconfig.h13
-rw-r--r--irmpextlog.c101
-rw-r--r--irmpextlog.h7
-rw-r--r--irsnd.c2
7 files changed, 141 insertions, 11 deletions
diff --git a/README.txt b/README.txt
index e46a70b..28176c1 100644
--- a/README.txt
+++ b/README.txt
@@ -1,8 +1,8 @@
IRMP - Infrared Multi Protocol Decoder
--------------------------------------
-Version IRMP: 2.0.3 13.02.2012
-Version IRSND: 2.0.4 15.02.2012
+Version IRMP: 2.1.0 16.02.2012
+Version IRSND: 2.1.0 16.02.2012
Dokumentation:
diff --git a/irmp.aps b/irmp.aps
index 3e62b7f..97f2a39 100644
--- a/irmp.aps
+++ b/irmp.aps
@@ -1 +1 @@
-<AVRStudio><MANAGEMENT><ProjectName>irmp</ProjectName><Created>07-Jan-2010 20:23:49</Created><LastEdit>12-Sep-2011 09:33:45</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>
+<AVRStudio><MANAGEMENT><ProjectName>irmp</ProjectName><Created>07-Jan-2010 20:23:49</Created><LastEdit>16-Feb-2012 11:39:00</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><SOURCEFILE>irmpextlog.c</SOURCEFILE><HEADERFILE>irmp.h</HEADERFILE><HEADERFILE>irmpconfig.h</HEADERFILE><HEADERFILE>irmpextlog.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="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><File00004><FileId>00004</FileId><FileName>irmpextlog.c</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>irmpextlog.h</FileName><Status>1</Status></File00005></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
diff --git a/irmp.c b/irmp.c
index 9a707ba..1496c6b 100644
--- a/irmp.c
+++ b/irmp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmp.c,v 1.112 2012/02/13 10:59:07 fm Exp $
+ * $Id: irmp.c,v 1.113 2012/02/16 10:40:07 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -756,7 +756,11 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =
* Logging
*---------------------------------------------------------------------------------------------------------------------------------------------------
*/
-#if IRMP_LOGGING == 1
+#if IRMP_LOGGING == 1 // logging via UART
+
+#if IRMP_EXT_LOGGING == 1 // use external logging
+#include "irmpextlog.h"
+#else // normal UART log (IRMP_EXT_LOGGING == 0)
#define BAUD 9600L
#include <util/setbaud.h>
@@ -778,7 +782,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =
#define UART0_TXEN_BIT_VALUE (1<<TXEN0)
#define UART0_UDR UDR0
#define UART0_U2X U2X0
-
+
#else
#define UART0_UBRRH UBRRH
@@ -798,7 +802,8 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =
#define UART0_UDR UDR
#define UART0_U2X U2X
-#endif
+#endif //UBRR0H
+#endif //IRMP_EXT_LOGGING
/*---------------------------------------------------------------------------------------------------------------------------------------------------
* Initialize UART
@@ -808,6 +813,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =
void
irmp_uart_init (void)
{
+#if (IRMP_EXT_LOGGING == 0) // use UART
UART0_UBRRH = UBRRH_VALUE; // set baud rate
UART0_UBRRL = UBRRL_VALUE;
@@ -819,6 +825,9 @@ irmp_uart_init (void)
UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;
UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX
+#else // other log method
+ initextlog();
+#endif //IRMP_EXT_LOGGING
}
/*---------------------------------------------------------------------------------------------------------------------------------------------------
@@ -830,12 +839,16 @@ irmp_uart_init (void)
void
irmp_uart_putc (unsigned char ch)
{
+#if (IRMP_EXT_LOGGING == 0)
while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE))
{
;
}
UART0_UDR = ch;
+#else
+ sendextlog(ch); //Use external log
+#endif
}
/*---------------------------------------------------------------------------------------------------------------------------------------------------
@@ -918,7 +931,7 @@ irmp_log (uint8_t val)
#else
#define irmp_log(val)
-#endif
+#endif //IRMP_LOGGING
typedef struct
{
diff --git a/irmpconfig.h b/irmpconfig.h
index ca813ca..2349fa0 100644
--- a/irmpconfig.h
+++ b/irmpconfig.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de
*
- * $Id: irmpconfig.h,v 1.77 2011/09/22 10:36:22 fm Exp $
+ * $Id: irmpconfig.h,v 1.78 2012/02/16 10:40:08 fm Exp $
*
* ATMEGA88 @ 8 MHz
*
@@ -24,7 +24,7 @@
*---------------------------------------------------------------------------------------------------------------------------------------------------
*/
#ifndef F_INTERRUPTS
-#define F_INTERRUPTS 15000 // interrupts per second, min: 10000, max: 20000, typ: 15000
+#define F_INTERRUPTS 11718 // interrupts per second, min: 10000, max: 20000, typ: 15000
#endif
/*---------------------------------------------------------------------------------------------------------------------------------------------------
@@ -104,6 +104,15 @@
#endif
/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Use external logging routines
+ * If you enable external logging, you have also to enable IRMP_LOGGING above
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#ifndef IRMP_EXT_LOGGING
+#define IRMP_EXT_LOGGING 0 // 1:log, 0: do not log ;
+#endif
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
* Set IRMP_PROTOCOL_NAMES to 1 if want to access protocol names (for logging etc), costs ~300 bytes RAM!
*---------------------------------------------------------------------------------------------------------------------------------------------------
*/
diff --git a/irmpextlog.c b/irmpextlog.c
new file mode 100644
index 0000000..78537e9
--- /dev/null
+++ b/irmpextlog.c
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * irmpextlog.c - external logging
+ *
+ * $Id: irmpextlog.c,v 1.1 2012/02/16 10:40:08 fm Exp $
+ *
+ * If you cannot use the internal UART logging routine, adapt the
+ * source below for your application. The following implementation
+ * is an example for a PIC 18F2550 with USB interface.
+ *
+ * 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.
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+#include "irmpconfig.h"
+
+#if IRMP_EXT_LOGGING == 1
+
+#include "irmpextlog.h"
+#include "system/usb/usb.h"
+
+#define bit_set(var,bitnr) ((var) |= 1 << (bitnr)) // set single bit in byte
+#define loglen 50 // byte length for saving the data from irmp.c
+ // check your USB settings for max length of USB interface used for this FW!
+static unsigned char logdata[loglen]; // array for saveing the data from irmp.c
+static unsigned char logindex = 3; // start index of logdata
+static char bitindex = 7; // bit position in current byte
+static unsigned int bitcount;
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Initialize external logging
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+void
+initextlog (void) // reset all data to default, only during init
+{
+ unsigned char i;
+
+ for (i = 0; i < loglen; i++)
+ {
+ logdata[i] = 0;
+ }
+
+ bitcount = 0;
+ logindex = 3;
+ bitindex = 7;
+}
+
+/*---------------------------------------------------------------------------------------------------------------------------------------------------
+ * Send logging data via device (e.g. USB on PIC)
+ *---------------------------------------------------------------------------------------------------------------------------------------------------
+ */
+void
+sendextlog (unsigned char data)
+{
+ if (logindex == loglen || data == '\n') // buffer full or \n --> send to application
+ {
+ if (mUSBUSARTIsTxTrfReady()) // check USB, if ready send
+ {
+ logdata[0] = 0x01; // indicator for logging, depends on your application
+ logdata[1] = logindex; // save how much bytes are send from irmp.c
+ logdata[2] = 0; // set \n Index to 0; 0=buffer full; 0xA=\n received
+
+ if (data == '\n')
+ {
+ logdata[2] = data; // \n --> save \n=0xA in to check in app that \n was received
+ }
+
+ mUSBUSARTTxRam((unsigned char *) &logdata, loglen); // send all Data to main Seoftware
+
+ logindex = 3; // reset index
+ bitindex = 7; // reset bit position
+ logdata[logindex] = 0; // reset value of new logindex to 0
+ }
+ }
+ else
+ {
+ bitcount++;
+
+ if (data == '1')
+ {
+ bit_set(logdata[logindex], bitindex); // all logdata[logindex] on start = 0 --> only 1 must be set
+ }
+
+ bitindex--; // decrease bitposition, wirte from left to right
+
+ if (bitindex == -1) // byte complete Bit 7->0 --> next one
+ {
+ bitindex = 7;
+ logindex++;
+
+ if (logindex < loglen)
+ {
+ logdata[logindex] = 0; // set next byte to 0
+ }
+ }
+ }
+}
+
+#endif //IRMP_EXT_LOGGING
diff --git a/irmpextlog.h b/irmpextlog.h
new file mode 100644
index 0000000..efbea47
--- /dev/null
+++ b/irmpextlog.h
@@ -0,0 +1,7 @@
+#ifndef _IRMPEXTLOG_H
+#define _IRMPEXTLOG_H
+
+void initextlog (void);
+void sendextlog (unsigned char);
+
+#endif
diff --git a/irsnd.c b/irsnd.c
index c6062fc..68a6691 100644
--- a/irsnd.c
+++ b/irsnd.c
@@ -12,7 +12,7 @@
* ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284
* ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P
*
- * $Id: irsnd.c,v 1.45 2012/02/13 11:02:29 fm Exp $
+ * $Id: irsnd.c,v 1.46 2012/02/15 11:02:42 fm Exp $
*
* 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