From f874da09e608f96bceeb5a8599c5e4bd418168e1 Mon Sep 17 00:00:00 2001 From: ukw Date: Fri, 26 Oct 2012 08:22:19 +0000 Subject: [PATCH] Version 2.3.1: corrected OC0A for ATmega48/88/168/328 git-svn-id: svn://mikrocontroller.net/irmp@105 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- README.txt | 4 +- irmp.aps | 2 +- irmp.c | 4 +- irmpconfig.h | 2 +- irsnd.aps | 2 +- irsnd.c | 114 +++++++++++++++++++++++--------------------------- irsndconfig.h | 4 +- 7 files changed, 61 insertions(+), 71 deletions(-) diff --git a/README.txt b/README.txt index de5971d..cfe134b 100644 --- a/README.txt +++ b/README.txt @@ -1,8 +1,8 @@ IRMP - Infrared Multi Protocol Decoder -------------------------------------- -Version IRMP: 2.3.0 05.10.2012 -Version IRSND: 2.3.0 05.10.2012 +Version IRMP: 2.3.1 26.10.2012 +Version IRSND: 2.3.1 26.10.2012 Dokumentation: diff --git a/irmp.aps b/irmp.aps index 1bb586d..c23bf73 100644 --- a/irmp.aps +++ b/irmp.aps @@ -1 +1 @@ -irmp07-Jan-2010 20:23:4922-May-2012 17:10:27241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irmp.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000main.cirmp.cirmp.hirmpconfig.hirmpprotocols.hirmpsystem.hdefault\irmp.lssdefault\irmp.mapdefaultNOatmega88111irmp.elfdefault\1-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.exeC:\avr\irmp\irmp.hC:\avr\irmp\irmpconfig.hC:\avr\irmp\irmpprotocols.hC:\avr\irmp\irmpsystem.hC:\avr\irmp\main.cC:\avr\irmp\irmp.c00000main.c100001irmp.c100002irmp.h100003irmpconfig.h100004irmpsystem.h100005irmpprotocols.h1 +irmp07-Jan-2010 20:23:4926-Oct-2012 10:21:09241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irmp.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000main.cirmp.cirmp.hirmpconfig.hirmpprotocols.hirmpsystem.hdefault\irmp.lssdefault\irmp.mapdefaultNOatmega88111irmp.elfdefault\0-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR\avr-gcc-4.7.2\bin\avr-gcc.exeC:\WinAVR\avr-gcc-4.7.2\utils\bin\make.exe00000main.c100001irmp.c100002irmp.h100003irmpconfig.h100004irmpsystem.h100005irmpprotocols.h1 diff --git a/irmp.c b/irmp.c index 6f2f994..a921aac 100644 --- a/irmp.c +++ b/irmp.c @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.128 2012/10/05 07:58:39 fm Exp $ + * $Id: irmp.c,v 1.129 2012/10/26 08:09:37 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -1443,7 +1443,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) else { ANALYZE_PRINTF ("CRC error in LEGO protocol\n"); - rtc = TRUE; + // rtc = TRUE; // don't accept codes with CRC errors } break; } diff --git a/irmpconfig.h b/irmpconfig.h index de6e3ff..08fdc49 100644 --- a/irmpconfig.h +++ b/irmpconfig.h @@ -5,7 +5,7 @@ * * Copyright (c) 2009-2012 Frank Meyer - frank(at)fli4l.de * - * $Id: irmpconfig.h,v 1.92 2012/07/11 13:14:08 fm Exp $ + * $Id: irmpconfig.h,v 1.94 2012/10/26 08:12:17 fm Exp $ * * ATMEGA88 @ 8 MHz * diff --git a/irsnd.aps b/irsnd.aps index 08da7f8..f596a9b 100644 --- a/irsnd.aps +++ b/irsnd.aps @@ -1 +1 @@ -irsnd07-Jan-2010 20:23:4922-May-2012 17:10:20241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irsnd.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000irsndmain.cirsnd.cirsnd.hirsndconfig.hirmpprotocols.hirmpsystem.hdefault\irsnd.lssdefault\irsnd.mapdefaultNOatmega88111irsnd.elfdefault\1-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.exeC:\avr\irmp\irsnd.hC:\avr\irmp\irsndconfig.hC:\avr\irmp\irmpprotocols.hC:\avr\irmp\irmpsystem.hC:\avr\irmp\irsndmain.cC:\avr\irmp\irsnd.c00000irsndmain.c100001irsnd.c100002irsnd.h100003irsndconfig.h100004irmpprotocols.h100005irmpsystem.h1 +irsnd07-Jan-2010 20:23:4926-Oct-2012 10:20:26241007-Jan-2010 20:23:4944, 18, 0, 670AVR GCCdefault\irsnd.elfC:\avr\irmp\AVR SimulatorATmega88.xmlfalseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000irsndmain.cirsnd.cirsnd.hirsndconfig.hirmpprotocols.hirmpsystem.hdefault\irsnd.lssdefault\irsnd.mapdefaultNOatmega88111irsnd.elfdefault\1-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR\avr-gcc-4.7.2\bin\avr-gcc.exeC:\WinAVR\avr-gcc-4.7.2\utils\bin\make.exe00000irsndmain.c100001irsnd.c100002irsnd.h100003irsndconfig.h100004irmpprotocols.h100005irmpsystem.h1 diff --git a/irsnd.c b/irsnd.c index ad14dd8..30dd5af 100644 --- a/irsnd.c +++ b/irsnd.c @@ -13,7 +13,7 @@ * ATmega164, ATmega324, ATmega644, ATmega644P, ATmega1284 * ATmega88, ATmega88P, ATmega168, ATmega168P, ATmega328P * - * $Id: irsnd.c,v 1.60 2012/10/05 07:58:39 fm Exp $ + * $Id: irsnd.c,v 1.62 2012/10/26 08:20:30 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 @@ -35,61 +35,52 @@ */ #if defined (__AVR_ATtiny84__) // ATtiny84 uses OC0A = PB2 or OC0B = PA7 # if IRSND_OCx == IRSND_OC0A // OC0A -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 2 // OC0A +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 2 # elif IRSND_OCx == IRSND_OC0B // OC0B -# define IRSND_PORT PORTA // port A -# define IRSND_DDR DDRA // ddr A -# define IRSND_BIT 7 // OC0B +# define IRSND_PORT_LETTER A +# define IRSND_BIT_NUMBER 7 # else # error Wrong value for IRSND_OCx, choose IRSND_OC0A or IRSND_OC0B in irsndconfig.h # endif // IRSND_OCx #elif defined (__AVR_ATtiny45__) || defined (__AVR_ATtiny85__) // ATtiny45/85 uses OC0A = PB0 or OC0B = PB1 # if IRSND_OCx == IRSND_OC0A // OC0A -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 0 // OC0A +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 0 # elif IRSND_OCx == IRSND_OC0B // OC0B -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 1 // OC0B +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 1 # else # error Wrong value for IRSND_OCx, choose IRSND_OC0A or IRSND_OC0B in irsndconfig.h # endif // IRSND_OCx #elif defined (__AVR_ATtiny87__) || defined (__AVR_ATtiny167__) // ATtiny87/167 uses OC0A = PA2 # if IRSND_OCx == IRSND_OC0A // OC0A -# define IRSND_PORT PORTA // port A -# define IRSND_DDR DDRA // ddr A -# define IRSND_BIT 2 // OC0A +# define IRSND_PORT_LETTER A +# define IRSND_BIT_NUMBER 2 # else # error Wrong value for IRSND_OCx, choose IRSND_OC0A in irsndconfig.h # endif // IRSND_OCx #elif defined (__AVR_ATmega8__) // ATmega8 uses only OC2 = PB3 # if IRSND_OCx == IRSND_OC2 // OC0A -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 3 // OC0A +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 3 # else # error Wrong value for IRSND_OCx, choose IRSND_OC2 in irsndconfig.h # endif // IRSND_OCx #elif defined (__AVR_ATmega16__) || defined (__AVR_ATmega32__) // ATmega16|32 uses OC2 = PD7 # if IRSND_OCx == IRSND_OC2 // OC2 -# define IRSND_PORT PORTD // port D -# define IRSND_DDR DDRD // ddr D -# define IRSND_BIT 7 // OC2 +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 7 # else # error Wrong value for IRSND_OCx, choose IRSND_OC2 in irsndconfig.h # endif // IRSND_OCx #elif defined (__AVR_ATmega162__) // ATmega162 uses OC2 = PB1 or OC0 = PB0 # if IRSND_OCx == IRSND_OC2 // OC2 -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 1 // OC2 +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 1 # elif IRSND_OCx == IRSND_OC0 // OC0 -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 0 // OC0 +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 0 # else # error Wrong value for IRSND_OCx, choose IRSND_OC2 or IRSND_OC0 in irsndconfig.h # endif // IRSND_OCx @@ -100,21 +91,17 @@ || defined (__AVR_ATmega1284__) \ || defined (__AVR_ATmega1284P__) // ATmega164|324|644|644P|1284 uses OC2A = PD7 or OC2B = PD6 or OC0A = PB3 or OC0B = PB4 # if IRSND_OCx == IRSND_OC2A // OC2A -# define IRSND_PORT PORTD // port D -# define IRSND_DDR DDRD // ddr D -# define IRSND_BIT 7 // OC2A +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 7 # elif IRSND_OCx == IRSND_OC2B // OC2B -# define IRSND_PORT PORTD // port D -# define IRSND_DDR DDRD // ddr D -# define IRSND_BIT 6 // OC2B +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 6 # elif IRSND_OCx == IRSND_OC0A // OC0A -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 3 // OC0A +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 3 # elif IRSND_OCx == IRSND_OC0B // OC0B -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 4 // OC0B +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 4 # else # error Wrong value for IRSND_OCx, choose IRSND_OC2A, IRSND_OC2B, IRSND_OC0A, or IRSND_OC0B in irsndconfig.h # endif // IRSND_OCx @@ -125,37 +112,30 @@ || defined (__AVR_ATmega168P__) \ || defined (__AVR_ATmega328P__) // ATmega48|88|168|168|328 uses OC2A = PB3 or OC2B = PD3 or OC0A = PD6 or OC0B = PD5 # if IRSND_OCx == IRSND_OC2A // OC2A -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 3 // OC2A +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 3 # elif IRSND_OCx == IRSND_OC2B // OC2B -# define IRSND_PORT PORTD // port D -# define IRSND_DDR DDRD // ddr D -# define IRSND_BIT 3 // OC2B +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 3 # elif IRSND_OCx == IRSND_OC0A // OC0A -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 6 // OC0A +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 6 # elif IRSND_OCx == IRSND_OC0B // OC0B -# define IRSND_PORT PORTD // port D -# define IRSND_DDR DDRD // ddr D -# define IRSND_BIT 5 // OC0B +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 5 # else # error Wrong value for IRSND_OCx, choose IRSND_OC2A, IRSND_OC2B, IRSND_OC0A, or IRSND_OC0B in irsndconfig.h # endif // IRSND_OCx -#elif defined (__AVR_ATmega8515__) +#elif defined (__AVR_ATmega8515__) // ATmega8515 uses OC0 = PB0 or OC1A = PD5 or OC1B = PE2 # if IRSND_OCx == IRSND_OC0 -# define IRSND_PORT PORTB // port B -# define IRSND_DDR DDRB // ddr B -# define IRSND_BIT 0 // OC0 +# define IRSND_PORT_LETTER B +# define IRSND_BIT_NUMBER 0 # elif IRSND_OCx == IRSND_OC1A -# define IRSND_PORT PORTD // port D -# define IRSND_DDR DDRD // ddr D -# define IRSND_BIT 5 // OC1A +# define IRSND_PORT_LETTER D +# define IRSND_BIT_NUMBER 5 # elif IRSND_OCx == IRSND_OC1B -# define IRSND_PORT PORTE // port E -# define IRSND_DDR DDRE // ddr E -# define IRSND_BIT 2 // OC1E +# define IRSND_PORT_LETTER E +# define IRSND_BIT_NUMBER 2 # else # error Wrong value for IRSND_OCx, choose IRSND_OC0, IRSND_OC1A, or IRSND_OC1B in irsndconfig.h # endif // IRSND_OCx @@ -169,6 +149,14 @@ # endif // unix, WIN32 #endif // __AVR... +#if defined(ATMEL_AVR) +# define _CONCAT(a,b) a##b +# define CONCAT(a,b) _CONCAT(a,b) +# define IRSND_PORT CONCAT(PORT, IRSND_PORT_LETTER) +# define IRSND_DDR CONCAT(DDR, IRSND_PORT_LETTER) +# define IRSND_BIT IRSND_BIT_NUMBER +#endif + #if IRSND_SUPPORT_NIKON_PROTOCOL == 1 typedef uint16_t IRSND_PAUSE_LEN; #else @@ -2290,6 +2278,7 @@ main (int argc, char ** argv) putchar ('\n'); +#if 1 // enable here to send twice (void) irsnd_send_data (&irmp_data, TRUE); while (irsnd_busy) @@ -2298,6 +2287,7 @@ main (int argc, char ** argv) } putchar ('\n'); +#endif } else { diff --git a/irsndconfig.h b/irsndconfig.h index 46e33be..03e1655 100644 --- a/irsndconfig.h +++ b/irsndconfig.h @@ -5,7 +5,7 @@ * * Copyright (c) 2010-2011 Frank Meyer - frank(at)fli4l.de * - * $Id: irsndconfig.h,v 1.41 2012/10/05 07:58:39 fm Exp $ + * $Id: irsndconfig.h,v 1.43 2012/10/26 08:12:17 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -48,7 +48,7 @@ #define IRSND_SUPPORT_DENON_PROTOCOL 1 // DENON, Sharp >= 10000 ~200 bytes // more protocols, enable here! Enable Remarks F_INTERRUPTS Program Space -#define IRSND_SUPPORT_RC5_PROTOCOL 1 // RC5 >= 10000 ~150 bytes +#define IRSND_SUPPORT_RC5_PROTOCOL 0 // RC5 >= 10000 ~150 bytes #define IRSND_SUPPORT_RC6_PROTOCOL 0 // RC6 >= 10000 ~250 bytes #define IRSND_SUPPORT_RC6A_PROTOCOL 0 // RC6A >= 10000 ~250 bytes #define IRSND_SUPPORT_JVC_PROTOCOL 0 // JVC >= 10000 ~150 bytes -- 2.39.2