From 6c3c57e6ed1d614a5ffec4747e271eb9e7aa8a68 Mon Sep 17 00:00:00 2001 From: ukw Date: Thu, 16 Feb 2012 10:43:15 +0000 Subject: [PATCH] Version 2.1.0: port to PIC C18 compiler, added external logging git-svn-id: svn://mikrocontroller.net/irmp@87 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- README.txt | 4 +- irmp.aps | 2 +- irmp.c | 23 +++++++++--- irmpconfig.h | 13 ++++++- irmpextlog.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ irmpextlog.h | 7 ++++ irsnd.c | 2 +- 7 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 irmpextlog.c create mode 100644 irmpextlog.h 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 @@ -irmp07-Jan-2010 20:23:4912-Sep-2011 09:33:45241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irmp.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000main.cirmp.cirmp.hirmpconfig.hdefault\irmp.lssdefault\irmp.mapdefaultNOatmega88111irmp.elfdefault\0-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\Program Files\WinAVR-20100110\bin\avr-gcc.exeC:\Program Files\WinAVR-20100110\utils\bin\make.exe00000main.c100001irmp.c100002irmp.h100003irmpconfig.h1 +irmp07-Jan-2010 20:23:4916-Feb-2012 11:39:00241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irmp.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000main.cirmp.cirmpextlog.cirmp.hirmpconfig.hirmpextlog.hdefault\irmp.lssdefault\irmp.mapdefaultNOatmega88111irmp.elfdefault\0-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\Program Files\WinAVR-20100110\bin\avr-gcc.exeC:\Program Files\WinAVR-20100110\utils\bin\make.exe00000main.c100001irmp.c100002irmp.h100003irmpconfig.h100004irmpextlog.c100005irmpextlog.h1 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 @@ -778,7 +782,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = #define UART0_TXEN_BIT_VALUE (1< 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 -- 2.39.2