From c0dda82685524e1e7365889b1bf1e1db8f15daee Mon Sep 17 00:00:00 2001 From: safaorhan Date: Thu, 18 Aug 2016 12:20:43 +0300 Subject: [PATCH 001/584] Update keywords.txt Add sendLG as KEYWORD2 --- keywords.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/keywords.txt b/keywords.txt index 6fd016fc3..f2b9a4957 100644 --- a/keywords.txt +++ b/keywords.txt @@ -31,6 +31,7 @@ sendSharp KEYWORD2 sendSharpRaw KEYWORD2 sendPanasonic KEYWORD2 sendJVC KEYWORD2 +sendLG KEYWORD2 ####################################### # Constants (LITERAL1) From 0d69a1a9ed19a8c887110094173574f8f192cd01 Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Tue, 23 Aug 2016 15:23:51 +0200 Subject: [PATCH 002/584] Move board specific configuration info to new file boarddefs.h. --- IRremoteInt.h | 525 +---------------------------------------------- boarddefs.h | 548 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 550 insertions(+), 523 deletions(-) create mode 100644 boarddefs.h diff --git a/IRremoteInt.h b/IRremoteInt.h index 9a9c3c2f3..1c319acbf 100644 --- a/IRremoteInt.h +++ b/IRremoteInt.h @@ -68,40 +68,6 @@ irparams_t; // Therefore we declare it as "volatile" to stop the compiler/CPU caching it EXTERN volatile irparams_t irparams; -//------------------------------------------------------------------------------ -// Defines for blinking the LED -// - -#if defined(CORE_LED0_PIN) -# define BLINKLED CORE_LED0_PIN -# define BLINKLED_ON() (digitalWrite(CORE_LED0_PIN, HIGH)) -# define BLINKLED_OFF() (digitalWrite(CORE_LED0_PIN, LOW)) - -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define BLINKLED 13 -# define BLINKLED_ON() (PORTB |= B10000000) -# define BLINKLED_OFF() (PORTB &= B01111111) - -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) -# define BLINKLED 0 -# define BLINKLED_ON() (PORTD |= B00000001) -# define BLINKLED_OFF() (PORTD &= B11111110) - -#else -# define BLINKLED 13 - #define BLINKLED_ON() (PORTB |= B00100000) -# define BLINKLED_OFF() (PORTB &= B11011111) -#endif - -//------------------------------------------------------------------------------ -// CPU Frequency -// -#ifdef F_CPU -# define SYSCLOCK F_CPU // main Arduino clock -#else -# define SYSCLOCK 16000000 // main Arduino clock -#endif - //------------------------------------------------------------------------------ // Defines for setting and clearing register bits // @@ -123,9 +89,6 @@ EXTERN volatile irparams_t irparams; // Spaces tend to be 100us too short #define MARK_EXCESS 100 -// microseconds per clock interrupt tick -#define USECPERTICK 50 - // Upper and Lower percentage tolerances in measurements #define TOLERANCE 25 #define LTOL (1.0 - (TOLERANCE/100.)) @@ -144,491 +107,7 @@ EXTERN volatile irparams_t irparams; #define MARK 0 #define SPACE 1 -//------------------------------------------------------------------------------ -// Define which timer to use -// -// Uncomment the timer you wish to use on your board. -// If you are using another library which uses timer2, you have options to -// switch IRremote to use a different timer. -// - -// Arduino Mega -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) - //#define IR_USE_TIMER1 // tx = pin 11 - #define IR_USE_TIMER2 // tx = pin 9 - //#define IR_USE_TIMER3 // tx = pin 5 - //#define IR_USE_TIMER4 // tx = pin 6 - //#define IR_USE_TIMER5 // tx = pin 46 - -// Teensy 1.0 -#elif defined(__AVR_AT90USB162__) - #define IR_USE_TIMER1 // tx = pin 17 - -// Teensy 2.0 -#elif defined(__AVR_ATmega32U4__) - //#define IR_USE_TIMER1 // tx = pin 14 - //#define IR_USE_TIMER3 // tx = pin 9 - #define IR_USE_TIMER4_HS // tx = pin 10 - -// Teensy 3.0 / Teensy 3.1 -#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) - #define IR_USE_TIMER_CMT // tx = pin 5 - -// Teensy-LC -#elif defined(__MKL26Z64__) - #define IR_USE_TIMER_TPM1 // tx = pin 16 - -// Teensy++ 1.0 & 2.0 -#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) - //#define IR_USE_TIMER1 // tx = pin 25 - #define IR_USE_TIMER2 // tx = pin 1 - //#define IR_USE_TIMER3 // tx = pin 16 - -// MightyCore - ATmega1284 -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) - //#define IR_USE_TIMER1 // tx = pin 13 - #define IR_USE_TIMER2 // tx = pin 14 - //#define IR_USE_TIMER3 // tx = pin 6 - -// MightyCore - ATmega164, ATmega324, ATmega644 -#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ -|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ -|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ -|| defined(__AVR_ATmega164P__) - //#define IR_USE_TIMER1 // tx = pin 13 - #define IR_USE_TIMER2 // tx = pin 14 - -//MegaCore - ATmega64, ATmega128 -#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) - #define IR_USE_TIMER1 // tx = pin 13 - -// MightyCore - ATmega8535, ATmega16, ATmega32 -#elif defined(__AVR_ATmega8535__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) - #define IR_USE_TIMER1 // tx = pin 13 - -// Atmega8 -#elif defined(__AVR_ATmega8__) - #define IR_USE_TIMER1 // tx = pin 9 +// All board specific stuff has been moved to its own file, included here. +#include "boarddefs.h" -// ATtiny84 -#elif defined(__AVR_ATtiny84__) - #define IR_USE_TIMER1 // tx = pin 6 - -//ATtiny85 -#elif defined(__AVR_ATtiny85__) - #define IR_USE_TIMER_TINY0 // tx = pin 1 - -// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc -// ATmega48, ATmega88, ATmega168, ATmega328 -#else - //#define IR_USE_TIMER1 // tx = pin 9 - #define IR_USE_TIMER2 // tx = pin 3 - -#endif - -//------------------------------------------------------------------------------ -// Defines for Timer - -//--------------------------------------------------------- -// Timer2 (8 bits) -// -#if defined(IR_USE_TIMER2) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) -#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) -#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) -#define TIMER_DISABLE_INTR (TIMSK2 = 0) -#define TIMER_INTR_NAME TIMER2_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR2A = _BV(WGM20); \ - TCCR2B = _BV(WGM22) | _BV(CS20); \ - OCR2A = pwmval; \ - OCR2B = pwmval / 3; \ -}) - -#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) - -//----------------- -#if (TIMER_COUNT_TOP < 256) -# define TIMER_CONFIG_NORMAL() ({ \ - TCCR2A = _BV(WGM21); \ - TCCR2B = _BV(CS20); \ - OCR2A = TIMER_COUNT_TOP; \ - TCNT2 = 0; \ - }) -#else -# define TIMER_CONFIG_NORMAL() ({ \ - TCCR2A = _BV(WGM21); \ - TCCR2B = _BV(CS21); \ - OCR2A = TIMER_COUNT_TOP / 8; \ - TCNT2 = 0; \ - }) -#endif - -//----------------- -#if defined(CORE_OC2B_PIN) -# define TIMER_PWM_PIN CORE_OC2B_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 9 // Arduino Mega -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ -|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ -|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ -|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ -|| defined(__AVR_ATmega164P__) -# define TIMER_PWM_PIN 14 // MightyCore -#else -# define TIMER_PWM_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc -#endif // ATmega48, ATmega88, ATmega168, ATmega328 - -//--------------------------------------------------------- -// Timer1 (16 bits) -// -#elif defined(IR_USE_TIMER1) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1)) -#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1))) - -//----------------- -#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega8535__) \ -|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \ -|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE1A)) -# define TIMER_DISABLE_INTR (TIMSK &= ~_BV(OCIE1A)) -#else -# define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) -# define TIMER_DISABLE_INTR (TIMSK1 = 0) -#endif - -//----------------- -#define TIMER_INTR_NAME TIMER1_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR1A = _BV(WGM11); \ - TCCR1B = _BV(WGM13) | _BV(CS10); \ - ICR1 = pwmval; \ - OCR1A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR1A = 0; \ - TCCR1B = _BV(WGM12) | _BV(CS10); \ - OCR1A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT1 = 0; \ -}) - -//----------------- -#if defined(CORE_OC1A_PIN) -# define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 11 // Arduino Mega -#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_PWM_PIN 13 // MegaCore -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ -|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ -|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ -|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ -|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ -|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) -# define TIMER_PWM_PIN 13 // MightyCore -#elif defined(__AVR_ATtiny84__) -# define TIMER_PWM_PIN 6 -#else -# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc -#endif // ATmega48, ATmega88, ATmega168, ATmega328 - -//--------------------------------------------------------- -// Timer3 (16 bits) -// -#elif defined(IR_USE_TIMER3) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR3A |= _BV(COM3A1)) -#define TIMER_DISABLE_PWM (TCCR3A &= ~(_BV(COM3A1))) -#define TIMER_ENABLE_INTR (TIMSK3 = _BV(OCIE3A)) -#define TIMER_DISABLE_INTR (TIMSK3 = 0) -#define TIMER_INTR_NAME TIMER3_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR3A = _BV(WGM31); \ - TCCR3B = _BV(WGM33) | _BV(CS30); \ - ICR3 = pwmval; \ - OCR3A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR3A = 0; \ - TCCR3B = _BV(WGM32) | _BV(CS30); \ - OCR3A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT3 = 0; \ -}) - -//----------------- -#if defined(CORE_OC3A_PIN) -# define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 5 // Arduino Mega -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) -# define TIMER_PWM_PIN 6 // MightyCore -#else -# error "Please add OC3A pin number here\n" -#endif - -//--------------------------------------------------------- -// Timer4 (10 bits, high speed option) -// -#elif defined(IR_USE_TIMER4_HS) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) -#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4)) -#define TIMER_DISABLE_INTR (TIMSK4 = 0) -#define TIMER_INTR_NAME TIMER4_OVF_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR4A = (1<> 8; \ - OCR4C = pwmval; \ - TC4H = (pwmval / 3) >> 8; \ - OCR4A = (pwmval / 3) & 255; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR4A = 0; \ - TCCR4B = _BV(CS40); \ - TCCR4C = 0; \ - TCCR4D = 0; \ - TCCR4E = 0; \ - TC4H = (SYSCLOCK * USECPERTICK / 1000000) >> 8; \ - OCR4C = (SYSCLOCK * USECPERTICK / 1000000) & 255; \ - TC4H = 0; \ - TCNT4 = 0; \ -}) - -//----------------- -#if defined(CORE_OC4A_PIN) -# define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy -#elif defined(__AVR_ATmega32U4__) -# define TIMER_PWM_PIN 13 // Leonardo -#else -# error "Please add OC4A pin number here\n" -#endif - -//--------------------------------------------------------- -// Timer4 (16 bits) -// -#elif defined(IR_USE_TIMER4) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) -#define TIMER_ENABLE_INTR (TIMSK4 = _BV(OCIE4A)) -#define TIMER_DISABLE_INTR (TIMSK4 = 0) -#define TIMER_INTR_NAME TIMER4_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR4A = _BV(WGM41); \ - TCCR4B = _BV(WGM43) | _BV(CS40); \ - ICR4 = pwmval; \ - OCR4A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR4A = 0; \ - TCCR4B = _BV(WGM42) | _BV(CS40); \ - OCR4A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT4 = 0; \ -}) - -//----------------- -#if defined(CORE_OC4A_PIN) -# define TIMER_PWM_PIN CORE_OC4A_PIN -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 6 // Arduino Mega -#else -# error "Please add OC4A pin number here\n" -#endif - -//--------------------------------------------------------- -// Timer5 (16 bits) -// -#elif defined(IR_USE_TIMER5) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR5A |= _BV(COM5A1)) -#define TIMER_DISABLE_PWM (TCCR5A &= ~(_BV(COM5A1))) -#define TIMER_ENABLE_INTR (TIMSK5 = _BV(OCIE5A)) -#define TIMER_DISABLE_INTR (TIMSK5 = 0) -#define TIMER_INTR_NAME TIMER5_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR5A = _BV(WGM51); \ - TCCR5B = _BV(WGM53) | _BV(CS50); \ - ICR5 = pwmval; \ - OCR5A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR5A = 0; \ - TCCR5B = _BV(WGM52) | _BV(CS50); \ - OCR5A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT5 = 0; \ -}) - -//----------------- -#if defined(CORE_OC5A_PIN) -# define TIMER_PWM_PIN CORE_OC5A_PIN -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 46 // Arduino Mega -#else -# error "Please add OC5A pin number here\n" -#endif - -//--------------------------------------------------------- -// Special carrier modulator timer -// -#elif defined(IR_USE_TIMER_CMT) - -#define TIMER_RESET ({ \ - uint8_t tmp __attribute__((unused)) = CMT_MSC; \ - CMT_CMD2 = 30; \ -}) - -#define TIMER_ENABLE_PWM do { \ - CORE_PIN5_CONFIG = PORT_PCR_MUX(2) | PORT_PCR_DSE | PORT_PCR_SRE; \ -} while(0) - -#define TIMER_DISABLE_PWM do { \ - CORE_PIN5_CONFIG = PORT_PCR_MUX(1) | PORT_PCR_DSE | PORT_PCR_SRE; \ -} while(0) - -#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_CMT) -#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_CMT) -#define TIMER_INTR_NAME cmt_isr - -//----------------- -#ifdef ISR -# undef ISR -#endif -#define ISR(f) void f(void) - -//----------------- -#define CMT_PPS_DIV ((F_BUS + 7999999) / 8000000) -#if F_BUS < 8000000 -#error IRremote requires at least 8 MHz on Teensy 3.x -#endif - -//----------------- -#define TIMER_CONFIG_KHZ(val) ({ \ - SIM_SCGC4 |= SIM_SCGC4_CMT; \ - SIM_SOPT2 |= SIM_SOPT2_PTD7PAD; \ - CMT_PPS = CMT_PPS_DIV - 1; \ - CMT_CGH1 = ((F_BUS / CMT_PPS_DIV / 3000) + ((val)/2)) / (val); \ - CMT_CGL1 = ((F_BUS / CMT_PPS_DIV / 1500) + ((val)/2)) / (val); \ - CMT_CMD1 = 0; \ - CMT_CMD2 = 30; \ - CMT_CMD3 = 0; \ - CMT_CMD4 = 0; \ - CMT_OC = 0x60; \ - CMT_MSC = 0x01; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - SIM_SCGC4 |= SIM_SCGC4_CMT; \ - CMT_PPS = CMT_PPS_DIV - 1; \ - CMT_CGH1 = 1; \ - CMT_CGL1 = 1; \ - CMT_CMD1 = 0; \ - CMT_CMD2 = 30; \ - CMT_CMD3 = 0; \ - CMT_CMD4 = (F_BUS / 160000 + CMT_PPS_DIV / 2) / CMT_PPS_DIV - 31; \ - CMT_OC = 0; \ - CMT_MSC = 0x03; \ -}) - -#define TIMER_PWM_PIN 5 - -// defines for TPM1 timer on Teensy-LC -#elif defined(IR_USE_TIMER_TPM1) -#define TIMER_RESET FTM1_SC |= FTM_SC_TOF; -#define TIMER_ENABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(3)|PORT_PCR_DSE|PORT_PCR_SRE -#define TIMER_DISABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE -#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_FTM1) -#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_FTM1) -#define TIMER_INTR_NAME ftm1_isr -#ifdef ISR -#undef ISR -#endif -#define ISR(f) void f(void) -#define TIMER_CONFIG_KHZ(val) ({ \ - SIM_SCGC6 |= SIM_SCGC6_TPM1; \ - FTM1_SC = 0; \ - FTM1_CNT = 0; \ - FTM1_MOD = (F_PLL/2000) / val - 1; \ - FTM1_C0V = (F_PLL/6000) / val - 1; \ - FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0); \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - SIM_SCGC6 |= SIM_SCGC6_TPM1; \ - FTM1_SC = 0; \ - FTM1_CNT = 0; \ - FTM1_MOD = (F_PLL/40000) - 1; \ - FTM1_C0V = 0; \ - FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \ -}) -#define TIMER_PWM_PIN 16 - -// defines for timer_tiny0 (8 bits) -#elif defined(IR_USE_TIMER_TINY0) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR0A |= _BV(COM0B1)) -#define TIMER_DISABLE_PWM (TCCR0A &= ~(_BV(COM0B1))) -#define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE0A)) -#define TIMER_DISABLE_INTR (TIMSK &= ~(_BV(OCIE0A))) -#define TIMER_INTR_NAME TIMER0_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR0A = _BV(WGM00); \ - TCCR0B = _BV(WGM02) | _BV(CS00); \ - OCR0A = pwmval; \ - OCR0B = pwmval / 3; \ -}) -#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) -#if (TIMER_COUNT_TOP < 256) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR0A = _BV(WGM01); \ - TCCR0B = _BV(CS00); \ - OCR0A = TIMER_COUNT_TOP; \ - TCNT0 = 0; \ -}) -#else -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR0A = _BV(WGM01); \ - TCCR0B = _BV(CS01); \ - OCR0A = TIMER_COUNT_TOP / 8; \ - TCNT0 = 0; \ -}) -#endif - -#define TIMER_PWM_PIN 1 /* ATtiny85 */ - -//--------------------------------------------------------- -// Unknown Timer -// -#else -# error "Internal code configuration error, no known IR_USE_TIMER# defined\n" -#endif #endif diff --git a/boarddefs.h b/boarddefs.h new file mode 100644 index 000000000..62b6be4fb --- /dev/null +++ b/boarddefs.h @@ -0,0 +1,548 @@ +//****************************************************************************** +// IRremote +// Version 2.0.1 June, 2015 +// Copyright 2009 Ken Shirriff +// For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html + +// This file contains all board specific information. It was previously contained within +// IRremoteInt.h + +// Modified by Paul Stoffregen to support other boards and timers +// +// Interrupt code based on NECIRrcv by Joe Knapp +// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 +// Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ +// +// JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post) +// Whynter A/C ARC-110WD added by Francesco Meschia +//****************************************************************************** + +#ifndef boarddefs_h +#define boarddefs_h + +//------------------------------------------------------------------------------ +// Defines for blinking the LED +// + +#if defined(CORE_LED0_PIN) +# define BLINKLED CORE_LED0_PIN +# define BLINKLED_ON() (digitalWrite(CORE_LED0_PIN, HIGH)) +# define BLINKLED_OFF() (digitalWrite(CORE_LED0_PIN, LOW)) + +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define BLINKLED 13 +# define BLINKLED_ON() (PORTB |= B10000000) +# define BLINKLED_OFF() (PORTB &= B01111111) + +#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) +# define BLINKLED 0 +# define BLINKLED_ON() (PORTD |= B00000001) +# define BLINKLED_OFF() (PORTD &= B11111110) + +#else +# define BLINKLED 13 + #define BLINKLED_ON() (PORTB |= B00100000) +# define BLINKLED_OFF() (PORTB &= B11011111) +#endif + +//------------------------------------------------------------------------------ +// CPU Frequency +// +#ifdef F_CPU +# define SYSCLOCK F_CPU // main Arduino clock +#else +# define SYSCLOCK 16000000 // main Arduino clock +#endif + +// microseconds per clock interrupt tick +#define USECPERTICK 50 + +//------------------------------------------------------------------------------ +// Define which timer to use +// +// Uncomment the timer you wish to use on your board. +// If you are using another library which uses timer2, you have options to +// switch IRremote to use a different timer. +// + +// Arduino Mega +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + //#define IR_USE_TIMER1 // tx = pin 11 + #define IR_USE_TIMER2 // tx = pin 9 + //#define IR_USE_TIMER3 // tx = pin 5 + //#define IR_USE_TIMER4 // tx = pin 6 + //#define IR_USE_TIMER5 // tx = pin 46 + +// Teensy 1.0 +#elif defined(__AVR_AT90USB162__) + #define IR_USE_TIMER1 // tx = pin 17 + +// Teensy 2.0 +#elif defined(__AVR_ATmega32U4__) + //#define IR_USE_TIMER1 // tx = pin 14 + //#define IR_USE_TIMER3 // tx = pin 9 + #define IR_USE_TIMER4_HS // tx = pin 10 + +// Teensy 3.0 / Teensy 3.1 +#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) + #define IR_USE_TIMER_CMT // tx = pin 5 + +// Teensy-LC +#elif defined(__MKL26Z64__) + #define IR_USE_TIMER_TPM1 // tx = pin 16 + +// Teensy++ 1.0 & 2.0 +#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) + //#define IR_USE_TIMER1 // tx = pin 25 + #define IR_USE_TIMER2 // tx = pin 1 + //#define IR_USE_TIMER3 // tx = pin 16 + +// MightyCore - ATmega1284 +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) + //#define IR_USE_TIMER1 // tx = pin 13 + #define IR_USE_TIMER2 // tx = pin 14 + //#define IR_USE_TIMER3 // tx = pin 6 + +// MightyCore - ATmega164, ATmega324, ATmega644 +#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) + //#define IR_USE_TIMER1 // tx = pin 13 + #define IR_USE_TIMER2 // tx = pin 14 + +//MegaCore - ATmega64, ATmega128 +#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) + #define IR_USE_TIMER1 // tx = pin 13 + +// MightyCore - ATmega8535, ATmega16, ATmega32 +#elif defined(__AVR_ATmega8535__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) + #define IR_USE_TIMER1 // tx = pin 13 + +// Atmega8 +#elif defined(__AVR_ATmega8__) + #define IR_USE_TIMER1 // tx = pin 9 + +// ATtiny84 +#elif defined(__AVR_ATtiny84__) + #define IR_USE_TIMER1 // tx = pin 6 + +//ATtiny85 +#elif defined(__AVR_ATtiny85__) + #define IR_USE_TIMER_TINY0 // tx = pin 1 + +// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc +// ATmega48, ATmega88, ATmega168, ATmega328 +#else + //#define IR_USE_TIMER1 // tx = pin 9 + #define IR_USE_TIMER2 // tx = pin 3 + +#endif + +//------------------------------------------------------------------------------ +// Defines for Timer + +//--------------------------------------------------------- +// Timer2 (8 bits) +// +#if defined(IR_USE_TIMER2) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) +#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) +#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) +#define TIMER_DISABLE_INTR (TIMSK2 = 0) +#define TIMER_INTR_NAME TIMER2_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR2A = _BV(WGM20); \ + TCCR2B = _BV(WGM22) | _BV(CS20); \ + OCR2A = pwmval; \ + OCR2B = pwmval / 3; \ +}) + +#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) + +//----------------- +#if (TIMER_COUNT_TOP < 256) +# define TIMER_CONFIG_NORMAL() ({ \ + TCCR2A = _BV(WGM21); \ + TCCR2B = _BV(CS20); \ + OCR2A = TIMER_COUNT_TOP; \ + TCNT2 = 0; \ + }) +#else +# define TIMER_CONFIG_NORMAL() ({ \ + TCCR2A = _BV(WGM21); \ + TCCR2B = _BV(CS21); \ + OCR2A = TIMER_COUNT_TOP / 8; \ + TCNT2 = 0; \ + }) +#endif + +//----------------- +#if defined(CORE_OC2B_PIN) +# define TIMER_PWM_PIN CORE_OC2B_PIN // Teensy +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 9 // Arduino Mega +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ +|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) +# define TIMER_PWM_PIN 14 // MightyCore +#else +# define TIMER_PWM_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc +#endif // ATmega48, ATmega88, ATmega168, ATmega328 + +//--------------------------------------------------------- +// Timer1 (16 bits) +// +#elif defined(IR_USE_TIMER1) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1)) +#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1))) + +//----------------- +#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega8535__) \ +|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \ +|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) +# define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE1A)) +# define TIMER_DISABLE_INTR (TIMSK &= ~_BV(OCIE1A)) +#else +# define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) +# define TIMER_DISABLE_INTR (TIMSK1 = 0) +#endif + +//----------------- +#define TIMER_INTR_NAME TIMER1_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR1A = _BV(WGM11); \ + TCCR1B = _BV(WGM13) | _BV(CS10); \ + ICR1 = pwmval; \ + OCR1A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR1A = 0; \ + TCCR1B = _BV(WGM12) | _BV(CS10); \ + OCR1A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT1 = 0; \ +}) + +//----------------- +#if defined(CORE_OC1A_PIN) +# define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 11 // Arduino Mega +#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) +# define TIMER_PWM_PIN 13 // MegaCore +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ +|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ +|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) +# define TIMER_PWM_PIN 13 // MightyCore +#elif defined(__AVR_ATtiny84__) +# define TIMER_PWM_PIN 6 +#else +# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc +#endif // ATmega48, ATmega88, ATmega168, ATmega328 + +//--------------------------------------------------------- +// Timer3 (16 bits) +// +#elif defined(IR_USE_TIMER3) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR3A |= _BV(COM3A1)) +#define TIMER_DISABLE_PWM (TCCR3A &= ~(_BV(COM3A1))) +#define TIMER_ENABLE_INTR (TIMSK3 = _BV(OCIE3A)) +#define TIMER_DISABLE_INTR (TIMSK3 = 0) +#define TIMER_INTR_NAME TIMER3_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR3A = _BV(WGM31); \ + TCCR3B = _BV(WGM33) | _BV(CS30); \ + ICR3 = pwmval; \ + OCR3A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR3A = 0; \ + TCCR3B = _BV(WGM32) | _BV(CS30); \ + OCR3A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT3 = 0; \ +}) + +//----------------- +#if defined(CORE_OC3A_PIN) +# define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 5 // Arduino Mega +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) +# define TIMER_PWM_PIN 6 // MightyCore +#else +# error "Please add OC3A pin number here\n" +#endif + +//--------------------------------------------------------- +// Timer4 (10 bits, high speed option) +// +#elif defined(IR_USE_TIMER4_HS) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) +#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) +#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4)) +#define TIMER_DISABLE_INTR (TIMSK4 = 0) +#define TIMER_INTR_NAME TIMER4_OVF_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR4A = (1<> 8; \ + OCR4C = pwmval; \ + TC4H = (pwmval / 3) >> 8; \ + OCR4A = (pwmval / 3) & 255; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR4A = 0; \ + TCCR4B = _BV(CS40); \ + TCCR4C = 0; \ + TCCR4D = 0; \ + TCCR4E = 0; \ + TC4H = (SYSCLOCK * USECPERTICK / 1000000) >> 8; \ + OCR4C = (SYSCLOCK * USECPERTICK / 1000000) & 255; \ + TC4H = 0; \ + TCNT4 = 0; \ +}) + +//----------------- +#if defined(CORE_OC4A_PIN) +# define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy +#elif defined(__AVR_ATmega32U4__) +# define TIMER_PWM_PIN 13 // Leonardo +#else +# error "Please add OC4A pin number here\n" +#endif + +//--------------------------------------------------------- +// Timer4 (16 bits) +// +#elif defined(IR_USE_TIMER4) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) +#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) +#define TIMER_ENABLE_INTR (TIMSK4 = _BV(OCIE4A)) +#define TIMER_DISABLE_INTR (TIMSK4 = 0) +#define TIMER_INTR_NAME TIMER4_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR4A = _BV(WGM41); \ + TCCR4B = _BV(WGM43) | _BV(CS40); \ + ICR4 = pwmval; \ + OCR4A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR4A = 0; \ + TCCR4B = _BV(WGM42) | _BV(CS40); \ + OCR4A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT4 = 0; \ +}) + +//----------------- +#if defined(CORE_OC4A_PIN) +# define TIMER_PWM_PIN CORE_OC4A_PIN +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 6 // Arduino Mega +#else +# error "Please add OC4A pin number here\n" +#endif + +//--------------------------------------------------------- +// Timer5 (16 bits) +// +#elif defined(IR_USE_TIMER5) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR5A |= _BV(COM5A1)) +#define TIMER_DISABLE_PWM (TCCR5A &= ~(_BV(COM5A1))) +#define TIMER_ENABLE_INTR (TIMSK5 = _BV(OCIE5A)) +#define TIMER_DISABLE_INTR (TIMSK5 = 0) +#define TIMER_INTR_NAME TIMER5_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR5A = _BV(WGM51); \ + TCCR5B = _BV(WGM53) | _BV(CS50); \ + ICR5 = pwmval; \ + OCR5A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR5A = 0; \ + TCCR5B = _BV(WGM52) | _BV(CS50); \ + OCR5A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT5 = 0; \ +}) + +//----------------- +#if defined(CORE_OC5A_PIN) +# define TIMER_PWM_PIN CORE_OC5A_PIN +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 46 // Arduino Mega +#else +# error "Please add OC5A pin number here\n" +#endif + +//--------------------------------------------------------- +// Special carrier modulator timer +// +#elif defined(IR_USE_TIMER_CMT) + +#define TIMER_RESET ({ \ + uint8_t tmp __attribute__((unused)) = CMT_MSC; \ + CMT_CMD2 = 30; \ +}) + +#define TIMER_ENABLE_PWM do { \ + CORE_PIN5_CONFIG = PORT_PCR_MUX(2) | PORT_PCR_DSE | PORT_PCR_SRE; \ +} while(0) + +#define TIMER_DISABLE_PWM do { \ + CORE_PIN5_CONFIG = PORT_PCR_MUX(1) | PORT_PCR_DSE | PORT_PCR_SRE; \ +} while(0) + +#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_CMT) +#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_CMT) +#define TIMER_INTR_NAME cmt_isr + +//----------------- +#ifdef ISR +# undef ISR +#endif +#define ISR(f) void f(void) + +//----------------- +#define CMT_PPS_DIV ((F_BUS + 7999999) / 8000000) +#if F_BUS < 8000000 +#error IRremote requires at least 8 MHz on Teensy 3.x +#endif + +//----------------- +#define TIMER_CONFIG_KHZ(val) ({ \ + SIM_SCGC4 |= SIM_SCGC4_CMT; \ + SIM_SOPT2 |= SIM_SOPT2_PTD7PAD; \ + CMT_PPS = CMT_PPS_DIV - 1; \ + CMT_CGH1 = ((F_BUS / CMT_PPS_DIV / 3000) + ((val)/2)) / (val); \ + CMT_CGL1 = ((F_BUS / CMT_PPS_DIV / 1500) + ((val)/2)) / (val); \ + CMT_CMD1 = 0; \ + CMT_CMD2 = 30; \ + CMT_CMD3 = 0; \ + CMT_CMD4 = 0; \ + CMT_OC = 0x60; \ + CMT_MSC = 0x01; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + SIM_SCGC4 |= SIM_SCGC4_CMT; \ + CMT_PPS = CMT_PPS_DIV - 1; \ + CMT_CGH1 = 1; \ + CMT_CGL1 = 1; \ + CMT_CMD1 = 0; \ + CMT_CMD2 = 30; \ + CMT_CMD3 = 0; \ + CMT_CMD4 = (F_BUS / 160000 + CMT_PPS_DIV / 2) / CMT_PPS_DIV - 31; \ + CMT_OC = 0; \ + CMT_MSC = 0x03; \ +}) + +#define TIMER_PWM_PIN 5 + +// defines for TPM1 timer on Teensy-LC +#elif defined(IR_USE_TIMER_TPM1) +#define TIMER_RESET FTM1_SC |= FTM_SC_TOF; +#define TIMER_ENABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(3)|PORT_PCR_DSE|PORT_PCR_SRE +#define TIMER_DISABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE +#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_FTM1) +#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_FTM1) +#define TIMER_INTR_NAME ftm1_isr +#ifdef ISR +#undef ISR +#endif +#define ISR(f) void f(void) +#define TIMER_CONFIG_KHZ(val) ({ \ + SIM_SCGC6 |= SIM_SCGC6_TPM1; \ + FTM1_SC = 0; \ + FTM1_CNT = 0; \ + FTM1_MOD = (F_PLL/2000) / val - 1; \ + FTM1_C0V = (F_PLL/6000) / val - 1; \ + FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0); \ +}) +#define TIMER_CONFIG_NORMAL() ({ \ + SIM_SCGC6 |= SIM_SCGC6_TPM1; \ + FTM1_SC = 0; \ + FTM1_CNT = 0; \ + FTM1_MOD = (F_PLL/40000) - 1; \ + FTM1_C0V = 0; \ + FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \ +}) +#define TIMER_PWM_PIN 16 + +// defines for timer_tiny0 (8 bits) +#elif defined(IR_USE_TIMER_TINY0) +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR0A |= _BV(COM0B1)) +#define TIMER_DISABLE_PWM (TCCR0A &= ~(_BV(COM0B1))) +#define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE0A)) +#define TIMER_DISABLE_INTR (TIMSK &= ~(_BV(OCIE0A))) +#define TIMER_INTR_NAME TIMER0_COMPA_vect +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR0A = _BV(WGM00); \ + TCCR0B = _BV(WGM02) | _BV(CS00); \ + OCR0A = pwmval; \ + OCR0B = pwmval / 3; \ +}) +#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) +#if (TIMER_COUNT_TOP < 256) +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR0A = _BV(WGM01); \ + TCCR0B = _BV(CS00); \ + OCR0A = TIMER_COUNT_TOP; \ + TCNT0 = 0; \ +}) +#else +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR0A = _BV(WGM01); \ + TCCR0B = _BV(CS01); \ + OCR0A = TIMER_COUNT_TOP / 8; \ + TCNT0 = 0; \ +}) +#endif + +#define TIMER_PWM_PIN 1 /* ATtiny85 */ + +//--------------------------------------------------------- +// Unknown Timer +// +#else +# error "Internal code configuration error, no known IR_USE_TIMER# defined\n" +#endif + +#endif // ! boarddefs_h From 9ae0239fb71a52a633c378c1d8a63aaf43904623 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sat, 8 Oct 2016 02:03:14 -0600 Subject: [PATCH 003/584] updated readme email notice far too many emails for things that should be an issue or PR --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48ddfc986..c8e074cf9 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ If you want to contribute to this project: Check [here](Contributing.md) for some guidelines. ## Contact -The only way to contact me at the moment is by email: zetoslab@gmail.com -I am not currently monitoring any PRs or Issues due to other issues but will respond to all emails. If anyone wants contributor access, feel free to email me. Or if you find any Issues/PRs to be of importance that my attention is needed please email me. +Email: zetoslab@gmail.com +Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means. ## Contributors Check [here](Contributors.md) From 74594847b7707f8d0d0654119fcc895230d5c41c Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Tue, 23 Aug 2016 15:23:51 +0200 Subject: [PATCH 004/584] Move board specific configuration info to new file boarddefs.h. --- IRremoteInt.h | 525 +---------------------------------------------- boarddefs.h | 548 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 550 insertions(+), 523 deletions(-) create mode 100644 boarddefs.h diff --git a/IRremoteInt.h b/IRremoteInt.h index 9a9c3c2f3..1c319acbf 100644 --- a/IRremoteInt.h +++ b/IRremoteInt.h @@ -68,40 +68,6 @@ irparams_t; // Therefore we declare it as "volatile" to stop the compiler/CPU caching it EXTERN volatile irparams_t irparams; -//------------------------------------------------------------------------------ -// Defines for blinking the LED -// - -#if defined(CORE_LED0_PIN) -# define BLINKLED CORE_LED0_PIN -# define BLINKLED_ON() (digitalWrite(CORE_LED0_PIN, HIGH)) -# define BLINKLED_OFF() (digitalWrite(CORE_LED0_PIN, LOW)) - -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define BLINKLED 13 -# define BLINKLED_ON() (PORTB |= B10000000) -# define BLINKLED_OFF() (PORTB &= B01111111) - -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) -# define BLINKLED 0 -# define BLINKLED_ON() (PORTD |= B00000001) -# define BLINKLED_OFF() (PORTD &= B11111110) - -#else -# define BLINKLED 13 - #define BLINKLED_ON() (PORTB |= B00100000) -# define BLINKLED_OFF() (PORTB &= B11011111) -#endif - -//------------------------------------------------------------------------------ -// CPU Frequency -// -#ifdef F_CPU -# define SYSCLOCK F_CPU // main Arduino clock -#else -# define SYSCLOCK 16000000 // main Arduino clock -#endif - //------------------------------------------------------------------------------ // Defines for setting and clearing register bits // @@ -123,9 +89,6 @@ EXTERN volatile irparams_t irparams; // Spaces tend to be 100us too short #define MARK_EXCESS 100 -// microseconds per clock interrupt tick -#define USECPERTICK 50 - // Upper and Lower percentage tolerances in measurements #define TOLERANCE 25 #define LTOL (1.0 - (TOLERANCE/100.)) @@ -144,491 +107,7 @@ EXTERN volatile irparams_t irparams; #define MARK 0 #define SPACE 1 -//------------------------------------------------------------------------------ -// Define which timer to use -// -// Uncomment the timer you wish to use on your board. -// If you are using another library which uses timer2, you have options to -// switch IRremote to use a different timer. -// - -// Arduino Mega -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) - //#define IR_USE_TIMER1 // tx = pin 11 - #define IR_USE_TIMER2 // tx = pin 9 - //#define IR_USE_TIMER3 // tx = pin 5 - //#define IR_USE_TIMER4 // tx = pin 6 - //#define IR_USE_TIMER5 // tx = pin 46 - -// Teensy 1.0 -#elif defined(__AVR_AT90USB162__) - #define IR_USE_TIMER1 // tx = pin 17 - -// Teensy 2.0 -#elif defined(__AVR_ATmega32U4__) - //#define IR_USE_TIMER1 // tx = pin 14 - //#define IR_USE_TIMER3 // tx = pin 9 - #define IR_USE_TIMER4_HS // tx = pin 10 - -// Teensy 3.0 / Teensy 3.1 -#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) - #define IR_USE_TIMER_CMT // tx = pin 5 - -// Teensy-LC -#elif defined(__MKL26Z64__) - #define IR_USE_TIMER_TPM1 // tx = pin 16 - -// Teensy++ 1.0 & 2.0 -#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) - //#define IR_USE_TIMER1 // tx = pin 25 - #define IR_USE_TIMER2 // tx = pin 1 - //#define IR_USE_TIMER3 // tx = pin 16 - -// MightyCore - ATmega1284 -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) - //#define IR_USE_TIMER1 // tx = pin 13 - #define IR_USE_TIMER2 // tx = pin 14 - //#define IR_USE_TIMER3 // tx = pin 6 - -// MightyCore - ATmega164, ATmega324, ATmega644 -#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ -|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ -|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ -|| defined(__AVR_ATmega164P__) - //#define IR_USE_TIMER1 // tx = pin 13 - #define IR_USE_TIMER2 // tx = pin 14 - -//MegaCore - ATmega64, ATmega128 -#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) - #define IR_USE_TIMER1 // tx = pin 13 - -// MightyCore - ATmega8535, ATmega16, ATmega32 -#elif defined(__AVR_ATmega8535__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) - #define IR_USE_TIMER1 // tx = pin 13 - -// Atmega8 -#elif defined(__AVR_ATmega8__) - #define IR_USE_TIMER1 // tx = pin 9 +// All board specific stuff has been moved to its own file, included here. +#include "boarddefs.h" -// ATtiny84 -#elif defined(__AVR_ATtiny84__) - #define IR_USE_TIMER1 // tx = pin 6 - -//ATtiny85 -#elif defined(__AVR_ATtiny85__) - #define IR_USE_TIMER_TINY0 // tx = pin 1 - -// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc -// ATmega48, ATmega88, ATmega168, ATmega328 -#else - //#define IR_USE_TIMER1 // tx = pin 9 - #define IR_USE_TIMER2 // tx = pin 3 - -#endif - -//------------------------------------------------------------------------------ -// Defines for Timer - -//--------------------------------------------------------- -// Timer2 (8 bits) -// -#if defined(IR_USE_TIMER2) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) -#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) -#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) -#define TIMER_DISABLE_INTR (TIMSK2 = 0) -#define TIMER_INTR_NAME TIMER2_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR2A = _BV(WGM20); \ - TCCR2B = _BV(WGM22) | _BV(CS20); \ - OCR2A = pwmval; \ - OCR2B = pwmval / 3; \ -}) - -#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) - -//----------------- -#if (TIMER_COUNT_TOP < 256) -# define TIMER_CONFIG_NORMAL() ({ \ - TCCR2A = _BV(WGM21); \ - TCCR2B = _BV(CS20); \ - OCR2A = TIMER_COUNT_TOP; \ - TCNT2 = 0; \ - }) -#else -# define TIMER_CONFIG_NORMAL() ({ \ - TCCR2A = _BV(WGM21); \ - TCCR2B = _BV(CS21); \ - OCR2A = TIMER_COUNT_TOP / 8; \ - TCNT2 = 0; \ - }) -#endif - -//----------------- -#if defined(CORE_OC2B_PIN) -# define TIMER_PWM_PIN CORE_OC2B_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 9 // Arduino Mega -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ -|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ -|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ -|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ -|| defined(__AVR_ATmega164P__) -# define TIMER_PWM_PIN 14 // MightyCore -#else -# define TIMER_PWM_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc -#endif // ATmega48, ATmega88, ATmega168, ATmega328 - -//--------------------------------------------------------- -// Timer1 (16 bits) -// -#elif defined(IR_USE_TIMER1) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1)) -#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1))) - -//----------------- -#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega8535__) \ -|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \ -|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE1A)) -# define TIMER_DISABLE_INTR (TIMSK &= ~_BV(OCIE1A)) -#else -# define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) -# define TIMER_DISABLE_INTR (TIMSK1 = 0) -#endif - -//----------------- -#define TIMER_INTR_NAME TIMER1_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR1A = _BV(WGM11); \ - TCCR1B = _BV(WGM13) | _BV(CS10); \ - ICR1 = pwmval; \ - OCR1A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR1A = 0; \ - TCCR1B = _BV(WGM12) | _BV(CS10); \ - OCR1A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT1 = 0; \ -}) - -//----------------- -#if defined(CORE_OC1A_PIN) -# define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 11 // Arduino Mega -#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_PWM_PIN 13 // MegaCore -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ -|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ -|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ -|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ -|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ -|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) -# define TIMER_PWM_PIN 13 // MightyCore -#elif defined(__AVR_ATtiny84__) -# define TIMER_PWM_PIN 6 -#else -# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc -#endif // ATmega48, ATmega88, ATmega168, ATmega328 - -//--------------------------------------------------------- -// Timer3 (16 bits) -// -#elif defined(IR_USE_TIMER3) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR3A |= _BV(COM3A1)) -#define TIMER_DISABLE_PWM (TCCR3A &= ~(_BV(COM3A1))) -#define TIMER_ENABLE_INTR (TIMSK3 = _BV(OCIE3A)) -#define TIMER_DISABLE_INTR (TIMSK3 = 0) -#define TIMER_INTR_NAME TIMER3_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR3A = _BV(WGM31); \ - TCCR3B = _BV(WGM33) | _BV(CS30); \ - ICR3 = pwmval; \ - OCR3A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR3A = 0; \ - TCCR3B = _BV(WGM32) | _BV(CS30); \ - OCR3A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT3 = 0; \ -}) - -//----------------- -#if defined(CORE_OC3A_PIN) -# define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 5 // Arduino Mega -#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) -# define TIMER_PWM_PIN 6 // MightyCore -#else -# error "Please add OC3A pin number here\n" -#endif - -//--------------------------------------------------------- -// Timer4 (10 bits, high speed option) -// -#elif defined(IR_USE_TIMER4_HS) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) -#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4)) -#define TIMER_DISABLE_INTR (TIMSK4 = 0) -#define TIMER_INTR_NAME TIMER4_OVF_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR4A = (1<> 8; \ - OCR4C = pwmval; \ - TC4H = (pwmval / 3) >> 8; \ - OCR4A = (pwmval / 3) & 255; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR4A = 0; \ - TCCR4B = _BV(CS40); \ - TCCR4C = 0; \ - TCCR4D = 0; \ - TCCR4E = 0; \ - TC4H = (SYSCLOCK * USECPERTICK / 1000000) >> 8; \ - OCR4C = (SYSCLOCK * USECPERTICK / 1000000) & 255; \ - TC4H = 0; \ - TCNT4 = 0; \ -}) - -//----------------- -#if defined(CORE_OC4A_PIN) -# define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy -#elif defined(__AVR_ATmega32U4__) -# define TIMER_PWM_PIN 13 // Leonardo -#else -# error "Please add OC4A pin number here\n" -#endif - -//--------------------------------------------------------- -// Timer4 (16 bits) -// -#elif defined(IR_USE_TIMER4) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) -#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) -#define TIMER_ENABLE_INTR (TIMSK4 = _BV(OCIE4A)) -#define TIMER_DISABLE_INTR (TIMSK4 = 0) -#define TIMER_INTR_NAME TIMER4_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR4A = _BV(WGM41); \ - TCCR4B = _BV(WGM43) | _BV(CS40); \ - ICR4 = pwmval; \ - OCR4A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR4A = 0; \ - TCCR4B = _BV(WGM42) | _BV(CS40); \ - OCR4A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT4 = 0; \ -}) - -//----------------- -#if defined(CORE_OC4A_PIN) -# define TIMER_PWM_PIN CORE_OC4A_PIN -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 6 // Arduino Mega -#else -# error "Please add OC4A pin number here\n" -#endif - -//--------------------------------------------------------- -// Timer5 (16 bits) -// -#elif defined(IR_USE_TIMER5) - -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR5A |= _BV(COM5A1)) -#define TIMER_DISABLE_PWM (TCCR5A &= ~(_BV(COM5A1))) -#define TIMER_ENABLE_INTR (TIMSK5 = _BV(OCIE5A)) -#define TIMER_DISABLE_INTR (TIMSK5 = 0) -#define TIMER_INTR_NAME TIMER5_COMPA_vect - -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR5A = _BV(WGM51); \ - TCCR5B = _BV(WGM53) | _BV(CS50); \ - ICR5 = pwmval; \ - OCR5A = pwmval / 3; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR5A = 0; \ - TCCR5B = _BV(WGM52) | _BV(CS50); \ - OCR5A = SYSCLOCK * USECPERTICK / 1000000; \ - TCNT5 = 0; \ -}) - -//----------------- -#if defined(CORE_OC5A_PIN) -# define TIMER_PWM_PIN CORE_OC5A_PIN -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 46 // Arduino Mega -#else -# error "Please add OC5A pin number here\n" -#endif - -//--------------------------------------------------------- -// Special carrier modulator timer -// -#elif defined(IR_USE_TIMER_CMT) - -#define TIMER_RESET ({ \ - uint8_t tmp __attribute__((unused)) = CMT_MSC; \ - CMT_CMD2 = 30; \ -}) - -#define TIMER_ENABLE_PWM do { \ - CORE_PIN5_CONFIG = PORT_PCR_MUX(2) | PORT_PCR_DSE | PORT_PCR_SRE; \ -} while(0) - -#define TIMER_DISABLE_PWM do { \ - CORE_PIN5_CONFIG = PORT_PCR_MUX(1) | PORT_PCR_DSE | PORT_PCR_SRE; \ -} while(0) - -#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_CMT) -#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_CMT) -#define TIMER_INTR_NAME cmt_isr - -//----------------- -#ifdef ISR -# undef ISR -#endif -#define ISR(f) void f(void) - -//----------------- -#define CMT_PPS_DIV ((F_BUS + 7999999) / 8000000) -#if F_BUS < 8000000 -#error IRremote requires at least 8 MHz on Teensy 3.x -#endif - -//----------------- -#define TIMER_CONFIG_KHZ(val) ({ \ - SIM_SCGC4 |= SIM_SCGC4_CMT; \ - SIM_SOPT2 |= SIM_SOPT2_PTD7PAD; \ - CMT_PPS = CMT_PPS_DIV - 1; \ - CMT_CGH1 = ((F_BUS / CMT_PPS_DIV / 3000) + ((val)/2)) / (val); \ - CMT_CGL1 = ((F_BUS / CMT_PPS_DIV / 1500) + ((val)/2)) / (val); \ - CMT_CMD1 = 0; \ - CMT_CMD2 = 30; \ - CMT_CMD3 = 0; \ - CMT_CMD4 = 0; \ - CMT_OC = 0x60; \ - CMT_MSC = 0x01; \ -}) - -#define TIMER_CONFIG_NORMAL() ({ \ - SIM_SCGC4 |= SIM_SCGC4_CMT; \ - CMT_PPS = CMT_PPS_DIV - 1; \ - CMT_CGH1 = 1; \ - CMT_CGL1 = 1; \ - CMT_CMD1 = 0; \ - CMT_CMD2 = 30; \ - CMT_CMD3 = 0; \ - CMT_CMD4 = (F_BUS / 160000 + CMT_PPS_DIV / 2) / CMT_PPS_DIV - 31; \ - CMT_OC = 0; \ - CMT_MSC = 0x03; \ -}) - -#define TIMER_PWM_PIN 5 - -// defines for TPM1 timer on Teensy-LC -#elif defined(IR_USE_TIMER_TPM1) -#define TIMER_RESET FTM1_SC |= FTM_SC_TOF; -#define TIMER_ENABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(3)|PORT_PCR_DSE|PORT_PCR_SRE -#define TIMER_DISABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE -#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_FTM1) -#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_FTM1) -#define TIMER_INTR_NAME ftm1_isr -#ifdef ISR -#undef ISR -#endif -#define ISR(f) void f(void) -#define TIMER_CONFIG_KHZ(val) ({ \ - SIM_SCGC6 |= SIM_SCGC6_TPM1; \ - FTM1_SC = 0; \ - FTM1_CNT = 0; \ - FTM1_MOD = (F_PLL/2000) / val - 1; \ - FTM1_C0V = (F_PLL/6000) / val - 1; \ - FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0); \ -}) -#define TIMER_CONFIG_NORMAL() ({ \ - SIM_SCGC6 |= SIM_SCGC6_TPM1; \ - FTM1_SC = 0; \ - FTM1_CNT = 0; \ - FTM1_MOD = (F_PLL/40000) - 1; \ - FTM1_C0V = 0; \ - FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \ -}) -#define TIMER_PWM_PIN 16 - -// defines for timer_tiny0 (8 bits) -#elif defined(IR_USE_TIMER_TINY0) -#define TIMER_RESET -#define TIMER_ENABLE_PWM (TCCR0A |= _BV(COM0B1)) -#define TIMER_DISABLE_PWM (TCCR0A &= ~(_BV(COM0B1))) -#define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE0A)) -#define TIMER_DISABLE_INTR (TIMSK &= ~(_BV(OCIE0A))) -#define TIMER_INTR_NAME TIMER0_COMPA_vect -#define TIMER_CONFIG_KHZ(val) ({ \ - const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ - TCCR0A = _BV(WGM00); \ - TCCR0B = _BV(WGM02) | _BV(CS00); \ - OCR0A = pwmval; \ - OCR0B = pwmval / 3; \ -}) -#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) -#if (TIMER_COUNT_TOP < 256) -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR0A = _BV(WGM01); \ - TCCR0B = _BV(CS00); \ - OCR0A = TIMER_COUNT_TOP; \ - TCNT0 = 0; \ -}) -#else -#define TIMER_CONFIG_NORMAL() ({ \ - TCCR0A = _BV(WGM01); \ - TCCR0B = _BV(CS01); \ - OCR0A = TIMER_COUNT_TOP / 8; \ - TCNT0 = 0; \ -}) -#endif - -#define TIMER_PWM_PIN 1 /* ATtiny85 */ - -//--------------------------------------------------------- -// Unknown Timer -// -#else -# error "Internal code configuration error, no known IR_USE_TIMER# defined\n" -#endif #endif diff --git a/boarddefs.h b/boarddefs.h new file mode 100644 index 000000000..62b6be4fb --- /dev/null +++ b/boarddefs.h @@ -0,0 +1,548 @@ +//****************************************************************************** +// IRremote +// Version 2.0.1 June, 2015 +// Copyright 2009 Ken Shirriff +// For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html + +// This file contains all board specific information. It was previously contained within +// IRremoteInt.h + +// Modified by Paul Stoffregen to support other boards and timers +// +// Interrupt code based on NECIRrcv by Joe Knapp +// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 +// Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ +// +// JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post) +// Whynter A/C ARC-110WD added by Francesco Meschia +//****************************************************************************** + +#ifndef boarddefs_h +#define boarddefs_h + +//------------------------------------------------------------------------------ +// Defines for blinking the LED +// + +#if defined(CORE_LED0_PIN) +# define BLINKLED CORE_LED0_PIN +# define BLINKLED_ON() (digitalWrite(CORE_LED0_PIN, HIGH)) +# define BLINKLED_OFF() (digitalWrite(CORE_LED0_PIN, LOW)) + +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define BLINKLED 13 +# define BLINKLED_ON() (PORTB |= B10000000) +# define BLINKLED_OFF() (PORTB &= B01111111) + +#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) +# define BLINKLED 0 +# define BLINKLED_ON() (PORTD |= B00000001) +# define BLINKLED_OFF() (PORTD &= B11111110) + +#else +# define BLINKLED 13 + #define BLINKLED_ON() (PORTB |= B00100000) +# define BLINKLED_OFF() (PORTB &= B11011111) +#endif + +//------------------------------------------------------------------------------ +// CPU Frequency +// +#ifdef F_CPU +# define SYSCLOCK F_CPU // main Arduino clock +#else +# define SYSCLOCK 16000000 // main Arduino clock +#endif + +// microseconds per clock interrupt tick +#define USECPERTICK 50 + +//------------------------------------------------------------------------------ +// Define which timer to use +// +// Uncomment the timer you wish to use on your board. +// If you are using another library which uses timer2, you have options to +// switch IRremote to use a different timer. +// + +// Arduino Mega +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + //#define IR_USE_TIMER1 // tx = pin 11 + #define IR_USE_TIMER2 // tx = pin 9 + //#define IR_USE_TIMER3 // tx = pin 5 + //#define IR_USE_TIMER4 // tx = pin 6 + //#define IR_USE_TIMER5 // tx = pin 46 + +// Teensy 1.0 +#elif defined(__AVR_AT90USB162__) + #define IR_USE_TIMER1 // tx = pin 17 + +// Teensy 2.0 +#elif defined(__AVR_ATmega32U4__) + //#define IR_USE_TIMER1 // tx = pin 14 + //#define IR_USE_TIMER3 // tx = pin 9 + #define IR_USE_TIMER4_HS // tx = pin 10 + +// Teensy 3.0 / Teensy 3.1 +#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) + #define IR_USE_TIMER_CMT // tx = pin 5 + +// Teensy-LC +#elif defined(__MKL26Z64__) + #define IR_USE_TIMER_TPM1 // tx = pin 16 + +// Teensy++ 1.0 & 2.0 +#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) + //#define IR_USE_TIMER1 // tx = pin 25 + #define IR_USE_TIMER2 // tx = pin 1 + //#define IR_USE_TIMER3 // tx = pin 16 + +// MightyCore - ATmega1284 +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) + //#define IR_USE_TIMER1 // tx = pin 13 + #define IR_USE_TIMER2 // tx = pin 14 + //#define IR_USE_TIMER3 // tx = pin 6 + +// MightyCore - ATmega164, ATmega324, ATmega644 +#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) + //#define IR_USE_TIMER1 // tx = pin 13 + #define IR_USE_TIMER2 // tx = pin 14 + +//MegaCore - ATmega64, ATmega128 +#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) + #define IR_USE_TIMER1 // tx = pin 13 + +// MightyCore - ATmega8535, ATmega16, ATmega32 +#elif defined(__AVR_ATmega8535__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) + #define IR_USE_TIMER1 // tx = pin 13 + +// Atmega8 +#elif defined(__AVR_ATmega8__) + #define IR_USE_TIMER1 // tx = pin 9 + +// ATtiny84 +#elif defined(__AVR_ATtiny84__) + #define IR_USE_TIMER1 // tx = pin 6 + +//ATtiny85 +#elif defined(__AVR_ATtiny85__) + #define IR_USE_TIMER_TINY0 // tx = pin 1 + +// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc +// ATmega48, ATmega88, ATmega168, ATmega328 +#else + //#define IR_USE_TIMER1 // tx = pin 9 + #define IR_USE_TIMER2 // tx = pin 3 + +#endif + +//------------------------------------------------------------------------------ +// Defines for Timer + +//--------------------------------------------------------- +// Timer2 (8 bits) +// +#if defined(IR_USE_TIMER2) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) +#define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) +#define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) +#define TIMER_DISABLE_INTR (TIMSK2 = 0) +#define TIMER_INTR_NAME TIMER2_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR2A = _BV(WGM20); \ + TCCR2B = _BV(WGM22) | _BV(CS20); \ + OCR2A = pwmval; \ + OCR2B = pwmval / 3; \ +}) + +#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) + +//----------------- +#if (TIMER_COUNT_TOP < 256) +# define TIMER_CONFIG_NORMAL() ({ \ + TCCR2A = _BV(WGM21); \ + TCCR2B = _BV(CS20); \ + OCR2A = TIMER_COUNT_TOP; \ + TCNT2 = 0; \ + }) +#else +# define TIMER_CONFIG_NORMAL() ({ \ + TCCR2A = _BV(WGM21); \ + TCCR2B = _BV(CS21); \ + OCR2A = TIMER_COUNT_TOP / 8; \ + TCNT2 = 0; \ + }) +#endif + +//----------------- +#if defined(CORE_OC2B_PIN) +# define TIMER_PWM_PIN CORE_OC2B_PIN // Teensy +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 9 // Arduino Mega +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ +|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) +# define TIMER_PWM_PIN 14 // MightyCore +#else +# define TIMER_PWM_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc +#endif // ATmega48, ATmega88, ATmega168, ATmega328 + +//--------------------------------------------------------- +// Timer1 (16 bits) +// +#elif defined(IR_USE_TIMER1) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1)) +#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1))) + +//----------------- +#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega8535__) \ +|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \ +|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) +# define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE1A)) +# define TIMER_DISABLE_INTR (TIMSK &= ~_BV(OCIE1A)) +#else +# define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A)) +# define TIMER_DISABLE_INTR (TIMSK1 = 0) +#endif + +//----------------- +#define TIMER_INTR_NAME TIMER1_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR1A = _BV(WGM11); \ + TCCR1B = _BV(WGM13) | _BV(CS10); \ + ICR1 = pwmval; \ + OCR1A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR1A = 0; \ + TCCR1B = _BV(WGM12) | _BV(CS10); \ + OCR1A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT1 = 0; \ +}) + +//----------------- +#if defined(CORE_OC1A_PIN) +# define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 11 // Arduino Mega +#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) +# define TIMER_PWM_PIN 13 // MegaCore +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ +|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ +|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ +|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ +|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ +|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) +# define TIMER_PWM_PIN 13 // MightyCore +#elif defined(__AVR_ATtiny84__) +# define TIMER_PWM_PIN 6 +#else +# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc +#endif // ATmega48, ATmega88, ATmega168, ATmega328 + +//--------------------------------------------------------- +// Timer3 (16 bits) +// +#elif defined(IR_USE_TIMER3) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR3A |= _BV(COM3A1)) +#define TIMER_DISABLE_PWM (TCCR3A &= ~(_BV(COM3A1))) +#define TIMER_ENABLE_INTR (TIMSK3 = _BV(OCIE3A)) +#define TIMER_DISABLE_INTR (TIMSK3 = 0) +#define TIMER_INTR_NAME TIMER3_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR3A = _BV(WGM31); \ + TCCR3B = _BV(WGM33) | _BV(CS30); \ + ICR3 = pwmval; \ + OCR3A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR3A = 0; \ + TCCR3B = _BV(WGM32) | _BV(CS30); \ + OCR3A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT3 = 0; \ +}) + +//----------------- +#if defined(CORE_OC3A_PIN) +# define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 5 // Arduino Mega +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) +# define TIMER_PWM_PIN 6 // MightyCore +#else +# error "Please add OC3A pin number here\n" +#endif + +//--------------------------------------------------------- +// Timer4 (10 bits, high speed option) +// +#elif defined(IR_USE_TIMER4_HS) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) +#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) +#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4)) +#define TIMER_DISABLE_INTR (TIMSK4 = 0) +#define TIMER_INTR_NAME TIMER4_OVF_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR4A = (1<> 8; \ + OCR4C = pwmval; \ + TC4H = (pwmval / 3) >> 8; \ + OCR4A = (pwmval / 3) & 255; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR4A = 0; \ + TCCR4B = _BV(CS40); \ + TCCR4C = 0; \ + TCCR4D = 0; \ + TCCR4E = 0; \ + TC4H = (SYSCLOCK * USECPERTICK / 1000000) >> 8; \ + OCR4C = (SYSCLOCK * USECPERTICK / 1000000) & 255; \ + TC4H = 0; \ + TCNT4 = 0; \ +}) + +//----------------- +#if defined(CORE_OC4A_PIN) +# define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy +#elif defined(__AVR_ATmega32U4__) +# define TIMER_PWM_PIN 13 // Leonardo +#else +# error "Please add OC4A pin number here\n" +#endif + +//--------------------------------------------------------- +// Timer4 (16 bits) +// +#elif defined(IR_USE_TIMER4) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1)) +#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1))) +#define TIMER_ENABLE_INTR (TIMSK4 = _BV(OCIE4A)) +#define TIMER_DISABLE_INTR (TIMSK4 = 0) +#define TIMER_INTR_NAME TIMER4_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR4A = _BV(WGM41); \ + TCCR4B = _BV(WGM43) | _BV(CS40); \ + ICR4 = pwmval; \ + OCR4A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR4A = 0; \ + TCCR4B = _BV(WGM42) | _BV(CS40); \ + OCR4A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT4 = 0; \ +}) + +//----------------- +#if defined(CORE_OC4A_PIN) +# define TIMER_PWM_PIN CORE_OC4A_PIN +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 6 // Arduino Mega +#else +# error "Please add OC4A pin number here\n" +#endif + +//--------------------------------------------------------- +// Timer5 (16 bits) +// +#elif defined(IR_USE_TIMER5) + +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR5A |= _BV(COM5A1)) +#define TIMER_DISABLE_PWM (TCCR5A &= ~(_BV(COM5A1))) +#define TIMER_ENABLE_INTR (TIMSK5 = _BV(OCIE5A)) +#define TIMER_DISABLE_INTR (TIMSK5 = 0) +#define TIMER_INTR_NAME TIMER5_COMPA_vect + +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint16_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR5A = _BV(WGM51); \ + TCCR5B = _BV(WGM53) | _BV(CS50); \ + ICR5 = pwmval; \ + OCR5A = pwmval / 3; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR5A = 0; \ + TCCR5B = _BV(WGM52) | _BV(CS50); \ + OCR5A = SYSCLOCK * USECPERTICK / 1000000; \ + TCNT5 = 0; \ +}) + +//----------------- +#if defined(CORE_OC5A_PIN) +# define TIMER_PWM_PIN CORE_OC5A_PIN +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define TIMER_PWM_PIN 46 // Arduino Mega +#else +# error "Please add OC5A pin number here\n" +#endif + +//--------------------------------------------------------- +// Special carrier modulator timer +// +#elif defined(IR_USE_TIMER_CMT) + +#define TIMER_RESET ({ \ + uint8_t tmp __attribute__((unused)) = CMT_MSC; \ + CMT_CMD2 = 30; \ +}) + +#define TIMER_ENABLE_PWM do { \ + CORE_PIN5_CONFIG = PORT_PCR_MUX(2) | PORT_PCR_DSE | PORT_PCR_SRE; \ +} while(0) + +#define TIMER_DISABLE_PWM do { \ + CORE_PIN5_CONFIG = PORT_PCR_MUX(1) | PORT_PCR_DSE | PORT_PCR_SRE; \ +} while(0) + +#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_CMT) +#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_CMT) +#define TIMER_INTR_NAME cmt_isr + +//----------------- +#ifdef ISR +# undef ISR +#endif +#define ISR(f) void f(void) + +//----------------- +#define CMT_PPS_DIV ((F_BUS + 7999999) / 8000000) +#if F_BUS < 8000000 +#error IRremote requires at least 8 MHz on Teensy 3.x +#endif + +//----------------- +#define TIMER_CONFIG_KHZ(val) ({ \ + SIM_SCGC4 |= SIM_SCGC4_CMT; \ + SIM_SOPT2 |= SIM_SOPT2_PTD7PAD; \ + CMT_PPS = CMT_PPS_DIV - 1; \ + CMT_CGH1 = ((F_BUS / CMT_PPS_DIV / 3000) + ((val)/2)) / (val); \ + CMT_CGL1 = ((F_BUS / CMT_PPS_DIV / 1500) + ((val)/2)) / (val); \ + CMT_CMD1 = 0; \ + CMT_CMD2 = 30; \ + CMT_CMD3 = 0; \ + CMT_CMD4 = 0; \ + CMT_OC = 0x60; \ + CMT_MSC = 0x01; \ +}) + +#define TIMER_CONFIG_NORMAL() ({ \ + SIM_SCGC4 |= SIM_SCGC4_CMT; \ + CMT_PPS = CMT_PPS_DIV - 1; \ + CMT_CGH1 = 1; \ + CMT_CGL1 = 1; \ + CMT_CMD1 = 0; \ + CMT_CMD2 = 30; \ + CMT_CMD3 = 0; \ + CMT_CMD4 = (F_BUS / 160000 + CMT_PPS_DIV / 2) / CMT_PPS_DIV - 31; \ + CMT_OC = 0; \ + CMT_MSC = 0x03; \ +}) + +#define TIMER_PWM_PIN 5 + +// defines for TPM1 timer on Teensy-LC +#elif defined(IR_USE_TIMER_TPM1) +#define TIMER_RESET FTM1_SC |= FTM_SC_TOF; +#define TIMER_ENABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(3)|PORT_PCR_DSE|PORT_PCR_SRE +#define TIMER_DISABLE_PWM CORE_PIN16_CONFIG = PORT_PCR_MUX(1)|PORT_PCR_SRE +#define TIMER_ENABLE_INTR NVIC_ENABLE_IRQ(IRQ_FTM1) +#define TIMER_DISABLE_INTR NVIC_DISABLE_IRQ(IRQ_FTM1) +#define TIMER_INTR_NAME ftm1_isr +#ifdef ISR +#undef ISR +#endif +#define ISR(f) void f(void) +#define TIMER_CONFIG_KHZ(val) ({ \ + SIM_SCGC6 |= SIM_SCGC6_TPM1; \ + FTM1_SC = 0; \ + FTM1_CNT = 0; \ + FTM1_MOD = (F_PLL/2000) / val - 1; \ + FTM1_C0V = (F_PLL/6000) / val - 1; \ + FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0); \ +}) +#define TIMER_CONFIG_NORMAL() ({ \ + SIM_SCGC6 |= SIM_SCGC6_TPM1; \ + FTM1_SC = 0; \ + FTM1_CNT = 0; \ + FTM1_MOD = (F_PLL/40000) - 1; \ + FTM1_C0V = 0; \ + FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \ +}) +#define TIMER_PWM_PIN 16 + +// defines for timer_tiny0 (8 bits) +#elif defined(IR_USE_TIMER_TINY0) +#define TIMER_RESET +#define TIMER_ENABLE_PWM (TCCR0A |= _BV(COM0B1)) +#define TIMER_DISABLE_PWM (TCCR0A &= ~(_BV(COM0B1))) +#define TIMER_ENABLE_INTR (TIMSK |= _BV(OCIE0A)) +#define TIMER_DISABLE_INTR (TIMSK &= ~(_BV(OCIE0A))) +#define TIMER_INTR_NAME TIMER0_COMPA_vect +#define TIMER_CONFIG_KHZ(val) ({ \ + const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ + TCCR0A = _BV(WGM00); \ + TCCR0B = _BV(WGM02) | _BV(CS00); \ + OCR0A = pwmval; \ + OCR0B = pwmval / 3; \ +}) +#define TIMER_COUNT_TOP (SYSCLOCK * USECPERTICK / 1000000) +#if (TIMER_COUNT_TOP < 256) +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR0A = _BV(WGM01); \ + TCCR0B = _BV(CS00); \ + OCR0A = TIMER_COUNT_TOP; \ + TCNT0 = 0; \ +}) +#else +#define TIMER_CONFIG_NORMAL() ({ \ + TCCR0A = _BV(WGM01); \ + TCCR0B = _BV(CS01); \ + OCR0A = TIMER_COUNT_TOP / 8; \ + TCNT0 = 0; \ +}) +#endif + +#define TIMER_PWM_PIN 1 /* ATtiny85 */ + +//--------------------------------------------------------- +// Unknown Timer +// +#else +# error "Internal code configuration error, no known IR_USE_TIMER# defined\n" +#endif + +#endif // ! boarddefs_h From 20b6e3b8a26f4898cb5f2f1f57a482f96044f260 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Fri, 11 Nov 2016 22:28:41 -0600 Subject: [PATCH 005/584] Just gonna put this in here.... --- Contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Contributors.md b/Contributors.md index cabd0654e..36ec80630 100644 --- a/Contributors.md +++ b/Contributors.md @@ -5,6 +5,7 @@ These are the active contributors of this project that you may contact if there * Email: zetoslab@gmail.com * Skype: polarised16 - [shirriff](https://github.com/shirriff) : An amazing person who worked to create this awesome library and provide unending support +- [AnalysIR](https:/github.com/AnalysIR): Active contributor and is amazing with providing support! - [Informatic](https://github.com/Informatic) : Active contributor - [fmeschia](https://github.com/fmeschia) : Active contributor - [PaulStoffregen](https://github.com/paulstroffregen) : Active contributor From 9a74475c8d88ff2d55742f7609ce3394fda3b653 Mon Sep 17 00:00:00 2001 From: Felipe Noronha Date: Fri, 13 Jan 2017 11:58:40 -0200 Subject: [PATCH 006/584] fix example error message --- examples/IRrecvDumpV2/IRrecvDumpV2.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/IRrecvDumpV2/IRrecvDumpV2.ino b/examples/IRrecvDumpV2/IRrecvDumpV2.ino index cbfadccec..725612735 100644 --- a/examples/IRrecvDumpV2/IRrecvDumpV2.ino +++ b/examples/IRrecvDumpV2/IRrecvDumpV2.ino @@ -66,7 +66,7 @@ void dumpInfo (decode_results *results) { // Check if the buffer overflowed if (results->overflow) { - Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWLEN"); + Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWBUF"); return; } From 3b41130ff916f03e46e8e45d5c54a0f02124ae0f Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Fri, 20 Jan 2017 23:59:24 -0600 Subject: [PATCH 007/584] Manual merge of #398 --- changelog.md | 3 +++ examples/IRrecord/IRrecord.ino | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index fbe70b457..cb2b7e26f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## 2.2.2 - 2017/01/20 +- Fixed naming bug [PR #398](https://github.com/z3t0/Arduino-IRremote/pull/398) + ## 2.2.1 - 2016/07/27 - Added tests for Lego Power Functions Protocol [PR #336](https://github.com/z3t0/Arduino-IRremote/pull/336) diff --git a/examples/IRrecord/IRrecord.ino b/examples/IRrecord/IRrecord.ino index bf290fa39..7fc5cfd39 100644 --- a/examples/IRrecord/IRrecord.ino +++ b/examples/IRrecord/IRrecord.ino @@ -126,7 +126,7 @@ void sendCode(int repeat) { Serial.println(codeValue, HEX); } else if (codeType == JVC) { - irsend.sendPanasonic(codeValue, codeLen); + irsend.sendJVC(codeValue, codeLen, false); Serial.print("Sent JVC"); Serial.println(codeValue, HEX); } From 4f24b696cf8ea2a7ec28c95c7216803fa3621ecd Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Fri, 3 Feb 2017 21:18:47 -0600 Subject: [PATCH 008/584] Update ISSUE_TEMPLATE.md --- ISSUE_TEMPLATE.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index bb9232ea3..98358d0e4 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -14,8 +14,12 @@ Use [a gist](gist.github.com) if the code exceeds 30 lines **checklist:** +- [] I have **read** the README.md file thoroughly +- [] I have searched existing issues to see if there is anything I have missed. - [] The latest [release](https://github.com/z3t0/Arduino-IRremote/releases/latest) is used -- [] Any code referenced is provided +- [] Any code referenced is provided and if over 30 lines a gist is linked INSTEAD of it being pasted in here - [] The title of the issue is helpful and relevant -The above is a short template allowing you to make detailed issues! \ No newline at end of file +** We will start to close issues that do not follow these guidelines as it doesn't help the contributors who spend time trying to solve issues if the community ignores guidelines!** + +The above is a short template allowing you to make detailed issues! From aa8f7b31fe16ccb8e26baa5e887126bfca4e24ed Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Sun, 19 Mar 2017 20:27:56 -0700 Subject: [PATCH 009/584] Added ESP32 IR receive support (IRsend not implemented yet). - disable a lot of defines not relevant to ESP32, set them to 1 (no-op) - change default IR pin to 35 from 11 - changed serial speed to 115200 (9600 is too slow to keep up with IR input) - irSend disables code that will not compile on ESP32. It won't work, but it won't break compilation either. --- IRremote.cpp | 6 ++++++ boarddefs.h | 13 +++++++++++++ examples/IRrecvDemo/IRrecvDemo.ino | 8 +++++++- examples/IRrecvDump/IRrecvDump.ino | 8 ++++++-- examples/IRrecvDumpV2/IRrecvDumpV2.ino | 4 ++-- irRecv.cpp | 15 +++++++++++++++ irSend.cpp | 3 +++ 7 files changed, 52 insertions(+), 5 deletions(-) diff --git a/IRremote.cpp b/IRremote.cpp index c9907ebe7..9613beaa1 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -18,7 +18,9 @@ // Whynter A/C ARC-110WD added by Francesco Meschia //****************************************************************************** +#ifndef ESP32 #include +#endif // Defining IR_GLOBAL here allows us to declare the instantiation of global variables #define IR_GLOBAL @@ -120,7 +122,11 @@ int MATCH_SPACE (int measured_ticks, int desired_us) // As soon as first MARK arrives: // Gap width is recorded; Ready is cleared; New logging starts // +#ifdef ESP32 +void onTimer() +#else ISR (TIMER_INTR_NAME) +#endif { TIMER_RESET; diff --git a/boarddefs.h b/boarddefs.h index 62b6be4fb..ce8a4f97d 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -39,6 +39,10 @@ # define BLINKLED_ON() (PORTD |= B00000001) # define BLINKLED_OFF() (PORTD &= B11111110) +#elif defined(ESP32) +# define BLINKLED 255 +# define BLINKLED_ON() 1 +# define BLINKLED_OFF() 1 #else # define BLINKLED 13 #define BLINKLED_ON() (PORTB |= B00100000) @@ -147,12 +151,21 @@ // #if defined(IR_USE_TIMER2) +#ifdef ESP32 // Used in irSend, not implemented yet (FIXME) +#define TIMER_RESET 1 +#define TIMER_ENABLE_PWM 1 +#define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet"); +#define TIMER_ENABLE_INTR 1 +#define TIMER_DISABLE_INTR 1 +#define TIMER_INTR_NAME 1 +#else #define TIMER_RESET #define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) #define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) #define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) #define TIMER_DISABLE_INTR (TIMSK2 = 0) #define TIMER_INTR_NAME TIMER2_COMPA_vect +#endif #define TIMER_CONFIG_KHZ(val) ({ \ const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ diff --git a/examples/IRrecvDemo/IRrecvDemo.ino b/examples/IRrecvDemo/IRrecvDemo.ino index 3a498328d..4635b2c79 100644 --- a/examples/IRrecvDemo/IRrecvDemo.ino +++ b/examples/IRrecvDemo/IRrecvDemo.ino @@ -8,7 +8,11 @@ #include +#ifdef ESP32 +int RECV_PIN = 35; +#else int RECV_PIN = 11; +#endif IRrecv irrecv(RECV_PIN); @@ -16,8 +20,10 @@ decode_results results; void setup() { - Serial.begin(9600); + Serial.begin(115200); + Serial.println("Enabling IRin"); irrecv.enableIRIn(); // Start the receiver + Serial.println("Enabled IRin"); } void loop() { diff --git a/examples/IRrecvDump/IRrecvDump.ino b/examples/IRrecvDump/IRrecvDump.ino index 90b47ba69..9a21b5698 100644 --- a/examples/IRrecvDump/IRrecvDump.ino +++ b/examples/IRrecvDump/IRrecvDump.ino @@ -15,7 +15,11 @@ * You can change this to another available Arduino Pin. * Your IR receiver should be connected to the pin defined here */ -int RECV_PIN = 11; +#ifdef ESP32 +int RECV_PIN = 35; +#else +int RECV_PIN = 11; +#endif IRrecv irrecv(RECV_PIN); @@ -23,7 +27,7 @@ decode_results results; void setup() { - Serial.begin(9600); + Serial.begin(115200); irrecv.enableIRIn(); // Start the receiver } diff --git a/examples/IRrecvDumpV2/IRrecvDumpV2.ino b/examples/IRrecvDumpV2/IRrecvDumpV2.ino index 725612735..570baba94 100644 --- a/examples/IRrecvDumpV2/IRrecvDumpV2.ino +++ b/examples/IRrecvDumpV2/IRrecvDumpV2.ino @@ -6,7 +6,7 @@ //------------------------------------------------------------------------------ // Tell IRremote which Arduino pin is connected to the IR Receiver (TSOP4838) // -int recvPin = 11; +int recvPin = 35; IRrecv irrecv(recvPin); //+============================================================================= @@ -14,7 +14,7 @@ IRrecv irrecv(recvPin); // void setup ( ) { - Serial.begin(9600); // Status message will be sent to PC at 9600 baud + Serial.begin(115200); // Status message will be sent to PC at 9600 baud irrecv.enableIRIn(); // Start the receiver } diff --git a/irRecv.cpp b/irRecv.cpp index 63438566a..2f510c4a2 100644 --- a/irRecv.cpp +++ b/irRecv.cpp @@ -1,5 +1,10 @@ #include "IRremote.h" #include "IRremoteInt.h" + +#ifdef ESP32 +hw_timer_t *timer; +void onTimer(); // defined in IRremote.cpp +#endif //+============================================================================= // Decodes the received IR message @@ -117,6 +122,15 @@ IRrecv::IRrecv (int recvpin, int blinkpin) // void IRrecv::enableIRIn ( ) { +// Interrupt Service Routine - Fires every 50uS +#ifdef ESP32 + // 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up + timer = timerBegin(1, 80, 1); + timerAttachInterrupt(timer, &onTimer, 1); + // every 50ns, autoreload = true + timerAlarmWrite(timer, 50, true); + timerAlarmEnable(timer); +#else cli(); // Setup pulse clock timer interrupt // Prescale /8 (16M/8 = 0.5 microseconds per tick) @@ -130,6 +144,7 @@ void IRrecv::enableIRIn ( ) TIMER_RESET; sei(); // enable interrupts +#endif // Initialize state machine variables irparams.rcvstate = STATE_IDLE; diff --git a/irSend.cpp b/irSend.cpp index 253c941a9..6191aa6ad 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -54,6 +54,8 @@ void IRsend::space (unsigned int time) // void IRsend::enableIROut (int khz) { +// FIXME: implement ESP32 support +#ifndef ESP32 // Disable the Timer2 Interrupt (which is used for receiving IR) TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt @@ -66,6 +68,7 @@ void IRsend::enableIROut (int khz) // CS2 = 000: no prescaling // The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A. TIMER_CONFIG_KHZ(khz); +#endif } //+============================================================================= From 1b56da6cc73ec787e3d570e9906d80fad01933df Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Sun, 19 Mar 2017 21:28:14 -0700 Subject: [PATCH 010/584] Rename ESP32 timer name so that it doesn't conflict with other timers. --- IRremote.cpp | 2 +- irRecv.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/IRremote.cpp b/IRremote.cpp index 9613beaa1..b438bc16f 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -123,7 +123,7 @@ int MATCH_SPACE (int measured_ticks, int desired_us) // Gap width is recorded; Ready is cleared; New logging starts // #ifdef ESP32 -void onTimer() +void IRTimer() #else ISR (TIMER_INTR_NAME) #endif diff --git a/irRecv.cpp b/irRecv.cpp index 2f510c4a2..a15ac0f57 100644 --- a/irRecv.cpp +++ b/irRecv.cpp @@ -3,7 +3,7 @@ #ifdef ESP32 hw_timer_t *timer; -void onTimer(); // defined in IRremote.cpp +void IRTimer(); // defined in IRremote.cpp #endif //+============================================================================= @@ -126,7 +126,7 @@ void IRrecv::enableIRIn ( ) #ifdef ESP32 // 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up timer = timerBegin(1, 80, 1); - timerAttachInterrupt(timer, &onTimer, 1); + timerAttachInterrupt(timer, &IRTimer, 1); // every 50ns, autoreload = true timerAlarmWrite(timer, 50, true); timerAlarmEnable(timer); From 257a15130ff2a3386984ea96405ca50707c23237 Mon Sep 17 00:00:00 2001 From: Philipp Henkel Date: Sun, 26 Mar 2017 22:32:55 +0200 Subject: [PATCH 011/584] Fix calculation of pause length in LEGO PF protocol Fix #384 Integer overflow in LEGO Power Functions affects pause between messages Is rebased version of PR #385 --- .../LegoPowerFunctionsTests.ino | 18 +++---- ir_Lego_PF_BitStreamEncoder.h | 50 +++++++++---------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/examples/LegoPowerFunctionsTests/LegoPowerFunctionsTests.ino b/examples/LegoPowerFunctionsTests/LegoPowerFunctionsTests.ino index 6a2bda57d..65760e2fd 100644 --- a/examples/LegoPowerFunctionsTests/LegoPowerFunctionsTests.ino +++ b/examples/LegoPowerFunctionsTests/LegoPowerFunctionsTests.ino @@ -1,6 +1,6 @@ /* * LegoPowerFunctionsTest: LEGO Power Functions Tests - * Copyright (c) 2016 Philipp Henkel + * Copyright (c) 2016, 2017 Philipp Henkel */ #include @@ -78,14 +78,14 @@ void testMessageBitCount(LegoPfBitStreamEncoder& bitStreamEncoder) { logTestResult(bitCount == 18); } -boolean check(LegoPfBitStreamEncoder& bitStreamEncoder, int markDuration, int pauseDuration) { +boolean check(LegoPfBitStreamEncoder& bitStreamEncoder, unsigned long markDuration, unsigned long pauseDuration) { bool result = true; result = result && bitStreamEncoder.getMarkDuration() == markDuration; result = result && bitStreamEncoder.getPauseDuration() == pauseDuration; return result; } -boolean checkNext(LegoPfBitStreamEncoder& bitStreamEncoder, int markDuration, int pauseDuration) { +boolean checkNext(LegoPfBitStreamEncoder& bitStreamEncoder, unsigned long markDuration, unsigned long pauseDuration) { bool result = bitStreamEncoder.next(); result = result && check(bitStreamEncoder, markDuration, pauseDuration); return result; @@ -129,16 +129,16 @@ void testMessage407Repeated(LegoPfBitStreamEncoder& bitStreamEncoder) { bool result = true; result = result && check(bitStreamEncoder, 158, 1026); result = result && checkDataBitsOfMessage407(bitStreamEncoder); - result = result && checkNext(bitStreamEncoder, 158, 1026 + 5 * 16000 - 10844); + result = result && checkNext(bitStreamEncoder, 158, 1026L + 5L * 16000L - 10844L); result = result && checkNext(bitStreamEncoder, 158, 1026); result = result && checkDataBitsOfMessage407(bitStreamEncoder); - result = result && checkNext(bitStreamEncoder, 158, 1026 + 5 * 16000 - 10844); + result = result && checkNext(bitStreamEncoder, 158, 1026L + 5L * 16000L - 10844L); result = result && checkNext(bitStreamEncoder, 158, 1026); result = result && checkDataBitsOfMessage407(bitStreamEncoder); - result = result && checkNext(bitStreamEncoder, 158, 1026 + 8 * 16000 - 10844); + result = result && checkNext(bitStreamEncoder, 158, 1026L + 8L * 16000L - 10844L); result = result && checkNext(bitStreamEncoder, 158, 1026); result = result && checkDataBitsOfMessage407(bitStreamEncoder); - result = result && checkNext(bitStreamEncoder, 158, 1026 + 8 * 16000 - 10844); + result = result && checkNext(bitStreamEncoder, 158, 1026L + 8L * 16000L - 10844L); result = result && checkNext(bitStreamEncoder, 158, 1026); result = result && checkDataBitsOfMessage407(bitStreamEncoder); result = result && checkNext(bitStreamEncoder, 158, 1026); @@ -191,7 +191,3 @@ void testGetMessageLengthAllLow(LegoPfBitStreamEncoder& bitStreamEncoder) { bitStreamEncoder.reset(0x0, false); logTestResult(bitStreamEncoder.getMessageLength() == 9104); } - - - - diff --git a/ir_Lego_PF_BitStreamEncoder.h b/ir_Lego_PF_BitStreamEncoder.h index 7689cde28..e5a3d66a9 100644 --- a/ir_Lego_PF_BitStreamEncoder.h +++ b/ir_Lego_PF_BitStreamEncoder.h @@ -4,7 +4,7 @@ // L E E O O // L EEEE E EEE O O // L E E E O O LEGO Power Functions -// LLLLLL EEEEEE EEEE OOOO Copyright (c) 2016 Philipp Henkel +// LLLLLL EEEEEE EEEE OOOO Copyright (c) 2016, 2017 Philipp Henkel //============================================================================== //+============================================================================= @@ -14,25 +14,25 @@ class LegoPfBitStreamEncoder { private: uint16_t data; bool repeatMessage; - int messageBitIdx; - int repeatCount; - int messageLength; + uint8_t messageBitIdx; + uint8_t repeatCount; + uint16_t messageLength; + public: // HIGH data bit = IR mark + high pause // LOW data bit = IR mark + low pause - static const int LOW_BIT_DURATION = 421; - static const int HIGH_BIT_DURATION = 711; - static const int START_BIT_DURATION = 1184; - static const int STOP_BIT_DURATION = 1184; - static const int IR_MARK_DURATION = 158; - static const int HIGH_PAUSE_DURATION = HIGH_BIT_DURATION - IR_MARK_DURATION; - static const int LOW_PAUSE_DURATION = LOW_BIT_DURATION - IR_MARK_DURATION; - static const int START_PAUSE_DURATION = START_BIT_DURATION - IR_MARK_DURATION; - static const int STOP_PAUSE_DURATION = STOP_BIT_DURATION - IR_MARK_DURATION; - static const int MESSAGE_BITS = 18; - static const int MAX_MESSAGE_LENGTH = 16000; + static const uint16_t LOW_BIT_DURATION = 421; + static const uint16_t HIGH_BIT_DURATION = 711; + static const uint16_t START_BIT_DURATION = 1184; + static const uint16_t STOP_BIT_DURATION = 1184; + static const uint8_t IR_MARK_DURATION = 158; + static const uint16_t HIGH_PAUSE_DURATION = HIGH_BIT_DURATION - IR_MARK_DURATION; + static const uint16_t LOW_PAUSE_DURATION = LOW_BIT_DURATION - IR_MARK_DURATION; + static const uint16_t START_PAUSE_DURATION = START_BIT_DURATION - IR_MARK_DURATION; + static const uint16_t STOP_PAUSE_DURATION = STOP_BIT_DURATION - IR_MARK_DURATION; + static const uint8_t MESSAGE_BITS = 18; + static const uint16_t MAX_MESSAGE_LENGTH = 16000; - public: void reset(uint16_t data, bool repeatMessage) { this->data = data; this->repeatMessage = repeatMessage; @@ -43,9 +43,9 @@ class LegoPfBitStreamEncoder { int getChannelId() const { return 1 + ((data >> 12) & 0x3); } - int getMessageLength() const { + uint16_t getMessageLength() const { // Sum up all marks - int length = MESSAGE_BITS * IR_MARK_DURATION; + uint16_t length = MESSAGE_BITS * IR_MARK_DURATION; // Sum up all pauses length += START_PAUSE_DURATION; @@ -75,9 +75,9 @@ class LegoPfBitStreamEncoder { } } - int getMarkDuration() const { return IR_MARK_DURATION; } + uint8_t getMarkDuration() const { return IR_MARK_DURATION; } - int getPauseDuration() const { + uint32_t getPauseDuration() const { if (messageBitIdx == 0) return START_PAUSE_DURATION; else if (messageBitIdx < MESSAGE_BITS - 1) { @@ -88,13 +88,13 @@ class LegoPfBitStreamEncoder { } private: - int getDataBitPause() const { + uint16_t getDataBitPause() const { const int pos = MESSAGE_BITS - 2 - messageBitIdx; const bool isHigh = data & (1 << pos); return isHigh ? HIGH_PAUSE_DURATION : LOW_PAUSE_DURATION; } - int getStopPause() const { + uint32_t getStopPause() const { if (repeatMessage) { return getRepeatStopPause(); } else { @@ -102,12 +102,12 @@ class LegoPfBitStreamEncoder { } } - int getRepeatStopPause() const { + uint32_t getRepeatStopPause() const { if (repeatCount == 0 || repeatCount == 1) { - return STOP_PAUSE_DURATION + 5 * MAX_MESSAGE_LENGTH - messageLength; + return STOP_PAUSE_DURATION + (uint32_t)5 * MAX_MESSAGE_LENGTH - messageLength; } else if (repeatCount == 2 || repeatCount == 3) { return STOP_PAUSE_DURATION - + (6 + 2 * getChannelId()) * MAX_MESSAGE_LENGTH - messageLength; + + (uint32_t)(6 + 2 * getChannelId()) * MAX_MESSAGE_LENGTH - messageLength; } else { return STOP_PAUSE_DURATION; } From ccc9d0135cd5d4786b5b1ccc8b2a5056a9900e4c Mon Sep 17 00:00:00 2001 From: Philipp Henkel Date: Mon, 27 Mar 2017 19:57:25 +0200 Subject: [PATCH 012/584] Add Lego fix to change and bump version up to 2.2.3 --- Contributors.md | 2 +- README.md | 4 ++-- changelog.md | 3 +++ library.json | 2 +- library.properties | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Contributors.md b/Contributors.md index 36ec80630..ae2489008 100644 --- a/Contributors.md +++ b/Contributors.md @@ -16,7 +16,7 @@ These are the active contributors of this project that you may contact if there - [Sebazzz](https://github.com/sebazz): Contributor - [lumbric](https://github.com/lumbric): Contributor - [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Active Contributor -- [henkel](https://github.com/henkel): Contributor +- [philipphenkel](https://github.com/philipphenkel): Active Contributor - [MCUdude](https://github.com/MCUdude): Contributor Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. diff --git a/README.md b/README.md index c8e074cf9..2ec302c58 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This library enables you to send and receive using infra-red signals on an Ardui Tutorials and more information will be made available on [the official homepage](http://z3t0.github.io/Arduino-IRremote/). -## Version - 2.2.1 +## Version - 2.2.3 ## Installation 1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page. @@ -65,7 +65,7 @@ Check [here](Contributing.md) for some guidelines. ## Contact Email: zetoslab@gmail.com -Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means. +Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means. ## Contributors Check [here](Contributors.md) diff --git a/changelog.md b/changelog.md index cb2b7e26f..0702ddcf9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## 2.2.3 - 2017/03/27 +- Fix calculation of pause length in LEGO PF protocol [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/427) + ## 2.2.2 - 2017/01/20 - Fixed naming bug [PR #398](https://github.com/z3t0/Arduino-IRremote/pull/398) diff --git a/library.json b/library.json index 090578d10..de93d16e5 100644 --- a/library.json +++ b/library.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/z3t0/Arduino-IRremote.git" }, - "version": "2.2.1", + "version": "2.2.3", "frameworks": "arduino", "platforms": "atmelavr", "authors" : diff --git a/library.properties b/library.properties index 15aabee44..39fd814eb 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=IRremote -version=2.2.1 +version=2.2.3 author=shirriff maintainer=shirriff sentence=Send and receive infrared signals with multiple protocols From eae9de43076fb839cad9c1371ceac7c0579f7b46 Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Fri, 31 Mar 2017 21:52:52 -0700 Subject: [PATCH 013/584] Cleaned up ESP32 integration, reverted ESP32 ifdefs on irreceive examples. - fixed indenting on existing code in a few places for consistency - introduced IR_TIMER_USE_ESP32 for ifdefs within the code as per request - added comments explaining what's missing for irsend support on ESP32 - IRrecvDemo.ino gets a warning before and after interrupt is enabled in case it causes a crash TESTED=IoTuz ESP32 board and original 328p arduino to make sure current code did not break. --- IRremote.cpp | 11 +++---- boarddefs.h | 40 ++++++++++++++++++-------- examples/IRrecvDemo/IRrecvDemo.ino | 8 ++---- examples/IRrecvDump/IRrecvDump.ino | 4 --- examples/IRrecvDumpV2/IRrecvDumpV2.ino | 4 +-- irRecv.cpp | 2 ++ irSend.cpp | 2 +- 7 files changed, 42 insertions(+), 29 deletions(-) diff --git a/IRremote.cpp b/IRremote.cpp index b438bc16f..e811cfc7b 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -18,16 +18,17 @@ // Whynter A/C ARC-110WD added by Francesco Meschia //****************************************************************************** -#ifndef ESP32 -#include -#endif - // Defining IR_GLOBAL here allows us to declare the instantiation of global variables #define IR_GLOBAL # include "IRremote.h" # include "IRremoteInt.h" #undef IR_GLOBAL +#ifndef IR_TIMER_USE_ESP32 +#include +#endif + + //+============================================================================= // The match functions were (apparently) originally MACROs to improve code speed // (although this would have bloated the code) hence the names being CAPS @@ -122,7 +123,7 @@ int MATCH_SPACE (int measured_ticks, int desired_us) // As soon as first MARK arrives: // Gap width is recorded; Ready is cleared; New logging starts // -#ifdef ESP32 +#ifdef IR_TIMER_USE_ESP32 void IRTimer() #else ISR (TIMER_INTR_NAME) diff --git a/boarddefs.h b/boarddefs.h index ce8a4f97d..c126b546b 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -39,13 +39,14 @@ # define BLINKLED_ON() (PORTD |= B00000001) # define BLINKLED_OFF() (PORTD &= B11111110) +// No system LED on ESP32, disable blinking #elif defined(ESP32) # define BLINKLED 255 # define BLINKLED_ON() 1 # define BLINKLED_OFF() 1 #else # define BLINKLED 13 - #define BLINKLED_ON() (PORTB |= B00100000) +# define BLINKLED_ON() (PORTB |= B00100000) # define BLINKLED_OFF() (PORTB &= B11011111) #endif @@ -129,14 +130,16 @@ // ATtiny84 #elif defined(__AVR_ATtiny84__) - #define IR_USE_TIMER1 // tx = pin 6 + #define IR_USE_TIMER1 // tx = pin 6 //ATtiny85 #elif defined(__AVR_ATtiny85__) - #define IR_USE_TIMER_TINY0 // tx = pin 1 + #define IR_USE_TIMER_TINY0 // tx = pin 1 // Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc // ATmega48, ATmega88, ATmega168, ATmega328 +#elif defined(ESP32) + #define IR_TIMER_USE_ESP32 #else //#define IR_USE_TIMER1 // tx = pin 9 #define IR_USE_TIMER2 // tx = pin 3 @@ -151,21 +154,12 @@ // #if defined(IR_USE_TIMER2) -#ifdef ESP32 // Used in irSend, not implemented yet (FIXME) -#define TIMER_RESET 1 -#define TIMER_ENABLE_PWM 1 -#define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet"); -#define TIMER_ENABLE_INTR 1 -#define TIMER_DISABLE_INTR 1 -#define TIMER_INTR_NAME 1 -#else #define TIMER_RESET #define TIMER_ENABLE_PWM (TCCR2A |= _BV(COM2B1)) #define TIMER_DISABLE_PWM (TCCR2A &= ~(_BV(COM2B1))) #define TIMER_ENABLE_INTR (TIMSK2 = _BV(OCIE2A)) #define TIMER_DISABLE_INTR (TIMSK2 = 0) #define TIMER_INTR_NAME TIMER2_COMPA_vect -#endif #define TIMER_CONFIG_KHZ(val) ({ \ const uint8_t pwmval = SYSCLOCK / 2000 / (val); \ @@ -551,6 +545,28 @@ #define TIMER_PWM_PIN 1 /* ATtiny85 */ +//--------------------------------------------------------- +// ESP32 (ESP8266 should likely be added here too) +// + +// ESP32 has it own timer API and does not use these macros, but to avoid ifdef'ing +// them out in the common code, they are defined to no-op. This allows the code to compile +// (which it wouldn't otherwise) but irsend will not work until ESP32 specific code is written +// for that -- merlin +// As a warning, sending timing specific code from an ESP32 can be challenging if you need 100% +// reliability because the arduino code may be interrupted and cause your sent waveform to be the +// wrong length. This is specifically an issue for neopixels which require 800Khz resolution. +// IR may just work as is with the common code since it's lower frequency, but if not, the other +// way to do this on ESP32 is using the RMT built in driver like in this incomplete library below +// https://github.com/ExploreEmbedded/ESP32_RMT +#elif defined(IR_TIMER_USE_ESP32) +#define TIMER_RESET 1 +#define TIMER_ENABLE_PWM 1 +#define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet"); +#define TIMER_ENABLE_INTR 1 +#define TIMER_DISABLE_INTR 1 +#define TIMER_INTR_NAME 1 + //--------------------------------------------------------- // Unknown Timer // diff --git a/examples/IRrecvDemo/IRrecvDemo.ino b/examples/IRrecvDemo/IRrecvDemo.ino index 4635b2c79..3e2d280eb 100644 --- a/examples/IRrecvDemo/IRrecvDemo.ino +++ b/examples/IRrecvDemo/IRrecvDemo.ino @@ -8,11 +8,7 @@ #include -#ifdef ESP32 -int RECV_PIN = 35; -#else int RECV_PIN = 11; -#endif IRrecv irrecv(RECV_PIN); @@ -20,7 +16,9 @@ decode_results results; void setup() { - Serial.begin(115200); + Serial.begin(9600); + // In case the interrupt driver crashes on setup, give a clue + // to the user what's going on. Serial.println("Enabling IRin"); irrecv.enableIRIn(); // Start the receiver Serial.println("Enabled IRin"); diff --git a/examples/IRrecvDump/IRrecvDump.ino b/examples/IRrecvDump/IRrecvDump.ino index 9a21b5698..990c3f60c 100644 --- a/examples/IRrecvDump/IRrecvDump.ino +++ b/examples/IRrecvDump/IRrecvDump.ino @@ -15,11 +15,7 @@ * You can change this to another available Arduino Pin. * Your IR receiver should be connected to the pin defined here */ -#ifdef ESP32 -int RECV_PIN = 35; -#else int RECV_PIN = 11; -#endif IRrecv irrecv(RECV_PIN); diff --git a/examples/IRrecvDumpV2/IRrecvDumpV2.ino b/examples/IRrecvDumpV2/IRrecvDumpV2.ino index 570baba94..725612735 100644 --- a/examples/IRrecvDumpV2/IRrecvDumpV2.ino +++ b/examples/IRrecvDumpV2/IRrecvDumpV2.ino @@ -6,7 +6,7 @@ //------------------------------------------------------------------------------ // Tell IRremote which Arduino pin is connected to the IR Receiver (TSOP4838) // -int recvPin = 35; +int recvPin = 11; IRrecv irrecv(recvPin); //+============================================================================= @@ -14,7 +14,7 @@ IRrecv irrecv(recvPin); // void setup ( ) { - Serial.begin(115200); // Status message will be sent to PC at 9600 baud + Serial.begin(9600); // Status message will be sent to PC at 9600 baud irrecv.enableIRIn(); // Start the receiver } diff --git a/irRecv.cpp b/irRecv.cpp index a15ac0f57..6631fb7ef 100644 --- a/irRecv.cpp +++ b/irRecv.cpp @@ -124,6 +124,8 @@ void IRrecv::enableIRIn ( ) { // Interrupt Service Routine - Fires every 50uS #ifdef ESP32 + // ESP32 has a proper API to setup timers, no weird chip macros needed + // simply call the readable API versions :) // 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up timer = timerBegin(1, 80, 1); timerAttachInterrupt(timer, &IRTimer, 1); diff --git a/irSend.cpp b/irSend.cpp index 6191aa6ad..c3ef3ffac 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -54,7 +54,7 @@ void IRsend::space (unsigned int time) // void IRsend::enableIROut (int khz) { -// FIXME: implement ESP32 support +// FIXME: implement ESP32 support, see IR_TIMER_USE_ESP32 in boarddefs.h #ifndef ESP32 // Disable the Timer2 Interrupt (which is used for receiving IR) TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt From 6b8f2bdbfcca1c8b9db38418312d7a621e6f606b Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Fri, 31 Mar 2017 22:01:31 -0700 Subject: [PATCH 014/584] move comment about 'or else' chips that use TIMER2. --- boarddefs.h | 4 ++-- examples/IRrecvDump/IRrecvDump.ino | 2 +- irRecv.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/boarddefs.h b/boarddefs.h index c126b546b..925c92a98 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -136,11 +136,11 @@ #elif defined(__AVR_ATtiny85__) #define IR_USE_TIMER_TINY0 // tx = pin 1 -// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc -// ATmega48, ATmega88, ATmega168, ATmega328 #elif defined(ESP32) #define IR_TIMER_USE_ESP32 #else +// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc +// ATmega48, ATmega88, ATmega168, ATmega328 //#define IR_USE_TIMER1 // tx = pin 9 #define IR_USE_TIMER2 // tx = pin 3 diff --git a/examples/IRrecvDump/IRrecvDump.ino b/examples/IRrecvDump/IRrecvDump.ino index 990c3f60c..fa25cd8ea 100644 --- a/examples/IRrecvDump/IRrecvDump.ino +++ b/examples/IRrecvDump/IRrecvDump.ino @@ -23,7 +23,7 @@ decode_results results; void setup() { - Serial.begin(115200); + Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver } diff --git a/irRecv.cpp b/irRecv.cpp index 6631fb7ef..12b0806b1 100644 --- a/irRecv.cpp +++ b/irRecv.cpp @@ -1,7 +1,7 @@ #include "IRremote.h" #include "IRremoteInt.h" -#ifdef ESP32 +#ifdef IR_TIMER_USE_ESP32 hw_timer_t *timer; void IRTimer(); // defined in IRremote.cpp #endif From 88b294a0cd898c20ab7026f55f612eab718370c1 Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Fri, 31 Mar 2017 22:32:48 -0700 Subject: [PATCH 015/584] change no-op defines from '1' to ''. --- boarddefs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/boarddefs.h b/boarddefs.h index 925c92a98..17e25513e 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -560,12 +560,12 @@ // way to do this on ESP32 is using the RMT built in driver like in this incomplete library below // https://github.com/ExploreEmbedded/ESP32_RMT #elif defined(IR_TIMER_USE_ESP32) -#define TIMER_RESET 1 -#define TIMER_ENABLE_PWM 1 +#define TIMER_RESET +#define TIMER_ENABLE_PWM #define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet"); -#define TIMER_ENABLE_INTR 1 -#define TIMER_DISABLE_INTR 1 -#define TIMER_INTR_NAME 1 +#define TIMER_ENABLE_INTR +#define TIMER_DISABLE_INTR +#define TIMER_INTR_NAME //--------------------------------------------------------- // Unknown Timer From 9133814e60e905f2495e850a96c3fe768238d5aa Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Fri, 31 Mar 2017 23:10:07 -0700 Subject: [PATCH 016/584] Rev'ed to 2.2.4. --- Contributors.md | 1 + README.md | 1 + changelog.md | 3 +++ library.json | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Contributors.md b/Contributors.md index ae2489008..bf1e64dbd 100644 --- a/Contributors.md +++ b/Contributors.md @@ -18,5 +18,6 @@ These are the active contributors of this project that you may contact if there - [ElectricRCAircraftGuy](https://github.com/electricrcaircraftguy): Active Contributor - [philipphenkel](https://github.com/philipphenkel): Active Contributor - [MCUdude](https://github.com/MCUdude): Contributor +- [marcmerlin](https://github.com/marcmerlin): Contributor (ESP32 port) Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. diff --git a/README.md b/README.md index 2ec302c58..8ecf11288 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Tutorials and more information will be made available on [the official homepage] - ATmega8535, 16, 32, 164, 324, 644, 1284, - ATmega64, 128 - ATtiny 84 / 85 +- ESP32 (receive only) We are open to suggestions for adding support to new boards, however we highly recommend you contact your supplier first and ask them to provide support from their side. diff --git a/changelog.md b/changelog.md index 0702ddcf9..dc01c9857 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## 2.2.4 - 2017/03/31 +- Added ESP32 IR receive support [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/425) + ## 2.2.3 - 2017/03/27 - Fix calculation of pause length in LEGO PF protocol [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/427) diff --git a/library.json b/library.json index de93d16e5..4f29e7b53 100644 --- a/library.json +++ b/library.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/z3t0/Arduino-IRremote.git" }, - "version": "2.2.3", + "version": "2.2.4", "frameworks": "arduino", "platforms": "atmelavr", "authors" : From 419c948c29ae8f6813071459b4940a20b747e8a0 Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Sat, 1 Apr 2017 08:32:37 -0700 Subject: [PATCH 017/584] Fixed rev to 2.3.3 and added info on timer used. --- README.md | 1 + changelog.md | 2 +- library.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8ecf11288..305c7bd9c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ We are open to suggestions for adding support to new boards, however we highly r | [ATmega8535 ATmega16, ATmega32](https://github.com/MCUdude/MightyCore) | **13** | **1** | | [ATmega64, ATmega128](https://github.com/MCUdude/MegaCore) | **13** | **1** | | ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 | +| [ESP32](http://esp32.net/) | N/A (not supported) | **1** | | [Teensy 1.0](https://www.pjrc.com/teensy/) | **17** | **1** | | [Teensy 2.0](https://www.pjrc.com/teensy/) | 9, **10**, 14 | 1, 3, **4_HS** | | [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 | diff --git a/changelog.md b/changelog.md index dc01c9857..81339f2e6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## 2.2.4 - 2017/03/31 +## 2.3.3 - 2017/03/31 - Added ESP32 IR receive support [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/425) ## 2.2.3 - 2017/03/27 diff --git a/library.json b/library.json index 4f29e7b53..d8cd523a7 100644 --- a/library.json +++ b/library.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/z3t0/Arduino-IRremote.git" }, - "version": "2.2.4", + "version": "2.3.3", "frameworks": "arduino", "platforms": "atmelavr", "authors" : From 691ea5bc536e91bbb9926234bc907ca4c38b3250 Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Sun, 9 Apr 2017 19:55:49 -0700 Subject: [PATCH 018/584] Added pointer for ESP8266 fork As requested in https://github.com/z3t0/Arduino-IRremote/issues/400 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 305c7bd9c..f2c7b92c9 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Tutorials and more information will be made available on [the official homepage] - ATmega64, 128 - ATtiny 84 / 85 - ESP32 (receive only) +- ESP8266 is supported in a fork based on an old codebase that isn't as recent, but it works reasonably well given that perfectly timed sub millisecond interrupts are different on that chip. See https://github.com/markszabo/IRremoteESP8266 We are open to suggestions for adding support to new boards, however we highly recommend you contact your supplier first and ask them to provide support from their side. From 18f12d3affb3491abbfe708d4859df12a6f84d5f Mon Sep 17 00:00:00 2001 From: Marc MERLIN Date: Sat, 22 Apr 2017 19:44:19 -0700 Subject: [PATCH 019/584] Add FAQ on mixing IR and neopixels (#451) * Add FAQ on mixing IR and neopixels As requested in https://github.com/z3t0/Arduino-IRremote/issues/435 * Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index f2c7b92c9..c14b11bc4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ Tutorials and more information will be made available on [the official homepage] 4. Move the "IRremote" folder that has been extracted to your libraries directory. 5. Make sure to delete Arduino_Root/libraries/RobotIRremote. Where Arduino_Root refers to the install directory of Arduino. The library RobotIRremote has similar definitions to IRremote and causes errors. + +## FAQ +- IR does not work right when I use Neopixels (aka WS2811/WS2812/WS2812B) +Whether you use the Adafruit Neopixel lib, or FastLED, interrupts get disabled on many lower end CPUs like the basic arduinos. In turn, this stops the IR interrupt handler from running when it needs to. There are some solutions to this on some processors, [see this page from Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html) + + ## Supported Boards - Arduino Uno / Mega / Leonardo / Duemilanove / Diecimila / LilyPad / Mini / Fio / Nano etc. - Teensy 1.0 / 1.0++ / 2.0 / 2++ / 3.0 / 3.1 / Teensy-LC; Credits: @PaulStoffregen (Teensy Team) From 0913c94bdf75983b2a2e0ef1a711e1d56f5a41ae Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Sun, 23 Apr 2017 13:12:34 +0200 Subject: [PATCH 020/584] New file MicroGirs.ino. --- examples/MicroGirs/MicroGirs.ino | 312 +++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 examples/MicroGirs/MicroGirs.ino diff --git a/examples/MicroGirs/MicroGirs.ino b/examples/MicroGirs/MicroGirs.ino new file mode 100644 index 000000000..c816bcab6 --- /dev/null +++ b/examples/MicroGirs/MicroGirs.ino @@ -0,0 +1,312 @@ +/* +This is a minimalistic Girs server (http://harctoolbox.org/Girs.html). +It only depends on (a subset of) IRremote +(https://github.com/z3t0/Arduino-IRremote), It can be used with +IrScrutinizer (Sending/Capturing hw = Girs Client) and Lirc 0.9.4 and +later (driver girs http://lirc.org/html/girs.html). (Authors of +similar software are encourage to implement support.) + +It consists of an interacive IR server, taking one-line commands from +the "user" (which is typically not a person but another program), and +responds with a one-line response. In the language of the Girs +specifications, the modules "base", receive, and transmit are +implemented. (The two latter can be disabled by not defining two +corresponding CPP symbols.) + +It understands the following commands: + +* The "version" command returns the program name and version, +* The "modules" command returns the modules implemented, normally base, receive and transmit. +* The "receve" command reads an IR signal using the deployed sensor. +* The "send" commands transmits a supplied raw signal the requested number of times. + +Only the first character of the command is evaluated in this implementation. + +The "receive" command returns the received IR sequence as a sequence +of durations, including a (dummy) trailing silence. On-periods +("marks", "flashes") are prefixed by "+", while off-periods ("spaces", +"gaps") are prefixed by "-". The present version never times out. + +The "send" command takes the following parameters: + + send noSends frequencyHz introLength repeatLength endingLength durations... + + where + +* frequencyHz denotes the modulation frequency in Hz + (NOT khz, as is commonly used in IRremote) +* introLength denotes the length of the intro sequence, must be even, +* repeatLength denotes the length of the repeat sequence, must be even, +* endingLength denotes the length of the ending sequence (normally 0), must be even. +* duration... denotes the microsecond durations to send, + starting with the first on-period, ending with a (possibly dummy) trailing silence + +Semantics: first the intro sequence will be sent once (i.e., the first +repeatLength durations) (if non-empty). Then the repeat sequence will +be sent (noSends-1) times, unless the intro sequence was empty, in +which case it will be send noSends times. Finally, the ending +sequence will be send once (if non-empty). + +Weaknesses of the IRremote implementation: +* Reception never times out. +* The IRrecv class does its own decoding which is irrelevant for us. It cannot be disabled. +* The timeout at the end on a signal reception is not configurable. + For example, a NEC1 type signal will cut after the intro sequence, + and the repeats will be considered independent signals. +* IR reception cannot be turned of. +* The size of the data is platform dependent (unsigned int). +*/ + +#include +#include + +// Define the ones that should be enabled +#define RECEIVE +#define TRANSMIT + +// Change the following if desired + +// Pin used by the receiver +#define INPUTPIN 11 + +// (The sending pin is in general not configurable, see the documentation of IRremote.) + +// Character that ends the command lines. Do not change unless you known what +// you are doing. IrScrutinizer and Lirc expects \r. +#define EOLCHAR '\r' + +// Baud rate for the serial/USB connection. +// 115200 is the default for IrScrutinizer and Lirc. +#define BAUDRATE 115200 + +////// End of user configurable variables //////////////////// + +#define modulesSupported "base transmit receive" +#ifndef PROGNAME +#define PROGNAME "MicroGirs" +#endif +#ifndef VERSION +#define VERSION "2017-04-23" +#endif +#define okString "OK" +#define errorString "ERROR" +#define timeoutString "." + +// For compatibility with IRremote, we deliberately use +// the platform dependent types. +typedef unsigned frequency_t; +typedef unsigned microseconds_t; + +static const microseconds_t DUMMYENDING = 40000U; +static const frequency_t FREQUENCY_T_MAX = UINT16_MAX; +static const frequency_t MICROSECONDS_T_MAX = UINT16_MAX; + +#ifdef RECEIVE +IRrecv irRecv(INPUTPIN); +#endif +#ifdef TRANSMIT +IRsend irSend; +#endif + +///////// Tokenizer class. Breaks the command line into tokens. ////// +class Tokenizer { +private: + static const int invalidIndex = -1; + + int index; // signed since invalidIndex is possible + const String& payload; + void trim(); + +public: + Tokenizer(const String &str); + virtual ~Tokenizer(); + + String getToken(); + String getRest(); + String getLine(); + long getInt(); + microseconds_t getMicroseconds(); + frequency_t getFrequency(); + + static const int invalid = INT_MAX; +}; + +Tokenizer::Tokenizer(const String& str) : index(0), payload(str) { +} + +Tokenizer::~Tokenizer() { +} + +String Tokenizer::getRest() { + String result = index == invalidIndex ? String("") : payload.substring(index); + index = invalidIndex; + return result; +} + +String Tokenizer::getLine() { + if (index == invalidIndex) + return String(""); + + int i = payload.indexOf('\n', index); + String s = (i > 0) ? payload.substring(index, i) : payload.substring(index); + index = (i > 0) ? i+1 : invalidIndex; + return s; +} + +String Tokenizer::getToken() { + if (index < 0) + return String(""); + + int i = payload.indexOf(' ', index); + String s = (i > 0) ? payload.substring(index, i) : payload.substring(index); + index = (i > 0) ? i : invalidIndex; + if (index != invalidIndex) + if (index != invalidIndex) + while (payload.charAt(index) == ' ') + index++; + return s; +} + +long Tokenizer::getInt() { + String token = getToken(); + return token == "" ? (long) invalid : token.toInt(); +} + +microseconds_t Tokenizer::getMicroseconds() { + long t = getToken().toInt(); + return (microseconds_t) ((t < MICROSECONDS_T_MAX) ? t : MICROSECONDS_T_MAX); +} + +frequency_t Tokenizer::getFrequency() { + long t = getToken().toInt(); + return (frequency_t) ((t < FREQUENCY_T_MAX) ? t : FREQUENCY_T_MAX); +} +///////////////// end Tokenizer ///////////////////////////////// + +#ifdef TRANSMIT +static inline unsigned hz2khz(frequency_t hz) { + return (hz + 500)/1000; +} + +static void sendRaw(const microseconds_t intro[], unsigned lengthIntro, + const microseconds_t repeat[], unsigned lengthRepeat, + const microseconds_t ending[], unsigned lengthEnding, + frequency_t frequency, unsigned times) { + if (lengthIntro > 0U) + irSend.sendRaw(intro, lengthIntro, hz2khz(frequency)); + if (lengthRepeat > 0U) + for (unsigned i = 0U; i < times - (lengthIntro > 0U); i++) + irSend.sendRaw(repeat, lengthRepeat, hz2khz(frequency)); + if (lengthEnding > 0U) + irSend.sendRaw(ending, lengthEnding, hz2khz(frequency)); +} +#endif // TRANSMIT + +#ifdef RECEIVE +static void receive(Stream& stream) { + irRecv.resume(); // Receive the next value + + decode_results results; + while (!irRecv.decode(&results)) { + } + + dump(stream, &results); +} + +static void dump(Stream& stream, decode_results* results) { + unsigned int count = results->rawlen; + for (unsigned int i = 1; i < count; i++) { + stream.write(i & 1 ? '+' : '-'); + stream.print(results->rawbuf[i] * USECPERTICK, DEC); + stream.print(" "); + } + stream.print('-'); + stream.println(DUMMYENDING); +} +#endif // RECEIVE + +void setup() { + Serial.begin(BAUDRATE); + while (!Serial) + ; // wait for serial port to connect. "Needed for Leonardo only" + + Serial.println(F(PROGNAME " " VERSION)); + //Serial.setTimeout(SERIALTIMEOUT); +#ifdef RECEIVE + // There is unfortunately no disableIRIn in IRremote. + // Therefore, turn it on, and leave it on. + // We _hope_ that it will not interfere with sending. + irRecv.enableIRIn(); +#endif +} + + +static String readCommand(Stream& stream) { + while (stream.available() == 0) { + } + + String line = stream.readStringUntil(EOLCHAR); + line.trim(); + return line; +} + +static void processCommand(const String& line, Stream& stream) { + Tokenizer tokenizer(line); + String cmd = tokenizer.getToken(); + + // Decode the command in cmd + if (cmd.length() == 0) { + // empty command, do nothing + stream.println(F(okString)); + return; + } + + switch (cmd[0]) { + case 'm': + stream.println(F(modulesSupported)); + break; + +#ifdef RECEIVE + case 'r': // receive + case 'a': + case 'c': + receive(stream); + break; +#endif // RECEIVE + +#ifdef TRANSMIT + case 's': // send + { + // TODO: handle unparsable data gracefully + unsigned noSends = (unsigned) tokenizer.getInt(); + frequency_t frequency = tokenizer.getFrequency(); + unsigned introLength = (unsigned) tokenizer.getInt(); + unsigned repeatLength = (unsigned) tokenizer.getInt(); + unsigned endingLength = (unsigned) tokenizer.getInt(); + microseconds_t intro[introLength]; + microseconds_t repeat[repeatLength]; + microseconds_t ending[endingLength]; + for (unsigned i = 0; i < introLength; i++) + intro[i] = tokenizer.getMicroseconds(); + for (unsigned i = 0; i < repeatLength; i++) + repeat[i] = tokenizer.getMicroseconds(); + for (unsigned i = 0; i < endingLength; i++) + ending[i] = tokenizer.getMicroseconds(); + sendRaw(intro, introLength, repeat, repeatLength, ending, endingLength, frequency, noSends); + stream.println(F(okString)); + } + break; +#endif // TRANSMIT + + case 'v': // version + stream.println(F(PROGNAME " " VERSION)); + break; + default: + stream.println(F(errorString)); + } +} + +void loop() { + String line = readCommand(Serial); + processCommand(line, Serial); +} From eb7a0bee7d3e3b5d8927dfc47138bb85bf486eb1 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sat, 1 Jul 2017 21:53:37 -0700 Subject: [PATCH 021/584] #481 note (#484) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c14b11bc4..00a4b03be 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,12 @@ We are open to suggestions for adding support to new boards, however we highly r | [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/) | **5** | **CMT** | | [Teensy-LC](https://www.pjrc.com/teensy/) | **16** | **TPM1** | + +### Experimental patches +The following are strictly community supported patches that have yet to make it into mainstream. If you have issues feel free to ask here. If it works well then let us know! + +[Arduino 101](https://github.com/z3t0/Arduino-IRremote/pull/481#issuecomment-311243146) + The table above lists the currently supported timers and corresponding send pins, many of these can have additional pins opened up and we are open to requests if a need arises for other pins. ## Usage From 47aadf559d359d7e270eb4b5451ee68cd6d1d464 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Mon, 24 Jul 2017 14:51:03 -0600 Subject: [PATCH 022/584] Update Contributors.md (#488) --- Contributors.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Contributors.md b/Contributors.md index bf1e64dbd..1bed7b6d4 100644 --- a/Contributors.md +++ b/Contributors.md @@ -3,7 +3,6 @@ These are the active contributors of this project that you may contact if there - [z3t0](https://github.com/z3t0) : Active Contributor and currently also the main contributor. * Email: zetoslab@gmail.com - * Skype: polarised16 - [shirriff](https://github.com/shirriff) : An amazing person who worked to create this awesome library and provide unending support - [AnalysIR](https:/github.com/AnalysIR): Active contributor and is amazing with providing support! - [Informatic](https://github.com/Informatic) : Active contributor From 679348568da2b886e7ae50e8bfeed4a2b9c93056 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Thu, 10 Aug 2017 16:57:54 -0600 Subject: [PATCH 023/584] merge #437 --- Contributors.md | 2 + IRremote.cpp | 8 +- IRremote.h | 27 ++++- boarddefs.h | 140 +++++++++++++++++++------ esp32.cpp | 39 +++++++ examples/IRremoteInfo/IRremoteInfo.ino | 2 +- irRecv.cpp | 22 +--- irSend.cpp | 61 +++++++++-- sam.cpp | 102 ++++++++++++++++++ 9 files changed, 341 insertions(+), 62 deletions(-) create mode 100644 esp32.cpp create mode 100644 sam.cpp diff --git a/Contributors.md b/Contributors.md index 1bed7b6d4..821c8da45 100644 --- a/Contributors.md +++ b/Contributors.md @@ -18,5 +18,7 @@ These are the active contributors of this project that you may contact if there - [philipphenkel](https://github.com/philipphenkel): Active Contributor - [MCUdude](https://github.com/MCUdude): Contributor - [marcmerlin](https://github.com/marcmerlin): Contributor (ESP32 port) +- [bengtmartensson](https://github.com/bengtmartensson): Active Contributor +- [MrBryonMiller](https://github.com/MrBryonMiller): Contributor Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. diff --git a/IRremote.cpp b/IRremote.cpp index e811cfc7b..f41f81878 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -24,7 +24,7 @@ # include "IRremoteInt.h" #undef IR_GLOBAL -#ifndef IR_TIMER_USE_ESP32 +#ifdef HAS_AVR_INTERRUPT_H #include #endif @@ -123,11 +123,7 @@ int MATCH_SPACE (int measured_ticks, int desired_us) // As soon as first MARK arrives: // Gap width is recorded; Ready is cleared; New logging starts // -#ifdef IR_TIMER_USE_ESP32 -void IRTimer() -#else ISR (TIMER_INTR_NAME) -#endif { TIMER_RESET; @@ -189,6 +185,7 @@ ISR (TIMER_INTR_NAME) break; } +#ifdef BLINKLED // If requested, flash LED while receiving IR data if (irparams.blinkflag) { if (irdata == MARK) @@ -197,4 +194,5 @@ ISR (TIMER_INTR_NAME) else if (irparams.blinkpin) digitalWrite(irparams.blinkpin, LOW); // Turn user defined pin LED on else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on } +#endif // BLINKLED } diff --git a/IRremote.h b/IRremote.h index fe1a87029..928284361 100644 --- a/IRremote.h +++ b/IRremote.h @@ -259,7 +259,18 @@ class IRrecv class IRsend { public: - IRsend () { } +#ifdef USE_SOFT_CARRIER + + IRsend(int pin = SEND_PIN) + { + sendPin = pin; + } +#else + + IRsend() + { + } +#endif void custom_delay_usec (unsigned long uSecs); void enableIROut (int khz) ; @@ -339,6 +350,20 @@ class IRsend # if SEND_LEGO_PF void sendLegoPowerFunctions (uint16_t data, bool repeat = true) ; # endif + +#ifdef USE_SOFT_CARRIER + private: + int sendPin; + + unsigned int periodTime; + unsigned int periodOnTime; + + void sleepMicros(unsigned long us); + void sleepUntilMicros(unsigned long targetTime); + +#else + const int sendPin = SEND_PIN; +#endif } ; #endif diff --git a/boarddefs.h b/boarddefs.h index 17e25513e..5c49465ef 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -20,6 +20,32 @@ #ifndef boarddefs_h #define boarddefs_h +// Define some defaults, that some boards may like to override +// (This is to avoid negative logic, ! DONT_... is just awkward.) + +// This board has/needs the avr/interrupt.h +#define HAS_AVR_INTERRUPT_H + +// Define if sending is supported +#define SENDING_SUPPORTED + +// If defined, a standard enableIRIn function will be define. +// Undefine for boards supplying their own. +#define USE_DEFAULT_ENABLE_IR_IN + +// Duty cycle in percent for sent signals. Presently takes effect only with USE_SOFT_CARRIER +#define DUTY_CYCLE 50 + +// If USE_SOFT_CARRIER, this amount (in micro seconds) is subtracted from the +// on-time of the pulses. +#define PULSE_CORRECTION 3 + +// digitalWrite is supposed to be slow. If this is an issue, define faster, +// board-dependent versions of these macros SENDPIN_ON(pin) and SENDPIN_OFF(pin). +// Portable, possibly slow, default definitions are given at the end of this file. +// If defining new versions, feel free to ignore the pin argument if it +// is not configurable on the current board. + //------------------------------------------------------------------------------ // Defines for blinking the LED // @@ -39,11 +65,31 @@ # define BLINKLED_ON() (PORTD |= B00000001) # define BLINKLED_OFF() (PORTD &= B11111110) -// No system LED on ESP32, disable blinking +#elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) +# define BLINKLED LED_BUILTIN +# define BLINKLED_ON() (digitalWrite(LED_BUILTIN, HIGH)) +# define BLINKLED_OFF() (digitalWrite(LED_BUILTIN, LOW)) + +# define USE_SOFT_CARRIER + // Define to use spin wait instead of delayMicros() +//# define USE_SPIN_WAIT +# undef USE_DEFAULT_ENABLE_IR_IN + + // The default pin used used for sending. +# define SEND_PIN 9 + #elif defined(ESP32) -# define BLINKLED 255 -# define BLINKLED_ON() 1 -# define BLINKLED_OFF() 1 + // No system LED on ESP32, disable blinking by NOT defining BLINKLED + + // avr/interrupt.h is not present +# undef HAS_AVR_INTERRUPT_H + + // Sending not implemented +# undef SENDING_SUPPORTED# + + // Supply own enbleIRIn +# undef USE_DEFAULT_ENABLE_IR_IN + #else # define BLINKLED 13 # define BLINKLED_ON() (PORTB |= B00100000) @@ -138,6 +184,10 @@ #elif defined(ESP32) #define IR_TIMER_USE_ESP32 + +#elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) + #define TIMER_PRESCALER_DIV 64 + #else // Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc // ATmega48, ATmega88, ATmega168, ATmega328 @@ -190,17 +240,17 @@ //----------------- #if defined(CORE_OC2B_PIN) -# define TIMER_PWM_PIN CORE_OC2B_PIN // Teensy +# define SEND_PIN CORE_OC2B_PIN // Teensy #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 9 // Arduino Mega +# define SEND_PIN 9 // Arduino Mega #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ || defined(__AVR_ATmega164P__) -# define TIMER_PWM_PIN 14 // MightyCore +# define SEND_PIN 14 // MightyCore #else -# define TIMER_PWM_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc +# define SEND_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc #endif // ATmega48, ATmega88, ATmega168, ATmega328 //--------------------------------------------------------- @@ -243,22 +293,22 @@ //----------------- #if defined(CORE_OC1A_PIN) -# define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy +# define SEND_PIN CORE_OC1A_PIN // Teensy #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 11 // Arduino Mega +# define SEND_PIN 11 // Arduino Mega #elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) -# define TIMER_PWM_PIN 13 // MegaCore +# define SEND_PIN 13 // MegaCore #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ || defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ || defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) -# define TIMER_PWM_PIN 13 // MightyCore +# define SEND_PIN 13 // MightyCore #elif defined(__AVR_ATtiny84__) -# define TIMER_PWM_PIN 6 +# define SEND_PIN 6 #else -# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc +# define SEND_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc #endif // ATmega48, ATmega88, ATmega168, ATmega328 //--------------------------------------------------------- @@ -290,11 +340,11 @@ //----------------- #if defined(CORE_OC3A_PIN) -# define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy +# define SEND_PIN CORE_OC3A_PIN // Teensy #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 5 // Arduino Mega +# define SEND_PIN 5 // Arduino Mega #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) -# define TIMER_PWM_PIN 6 // MightyCore +# define SEND_PIN 6 // MightyCore #else # error "Please add OC3A pin number here\n" #endif @@ -338,9 +388,9 @@ //----------------- #if defined(CORE_OC4A_PIN) -# define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy +# define SEND_PIN CORE_OC4A_PIN // Teensy #elif defined(__AVR_ATmega32U4__) -# define TIMER_PWM_PIN 13 // Leonardo +# define SEND_PIN 13 // Leonardo #else # error "Please add OC4A pin number here\n" #endif @@ -374,9 +424,9 @@ //----------------- #if defined(CORE_OC4A_PIN) -# define TIMER_PWM_PIN CORE_OC4A_PIN +# define SEND_PIN CORE_OC4A_PIN #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 6 // Arduino Mega +# define SEND_PIN 6 // Arduino Mega #else # error "Please add OC4A pin number here\n" #endif @@ -410,9 +460,9 @@ //----------------- #if defined(CORE_OC5A_PIN) -# define TIMER_PWM_PIN CORE_OC5A_PIN +# define SEND_PIN CORE_OC5A_PIN #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define TIMER_PWM_PIN 46 // Arduino Mega +# define SEND_PIN 46 // Arduino Mega #else # error "Please add OC5A pin number here\n" #endif @@ -479,7 +529,7 @@ CMT_MSC = 0x03; \ }) -#define TIMER_PWM_PIN 5 +#define SEND_PIN 5 // defines for TPM1 timer on Teensy-LC #elif defined(IR_USE_TIMER_TPM1) @@ -509,7 +559,7 @@ FTM1_C0V = 0; \ FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \ }) -#define TIMER_PWM_PIN 16 +#define SEND_PIN 16 // defines for timer_tiny0 (8 bits) #elif defined(IR_USE_TIMER_TINY0) @@ -543,7 +593,7 @@ }) #endif -#define TIMER_PWM_PIN 1 /* ATtiny85 */ +#define SEND_PIN 1 /* ATtiny85 */ //--------------------------------------------------------- // ESP32 (ESP8266 should likely be added here too) @@ -560,12 +610,29 @@ // way to do this on ESP32 is using the RMT built in driver like in this incomplete library below // https://github.com/ExploreEmbedded/ESP32_RMT #elif defined(IR_TIMER_USE_ESP32) -#define TIMER_RESET -#define TIMER_ENABLE_PWM -#define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet"); -#define TIMER_ENABLE_INTR -#define TIMER_DISABLE_INTR -#define TIMER_INTR_NAME + +#define TIMER_RESET + +#ifdef ISR +# undef ISR +#endif +#define ISR(f) void IRTimer() + +#elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) +// use timer 3 hardcoded at this time + +#define TIMER_RESET +#define TIMER_ENABLE_PWM // Not presently used +#define TIMER_DISABLE_PWM +#define TIMER_ENABLE_INTR NVIC_EnableIRQ(TC3_IRQn) // Not presently used +#define TIMER_DISABLE_INTR NVIC_DisableIRQ(TC3_IRQn) +#define TIMER_INTR_NAME TC3_Handler // Not presently used +#define TIMER_CONFIG_KHZ(f) + +#ifdef ISR +# undef ISR +#endif +#define ISR(f) void irs() //--------------------------------------------------------- // Unknown Timer @@ -574,4 +641,13 @@ # error "Internal code configuration error, no known IR_USE_TIMER# defined\n" #endif +// Provide default definitions, portable but possibly slower than necessary. +#ifndef SENDPIN_ON +#define SENDPIN_ON(pin) digitalWrite(pin, HIGH) +#endif + +#ifndef SENDPIN_OFF +#define SENDPIN_OFF(pin) digitalWrite(pin, LOW) +#endif + #endif // ! boarddefs_h diff --git a/esp32.cpp b/esp32.cpp new file mode 100644 index 000000000..ef4d79476 --- /dev/null +++ b/esp32.cpp @@ -0,0 +1,39 @@ +#ifdef ESP32 + +// This file contains functions specific to the ESP32. + +#include "IRremote.h" +#include "IRremoteInt.h" + +// "Idiot check" +#ifdef USE_DEFAULT_ENABLE_IR_IN +#error Must undef USE_DEFAULT_ENABLE_IR_IN +#endif + +hw_timer_t *timer; +void IRTimer(); // defined in IRremote.cpp, masqueraded as ISR(TIMER_INTR_NAME) + +//+============================================================================= +// initialization +// +void IRrecv::enableIRIn ( ) +{ +// Interrupt Service Routine - Fires every 50uS + // ESP32 has a proper API to setup timers, no weird chip macros needed + // simply call the readable API versions :) + // 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up + timer = timerBegin(1, 80, 1); + timerAttachInterrupt(timer, &IRTimer, 1); + // every 50ns, autoreload = true + timerAlarmWrite(timer, 50, true); + timerAlarmEnable(timer); + + // Initialize state machine variables + irparams.rcvstate = STATE_IDLE; + irparams.rawlen = 0; + + // Set pin modes + pinMode(irparams.recvpin, INPUT); +} + +#endif // ESP32 diff --git a/examples/IRremoteInfo/IRremoteInfo.ino b/examples/IRremoteInfo/IRremoteInfo.ino index 2a269d948..c3f329754 100644 --- a/examples/IRremoteInfo/IRremoteInfo.ino +++ b/examples/IRremoteInfo/IRremoteInfo.ino @@ -79,7 +79,7 @@ void dumpTIMER() { void dumpTimerPin() { Serial.print(F("IR Tx Pin: ")); - Serial.println(TIMER_PWM_PIN); + Serial.println(SEND_PIN); } void dumpClock() { diff --git a/irRecv.cpp b/irRecv.cpp index 12b0806b1..b549dac1c 100644 --- a/irRecv.cpp +++ b/irRecv.cpp @@ -1,10 +1,5 @@ #include "IRremote.h" #include "IRremoteInt.h" - -#ifdef IR_TIMER_USE_ESP32 -hw_timer_t *timer; -void IRTimer(); // defined in IRremote.cpp -#endif //+============================================================================= // Decodes the received IR message @@ -120,19 +115,10 @@ IRrecv::IRrecv (int recvpin, int blinkpin) //+============================================================================= // initialization // +#ifdef USE_DEFAULT_ENABLE_IR_IN void IRrecv::enableIRIn ( ) { -// Interrupt Service Routine - Fires every 50uS -#ifdef ESP32 - // ESP32 has a proper API to setup timers, no weird chip macros needed - // simply call the readable API versions :) - // 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up - timer = timerBegin(1, 80, 1); - timerAttachInterrupt(timer, &IRTimer, 1); - // every 50ns, autoreload = true - timerAlarmWrite(timer, 50, true); - timerAlarmEnable(timer); -#else +// Interrupt Service Routine - Fires every 50uS cli(); // Setup pulse clock timer interrupt // Prescale /8 (16M/8 = 0.5 microseconds per tick) @@ -146,7 +132,6 @@ void IRrecv::enableIRIn ( ) TIMER_RESET; sei(); // enable interrupts -#endif // Initialize state machine variables irparams.rcvstate = STATE_IDLE; @@ -155,14 +140,17 @@ void IRrecv::enableIRIn ( ) // Set pin modes pinMode(irparams.recvpin, INPUT); } +#endif // USE_DEFAULT_ENABLE_IR_IN //+============================================================================= // Enable/disable blinking of pin 13 on IR processing // void IRrecv::blink13 (int blinkflag) { +#ifdef BLINKLED irparams.blinkflag = blinkflag; if (blinkflag) pinMode(BLINKLED, OUTPUT) ; +#endif } //+============================================================================= diff --git a/irSend.cpp b/irSend.cpp index c3ef3ffac..a01b5a012 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -1,6 +1,7 @@ #include "IRremote.h" #include "IRremoteInt.h" +#ifdef SENDING_SUPPORTED //+============================================================================= void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz) { @@ -15,14 +16,59 @@ void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned in space(0); // Always end with the LED off } +#ifdef USE_SOFT_CARRIER +void inline IRsend::sleepMicros(unsigned long us) +{ +#ifdef USE_SPIN_WAIT + sleepUntilMicros(micros() + us); +#else + if (us > 0U) // Is this necessary? (Official docu https://www.arduino.cc/en/Reference/DelayMicroseconds does not tell.) + delayMicroseconds((unsigned int) us); +#endif +} + +void inline IRsend::sleepUntilMicros(unsigned long targetTime) +{ +#ifdef USE_SPIN_WAIT + while (micros() < targetTime) + ; +#else + unsigned long now = micros(); + if (now < targetTime) + sleepMicros(targetTime - now); +#endif +} +#endif // USE_SOFT_CARRIER + //+============================================================================= // Sends an IR mark for the specified number of microseconds. // The mark output is modulated at the PWM frequency. // -void IRsend::mark (unsigned int time) + +void IRsend::mark(unsigned int time) { +#ifdef USE_SOFT_CARRIER + unsigned long start = micros(); + unsigned long stop = start + time; + if (stop + periodTime < start) + // Counter wrap-around, happens very seldomly, but CAN happen. + // Just give up instead of possibly damaging the hardware. + return; + + unsigned long nextPeriodEnding = start; + unsigned long now = micros(); + while (now < stop) { + SENDPIN_ON(sendPin); + sleepMicros(periodOnTime); + SENDPIN_OFF(sendPin); + nextPeriodEnding += periodTime; + sleepUntilMicros(nextPeriodEnding); + now = micros(); + } +#else TIMER_ENABLE_PWM; // Enable pin 3 PWM output if (time > 0) custom_delay_usec(time); +#endif } //+============================================================================= @@ -54,13 +100,16 @@ void IRsend::space (unsigned int time) // void IRsend::enableIROut (int khz) { -// FIXME: implement ESP32 support, see IR_TIMER_USE_ESP32 in boarddefs.h -#ifndef ESP32 +#ifdef USE_SOFT_CARRIER + periodTime = (1000U + khz/2) / khz; // = 1000/khz + 1/2 = round(1000.0/khz) + periodOnTime = periodTime * DUTY_CYCLE / 100U - PULSE_CORRECTION; +#endif + // Disable the Timer2 Interrupt (which is used for receiving IR) TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt - pinMode(TIMER_PWM_PIN, OUTPUT); - digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low + pinMode(sendPin, OUTPUT); + SENDPIN_OFF(sendPin); // When not sending, we want it low // COM2A = 00: disconnect OC2A // COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted @@ -68,7 +117,6 @@ void IRsend::enableIROut (int khz) // CS2 = 000: no prescaling // The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A. TIMER_CONFIG_KHZ(khz); -#endif } //+============================================================================= @@ -88,3 +136,4 @@ void IRsend::custom_delay_usec(unsigned long uSecs) { //} } +#endif // SENDING_SUPPORTED \ No newline at end of file diff --git a/sam.cpp b/sam.cpp new file mode 100644 index 000000000..06575891c --- /dev/null +++ b/sam.cpp @@ -0,0 +1,102 @@ +// Support routines for SAM processor boards + +#include "IRremote.h" +#include "IRremoteInt.h" + +#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) + +// "Idiot check" +#ifdef USE_DEFAULT_ENABLE_IR_IN +#error Must undef USE_DEFAULT_ENABLE_IR_IN +#endif + +//+============================================================================= +// ATSAMD Timer setup & IRQ functions +// + +// following based on setup from GitHub jdneo/timerInterrupt.ino + +static void setTimerFrequency(int frequencyHz) +{ + int compareValue = (SYSCLOCK / (TIMER_PRESCALER_DIV * frequencyHz)) - 1; + //Serial.println(compareValue); + TcCount16* TC = (TcCount16*) TC3; + // Make sure the count is in a proportional position to where it was + // to prevent any jitter or disconnect when changing the compare value. + TC->COUNT.reg = map(TC->COUNT.reg, 0, TC->CC[0].reg, 0, compareValue); + TC->CC[0].reg = compareValue; + //Serial.print("COUNT.reg "); + //Serial.println(TC->COUNT.reg); + //Serial.print("CC[0].reg "); + //Serial.println(TC->CC[0].reg); + while (TC->STATUS.bit.SYNCBUSY == 1); +} + +static void startTimer() +{ + REG_GCLK_CLKCTRL = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID_TCC2_TC3); + while (GCLK->STATUS.bit.SYNCBUSY == 1); // wait for sync + + TcCount16* TC = (TcCount16*) TC3; + + TC->CTRLA.reg &= ~TC_CTRLA_ENABLE; + while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync + + // Use the 16-bit timer + TC->CTRLA.reg |= TC_CTRLA_MODE_COUNT16; + while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync + + // Use match mode so that the timer counter resets when the count matches the compare register + TC->CTRLA.reg |= TC_CTRLA_WAVEGEN_MFRQ; + while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync + + // Set prescaler to 1024 + //TC->CTRLA.reg |= TC_CTRLA_PRESCALER_DIV1024; + TC->CTRLA.reg |= TC_CTRLA_PRESCALER_DIV64; + while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync + + setTimerFrequency(1000000 / USECPERTICK); + + // Enable the compare interrupt + TC->INTENSET.reg = 0; + TC->INTENSET.bit.MC0 = 1; + + NVIC_EnableIRQ(TC3_IRQn); + + TC->CTRLA.reg |= TC_CTRLA_ENABLE; + while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync +} + +//+============================================================================= +// initialization +// + +void IRrecv::enableIRIn() +{ + // Interrupt Service Routine - Fires every 50uS + //Serial.println("Starting timer"); + startTimer(); + //Serial.println("Started timer"); + + // Initialize state machine variables + irparams.rcvstate = STATE_IDLE; + irparams.rawlen = 0; + + // Set pin modes + pinMode(irparams.recvpin, INPUT); +} + +void irs(); // Defined in IRRemote as ISR(TIMER_INTR_NAME) + +void TC3_Handler(void) +{ + TcCount16* TC = (TcCount16*) TC3; + // If this interrupt is due to the compare register matching the timer count + // we toggle the LED. + if (TC->INTFLAG.bit.MC0 == 1) { + TC->INTFLAG.bit.MC0 = 1; + irs(); + } +} + +#endif // defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) \ No newline at end of file From e1768b4debb03441e93a1f2d5f135111e98fdd97 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Thu, 10 Aug 2017 17:01:44 -0600 Subject: [PATCH 024/584] Added changelog info --- README.md | 2 +- changelog.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00a4b03be..915b12867 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This library enables you to send and receive using infra-red signals on an Ardui Tutorials and more information will be made available on [the official homepage](http://z3t0.github.io/Arduino-IRremote/). -## Version - 2.2.3 +## Version - 2.4.0b ## Installation 1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page. diff --git a/changelog.md b/changelog.md index 81339f2e6..92d647188 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## 2.4.0 - 2017/08/10 + - Cleanup of hardware dependencies. Merge in SAM support [PR #437](https://github.com/z3t0/Arduino-IRremote/pull/437) + ## 2.3.3 - 2017/03/31 - Added ESP32 IR receive support [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/425) From 622e28bf692a7a49d68f5f63d2185c2bcd20c918 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:05:12 -0600 Subject: [PATCH 025/584] Update library.properties --- library.properties | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library.properties b/library.properties index 39fd814eb..0e23d4cf2 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,8 @@ name=IRremote -version=2.2.3 -author=shirriff -maintainer=shirriff +version=2.4.0 +author=shirriff, z3t0 +maintainer=z3t0 sentence=Send and receive infrared signals with multiple protocols -paragraph=Send and receive infrared signals with multiple protocols -category=Signal Input/Output -url=https://github.com/shirriff/Arduino-IRremote.git +category=Communication +url=https://github.com/z3t0/Arduino-IRremote architectures=* From b0d15b6020c5321a1fcb534789b998e6974b7643 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:05:50 -0600 Subject: [PATCH 026/584] Modified library.json --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index d8cd523a7..95407e506 100644 --- a/library.json +++ b/library.json @@ -7,7 +7,7 @@ "type": "git", "url": "https://github.com/z3t0/Arduino-IRremote.git" }, - "version": "2.3.3", + "version": "2.4.0", "frameworks": "arduino", "platforms": "atmelavr", "authors" : From 635e8a923d6367d55cce000cb38f3d6934dc417c Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:19:20 -0600 Subject: [PATCH 027/584] Restructuring directory as per #464 --- arduino-irremote.sublime-workspace | 240 ------------------ IRremote.cpp => src/IRremote.cpp | 0 IRremote.h => src/IRremote.h | 0 IRremoteInt.h => src/IRremoteInt.h | 0 boarddefs.h => src/boarddefs.h | 0 esp32.cpp => src/esp32.cpp | 0 irPronto.cpp => src/irPronto.cpp | 0 irRecv.cpp => src/irRecv.cpp | 0 irSend.cpp => src/irSend.cpp | 0 ir_Aiwa.cpp => src/ir_Aiwa.cpp | 0 ir_Denon.cpp => src/ir_Denon.cpp | 0 ir_Dish.cpp => src/ir_Dish.cpp | 0 ir_JVC.cpp => src/ir_JVC.cpp | 0 ir_LG.cpp => src/ir_LG.cpp | 0 ir_Lego_PF.cpp => src/ir_Lego_PF.cpp | 0 .../ir_Lego_PF_BitStreamEncoder.h | 0 ir_Mitsubishi.cpp => src/ir_Mitsubishi.cpp | 0 ir_NEC.cpp => src/ir_NEC.cpp | 0 ir_Panasonic.cpp => src/ir_Panasonic.cpp | 0 ir_RC5_RC6.cpp => src/ir_RC5_RC6.cpp | 0 ir_Samsung.cpp => src/ir_Samsung.cpp | 0 ir_Sanyo.cpp => src/ir_Sanyo.cpp | 0 ir_Sharp.cpp => src/ir_Sharp.cpp | 0 ir_Sony.cpp => src/ir_Sony.cpp | 0 ir_Template.cpp => src/ir_Template.cpp | 0 ir_Whynter.cpp => src/ir_Whynter.cpp | 0 sam.cpp => src/sam.cpp | 0 27 files changed, 240 deletions(-) delete mode 100644 arduino-irremote.sublime-workspace rename IRremote.cpp => src/IRremote.cpp (100%) rename IRremote.h => src/IRremote.h (100%) rename IRremoteInt.h => src/IRremoteInt.h (100%) rename boarddefs.h => src/boarddefs.h (100%) rename esp32.cpp => src/esp32.cpp (100%) rename irPronto.cpp => src/irPronto.cpp (100%) rename irRecv.cpp => src/irRecv.cpp (100%) rename irSend.cpp => src/irSend.cpp (100%) rename ir_Aiwa.cpp => src/ir_Aiwa.cpp (100%) rename ir_Denon.cpp => src/ir_Denon.cpp (100%) rename ir_Dish.cpp => src/ir_Dish.cpp (100%) rename ir_JVC.cpp => src/ir_JVC.cpp (100%) rename ir_LG.cpp => src/ir_LG.cpp (100%) rename ir_Lego_PF.cpp => src/ir_Lego_PF.cpp (100%) rename ir_Lego_PF_BitStreamEncoder.h => src/ir_Lego_PF_BitStreamEncoder.h (100%) rename ir_Mitsubishi.cpp => src/ir_Mitsubishi.cpp (100%) rename ir_NEC.cpp => src/ir_NEC.cpp (100%) rename ir_Panasonic.cpp => src/ir_Panasonic.cpp (100%) rename ir_RC5_RC6.cpp => src/ir_RC5_RC6.cpp (100%) rename ir_Samsung.cpp => src/ir_Samsung.cpp (100%) rename ir_Sanyo.cpp => src/ir_Sanyo.cpp (100%) rename ir_Sharp.cpp => src/ir_Sharp.cpp (100%) rename ir_Sony.cpp => src/ir_Sony.cpp (100%) rename ir_Template.cpp => src/ir_Template.cpp (100%) rename ir_Whynter.cpp => src/ir_Whynter.cpp (100%) rename sam.cpp => src/sam.cpp (100%) diff --git a/arduino-irremote.sublime-workspace b/arduino-irremote.sublime-workspace deleted file mode 100644 index f536803d0..000000000 --- a/arduino-irremote.sublime-workspace +++ /dev/null @@ -1,240 +0,0 @@ -{ - "auto_complete": - { - "selected_items": - [ - [ - "vb", - "vboMatrix" - ] - ] - }, - "buffers": - [ - ], - "build_system": "", - "build_system_choices": - [ - ], - "build_varint": "", - "command_palette": - { - "height": 275.0, - "last_filter": "blame", - "selected_items": - [ - [ - "blame", - "Git: Blame" - ], - [ - "install", - "Package Control: Install Package" - ], - [ - "diff", - "Git: Diff Current File" - ], - [ - "js", - "Set Syntax: JavaScript" - ], - [ - "i", - "Package Control: Install Package" - ], - [ - "instal", - "Package Control: Install Package" - ] - ], - "width": 510.0 - }, - "console": - { - "height": 126.0, - "history": - [ - "import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)" - ] - }, - "distraction_free": - { - "menu_visible": true, - "show_minimap": false, - "show_open_files": false, - "show_tabs": false, - "side_bar_visible": false, - "status_bar_visible": false - }, - "expanded_folders": - [ - "/C/Users/Rafi Khan/Documents/Arduino/libraries/Arduino-IRremote" - ], - "file_history": - [ - "/C/Users/Rafi Khan/Documents/Arduino/libraries/Arduino-IRremote/changelog.md", - "/C/Users/Rafi Khan/Documents/Development/Arduino-IRremote/arduino-irremote.sublime-project", - "/C/Users/Rafi Khan/Documents/Development/Arduino-IRremote/.gitignore", - "/C/Users/Rafi Khan/Documents/Development/magic/README.md", - "/C/Users/Rafi Khan/Documents/Development/magic/shader.frag", - "/C/Users/Rafi Khan/Documents/Development/magic/package.json", - "/C/Users/Rafi Khan/Documents/Development/magic/block.js", - "/C/Users/Rafi Khan/Documents/Development/magic/chunker.js", - "/C/Users/Rafi Khan/Documents/Development/magic/index.js", - "/C/Users/Rafi Khan/Documents/Development/magic/blocks", - "/C/Users/Rafi Khan/AppData/Roaming/Sublime Text 3/Packages/User/Preferences.sublime-settings", - "/C/Users/Rafi Khan/Documents/Development/magic/shader.vert", - "/C/Users/Rafi Khan/Documents/Development/magic/magic.sublime-project", - "/C/Users/Rafi Khan/Documents/Development/magic/node_modules/browserify/node_modules/syntax-error/node_modules/acorn/.tern-project", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/supermarket.py", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/takingavacation.py", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/TipCalculator.py", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/battleship.py", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/exam.py", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/pyglatin.py", - "/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/student.py" - ], - "find": - { - "height": 28.0 - }, - "find_in_files": - { - "height": 0.0, - "where_history": - [ - ] - }, - "find_state": - { - "case_sensitive": false, - "find_history": - [ - "i", - "Direction", - ";", - ";\n", - "north", - "cubeMatrix", - ")\n", - "vec3.set", - "f", - ";", - "();\n", - "render", - "this", - "y" - ], - "highlight": true, - "in_selection": false, - "preserve_case": false, - "regex": false, - "replace_history": - [ - ], - "reverse": false, - "show_context": true, - "use_buffer2": true, - "whole_word": false, - "wrap": true - }, - "groups": - [ - { - "sheets": - [ - ] - } - ], - "incremental_find": - { - "height": 28.0 - }, - "input": - { - "height": 66.0 - }, - "layout": - { - "cells": - [ - [ - 0, - 0, - 1, - 1 - ] - ], - "cols": - [ - 0.0, - 1.0 - ], - "rows": - [ - 0.0, - 1.0 - ] - }, - "menu_visible": true, - "output.find_results": - { - "height": 0.0 - }, - "pinned_build_system": "", - "project": "arduino-irremote.sublime-project", - "replace": - { - "height": 52.0 - }, - "save_all_on_build": true, - "select_file": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - [ - "json", - "package.json" - ], - [ - "inde", - "index.js" - ] - ], - "width": 0.0 - }, - "select_project": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "select_symbol": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "selected_group": 0, - "settings": - { - }, - "show_minimap": true, - "show_open_files": false, - "show_tabs": true, - "side_bar_visible": true, - "side_bar_width": 150.0, - "status_bar_visible": true, - "template_settings": - { - } -} diff --git a/IRremote.cpp b/src/IRremote.cpp similarity index 100% rename from IRremote.cpp rename to src/IRremote.cpp diff --git a/IRremote.h b/src/IRremote.h similarity index 100% rename from IRremote.h rename to src/IRremote.h diff --git a/IRremoteInt.h b/src/IRremoteInt.h similarity index 100% rename from IRremoteInt.h rename to src/IRremoteInt.h diff --git a/boarddefs.h b/src/boarddefs.h similarity index 100% rename from boarddefs.h rename to src/boarddefs.h diff --git a/esp32.cpp b/src/esp32.cpp similarity index 100% rename from esp32.cpp rename to src/esp32.cpp diff --git a/irPronto.cpp b/src/irPronto.cpp similarity index 100% rename from irPronto.cpp rename to src/irPronto.cpp diff --git a/irRecv.cpp b/src/irRecv.cpp similarity index 100% rename from irRecv.cpp rename to src/irRecv.cpp diff --git a/irSend.cpp b/src/irSend.cpp similarity index 100% rename from irSend.cpp rename to src/irSend.cpp diff --git a/ir_Aiwa.cpp b/src/ir_Aiwa.cpp similarity index 100% rename from ir_Aiwa.cpp rename to src/ir_Aiwa.cpp diff --git a/ir_Denon.cpp b/src/ir_Denon.cpp similarity index 100% rename from ir_Denon.cpp rename to src/ir_Denon.cpp diff --git a/ir_Dish.cpp b/src/ir_Dish.cpp similarity index 100% rename from ir_Dish.cpp rename to src/ir_Dish.cpp diff --git a/ir_JVC.cpp b/src/ir_JVC.cpp similarity index 100% rename from ir_JVC.cpp rename to src/ir_JVC.cpp diff --git a/ir_LG.cpp b/src/ir_LG.cpp similarity index 100% rename from ir_LG.cpp rename to src/ir_LG.cpp diff --git a/ir_Lego_PF.cpp b/src/ir_Lego_PF.cpp similarity index 100% rename from ir_Lego_PF.cpp rename to src/ir_Lego_PF.cpp diff --git a/ir_Lego_PF_BitStreamEncoder.h b/src/ir_Lego_PF_BitStreamEncoder.h similarity index 100% rename from ir_Lego_PF_BitStreamEncoder.h rename to src/ir_Lego_PF_BitStreamEncoder.h diff --git a/ir_Mitsubishi.cpp b/src/ir_Mitsubishi.cpp similarity index 100% rename from ir_Mitsubishi.cpp rename to src/ir_Mitsubishi.cpp diff --git a/ir_NEC.cpp b/src/ir_NEC.cpp similarity index 100% rename from ir_NEC.cpp rename to src/ir_NEC.cpp diff --git a/ir_Panasonic.cpp b/src/ir_Panasonic.cpp similarity index 100% rename from ir_Panasonic.cpp rename to src/ir_Panasonic.cpp diff --git a/ir_RC5_RC6.cpp b/src/ir_RC5_RC6.cpp similarity index 100% rename from ir_RC5_RC6.cpp rename to src/ir_RC5_RC6.cpp diff --git a/ir_Samsung.cpp b/src/ir_Samsung.cpp similarity index 100% rename from ir_Samsung.cpp rename to src/ir_Samsung.cpp diff --git a/ir_Sanyo.cpp b/src/ir_Sanyo.cpp similarity index 100% rename from ir_Sanyo.cpp rename to src/ir_Sanyo.cpp diff --git a/ir_Sharp.cpp b/src/ir_Sharp.cpp similarity index 100% rename from ir_Sharp.cpp rename to src/ir_Sharp.cpp diff --git a/ir_Sony.cpp b/src/ir_Sony.cpp similarity index 100% rename from ir_Sony.cpp rename to src/ir_Sony.cpp diff --git a/ir_Template.cpp b/src/ir_Template.cpp similarity index 100% rename from ir_Template.cpp rename to src/ir_Template.cpp diff --git a/ir_Whynter.cpp b/src/ir_Whynter.cpp similarity index 100% rename from ir_Whynter.cpp rename to src/ir_Whynter.cpp diff --git a/sam.cpp b/src/sam.cpp similarity index 100% rename from sam.cpp rename to src/sam.cpp From 31968a4875af21736dda61b4c3c734ebfa6c13f4 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:29:12 -0600 Subject: [PATCH 028/584] Removed redundant preprocessor directives In the newer versions of the IDE it is sufficient to simply include the Arduino.h header file. Fixes #463 --- src/IRremoteInt.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/IRremoteInt.h b/src/IRremoteInt.h index 1c319acbf..1baa05d6d 100644 --- a/src/IRremoteInt.h +++ b/src/IRremoteInt.h @@ -18,15 +18,9 @@ #define IRremoteint_h //------------------------------------------------------------------------------ -// Include the right Arduino header +// Include the Arduino header // -#if defined(ARDUINO) && (ARDUINO >= 100) -# include -#else -# if !defined(IRPRONTO) -# include -# endif -#endif +#include //------------------------------------------------------------------------------ // This handles definition and access to global variables From a406f3b9f97864c23cc7fb76f5deb04f5e09c9f8 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:42:39 -0600 Subject: [PATCH 029/584] Removed blinking led It is difficult to maintain this over different architectures and also not entirely that useful. Fixes #462 --- keywords.txt | 1 - src/IRremote.cpp | 11 ----------- src/IRremote.h | 3 +-- src/IRremoteInt.h | 2 -- src/boarddefs.h | 27 +-------------------------- src/irRecv.cpp | 17 +---------------- 6 files changed, 3 insertions(+), 58 deletions(-) diff --git a/keywords.txt b/keywords.txt index f2b9a4957..ea6e0192c 100644 --- a/keywords.txt +++ b/keywords.txt @@ -14,7 +14,6 @@ IRsend KEYWORD1 # Methods and Functions (KEYWORD2) ####################################### -blink13 KEYWORD2 decode KEYWORD2 enableIRIn KEYWORD2 resume KEYWORD2 diff --git a/src/IRremote.cpp b/src/IRremote.cpp index f41f81878..c8730d7b3 100644 --- a/src/IRremote.cpp +++ b/src/IRremote.cpp @@ -127,7 +127,6 @@ ISR (TIMER_INTR_NAME) { TIMER_RESET; - // Read if IR Receiver -> SPACE [xmt LED off] or a MARK [xmt LED on] // digitalRead() is very slow. Optimisation is possible, but makes the code unportable uint8_t irdata = (uint8_t)digitalRead(irparams.recvpin); @@ -185,14 +184,4 @@ ISR (TIMER_INTR_NAME) break; } -#ifdef BLINKLED - // If requested, flash LED while receiving IR data - if (irparams.blinkflag) { - if (irdata == MARK) - if (irparams.blinkpin) digitalWrite(irparams.blinkpin, HIGH); // Turn user defined pin LED on - else BLINKLED_ON() ; // if no user defined LED pin, turn default LED pin for the hardware on - else if (irparams.blinkpin) digitalWrite(irparams.blinkpin, LOW); // Turn user defined pin LED on - else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on - } -#endif // BLINKLED } diff --git a/src/IRremote.h b/src/IRremote.h index 928284361..40f28dc2f 100644 --- a/src/IRremote.h +++ b/src/IRremote.h @@ -172,9 +172,8 @@ class IRrecv { public: IRrecv (int recvpin) ; - IRrecv (int recvpin, int blinkpin); + IRrecv (int recvpin); - void blink13 (int blinkflag) ; int decode (decode_results *results) ; void enableIRIn ( ) ; bool isIdle ( ) ; diff --git a/src/IRremoteInt.h b/src/IRremoteInt.h index 1baa05d6d..08f162e51 100644 --- a/src/IRremoteInt.h +++ b/src/IRremoteInt.h @@ -41,8 +41,6 @@ typedef // The fields are ordered to reduce memory over caused by struct-padding uint8_t rcvstate; // State Machine state uint8_t recvpin; // Pin connected to IR data from detector - uint8_t blinkpin; - uint8_t blinkflag; // true -> enable blinking of pin on IR processing uint8_t rawlen; // counter of entries in rawbuf unsigned int timer; // State timer, counts 50uS ticks. unsigned int rawbuf[RAWBUF]; // raw data diff --git a/src/boarddefs.h b/src/boarddefs.h index 5c49465ef..5751ba700 100644 --- a/src/boarddefs.h +++ b/src/boarddefs.h @@ -47,29 +47,10 @@ // is not configurable on the current board. //------------------------------------------------------------------------------ -// Defines for blinking the LED +// Soft Carrier fallback for SAM and SAMD architectures // -#if defined(CORE_LED0_PIN) -# define BLINKLED CORE_LED0_PIN -# define BLINKLED_ON() (digitalWrite(CORE_LED0_PIN, HIGH)) -# define BLINKLED_OFF() (digitalWrite(CORE_LED0_PIN, LOW)) - -#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -# define BLINKLED 13 -# define BLINKLED_ON() (PORTB |= B10000000) -# define BLINKLED_OFF() (PORTB &= B01111111) - -#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) -# define BLINKLED 0 -# define BLINKLED_ON() (PORTD |= B00000001) -# define BLINKLED_OFF() (PORTD &= B11111110) - #elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) -# define BLINKLED LED_BUILTIN -# define BLINKLED_ON() (digitalWrite(LED_BUILTIN, HIGH)) -# define BLINKLED_OFF() (digitalWrite(LED_BUILTIN, LOW)) - # define USE_SOFT_CARRIER // Define to use spin wait instead of delayMicros() //# define USE_SPIN_WAIT @@ -79,8 +60,6 @@ # define SEND_PIN 9 #elif defined(ESP32) - // No system LED on ESP32, disable blinking by NOT defining BLINKLED - // avr/interrupt.h is not present # undef HAS_AVR_INTERRUPT_H @@ -90,10 +69,6 @@ // Supply own enbleIRIn # undef USE_DEFAULT_ENABLE_IR_IN -#else -# define BLINKLED 13 -# define BLINKLED_ON() (PORTB |= B00100000) -# define BLINKLED_OFF() (PORTB &= B11011111) #endif //------------------------------------------------------------------------------ diff --git a/src/irRecv.cpp b/src/irRecv.cpp index b549dac1c..8498e16a4 100644 --- a/src/irRecv.cpp +++ b/src/irRecv.cpp @@ -99,15 +99,11 @@ int IRrecv::decode (decode_results *results) IRrecv::IRrecv (int recvpin) { irparams.recvpin = recvpin; - irparams.blinkflag = 0; } -IRrecv::IRrecv (int recvpin, int blinkpin) +IRrecv::IRrecv (int recvpin) { irparams.recvpin = recvpin; - irparams.blinkpin = blinkpin; - pinMode(blinkpin, OUTPUT); - irparams.blinkflag = 0; } @@ -142,17 +138,6 @@ void IRrecv::enableIRIn ( ) } #endif // USE_DEFAULT_ENABLE_IR_IN -//+============================================================================= -// Enable/disable blinking of pin 13 on IR processing -// -void IRrecv::blink13 (int blinkflag) -{ -#ifdef BLINKLED - irparams.blinkflag = blinkflag; - if (blinkflag) pinMode(BLINKLED, OUTPUT) ; -#endif -} - //+============================================================================= // Return if receiving new IR signals // From 563c82c6c4fbce090590fd0c30f7c8301a4b2652 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:46:58 -0600 Subject: [PATCH 030/584] Removed pronto "protocol" Fixes #466 --- examples/IRremoteInfo/IRremoteInfo.ino | 1 - src/IRremote.h | 23 -- src/irPronto.cpp | 513 ------------------------- 3 files changed, 537 deletions(-) delete mode 100644 src/irPronto.cpp diff --git a/examples/IRremoteInfo/IRremoteInfo.ino b/examples/IRremoteInfo/IRremoteInfo.ino index c3f329754..45cf7236e 100644 --- a/examples/IRremoteInfo/IRremoteInfo.ino +++ b/examples/IRremoteInfo/IRremoteInfo.ino @@ -188,7 +188,6 @@ void dumpProtocols() { Serial.print(F("DISH: ")); printSendEnabled(SEND_DISH); printDecodeEnabled(DECODE_DISH); Serial.print(F("SHARP: ")); printSendEnabled(SEND_SHARP); printDecodeEnabled(DECODE_SHARP); Serial.print(F("DENON: ")); printSendEnabled(SEND_DENON); printDecodeEnabled(DECODE_DENON); - Serial.print(F("PRONTO: ")); printSendEnabled(SEND_PRONTO); Serial.println(F("(Not Applicable)")); } void printSendEnabled(int flag) { diff --git a/src/IRremote.h b/src/IRremote.h index 40f28dc2f..6038a92ed 100644 --- a/src/IRremote.h +++ b/src/IRremote.h @@ -73,27 +73,9 @@ #define DECODE_DENON 1 #define SEND_DENON 1 -#define DECODE_PRONTO 0 // This function doe not logically make sense -#define SEND_PRONTO 1 - #define DECODE_LEGO_PF 0 // NOT WRITTEN #define SEND_LEGO_PF 1 -//------------------------------------------------------------------------------ -// When sending a Pronto code we request to send either the "once" code -// or the "repeat" code -// If the code requested does not exist we can request to fallback on the -// other code (the one we did not explicitly request) -// -// I would suggest that "fallback" will be the standard calling method -// The last paragraph on this page discusses the rationale of this idea: -// http://www.remotecentral.com/features/irdisp2.htm -// -#define PRONTO_ONCE false -#define PRONTO_REPEAT true -#define PRONTO_FALLBACK true -#define PRONTO_NOFALLBACK false - //------------------------------------------------------------------------------ // An enumerated list of all supported formats // You do NOT need to remove entries from this list when disabling protocols! @@ -117,7 +99,6 @@ typedef DISH, SHARP, DENON, - PRONTO, LEGO_PF, } decode_type_t; @@ -340,10 +321,6 @@ class IRsend //...................................................................... # if SEND_DENON void sendDenon (unsigned long data, int nbits) ; -# endif - //...................................................................... -# if SEND_PRONTO - void sendPronto (char* code, bool repeat, bool fallback) ; # endif //...................................................................... # if SEND_LEGO_PF diff --git a/src/irPronto.cpp b/src/irPronto.cpp deleted file mode 100644 index 0f530a900..000000000 --- a/src/irPronto.cpp +++ /dev/null @@ -1,513 +0,0 @@ -#define TEST 0 - -#if TEST -# define SEND_PRONTO 1 -# define PRONTO_ONCE false -# define PRONTO_REPEAT true -# define PRONTO_FALLBACK true -# define PRONTO_NOFALLBACK false -#endif - -#if SEND_PRONTO - -//****************************************************************************** -#if TEST -# include - void enableIROut (int freq) { printf("\nFreq = %d KHz\n", freq); } - void mark (int t) { printf("+%d," , t); } - void space (int t) { printf("-%d, ", t); } -#else -# include "IRremote.h" -#endif // TEST - -//+============================================================================= -// Check for a valid hex digit -// -bool ishex (char ch) -{ - return ( ((ch >= '0') && (ch <= '9')) || - ((ch >= 'A') && (ch <= 'F')) || - ((ch >= 'a') && (ch <= 'f')) ) ? true : false ; -} - -//+============================================================================= -// Check for a valid "blank" ... '\0' is a valid "blank" -// -bool isblank (char ch) -{ - return ((ch == ' ') || (ch == '\t') || (ch == '\0')) ? true : false ; -} - -//+============================================================================= -// Bypass spaces -// -bool byp (char** pcp) -{ - while (isblank(**pcp)) (*pcp)++ ; -} - -//+============================================================================= -// Hex-to-Byte : Decode a hex digit -// We assume the character has already been validated -// -uint8_t htob (char ch) -{ - if ((ch >= '0') && (ch <= '9')) return ch - '0' ; - if ((ch >= 'A') && (ch <= 'F')) return ch - 'A' + 10 ; - if ((ch >= 'a') && (ch <= 'f')) return ch - 'a' + 10 ; -} - -//+============================================================================= -// Hex-to-Word : Decode a block of 4 hex digits -// We assume the string has already been validated -// and the pointer being passed points at the start of a block of 4 hex digits -// -uint16_t htow (char* cp) -{ - return ( (htob(cp[0]) << 12) | (htob(cp[1]) << 8) | - (htob(cp[2]) << 4) | (htob(cp[3]) ) ) ; -} - -//+============================================================================= -// -bool sendPronto (char* s, bool repeat, bool fallback) -{ - int i; - int len; - int skip; - char* cp; - uint16_t freq; // Frequency in KHz - uint8_t usec; // pronto uSec/tick - uint8_t once; - uint8_t rpt; - - // Validate the string - for (cp = s; *cp; cp += 4) { - byp(&cp); - if ( !ishex(cp[0]) || !ishex(cp[1]) || - !ishex(cp[2]) || !ishex(cp[3]) || !isblank(cp[4]) ) return false ; - } - - // We will use cp to traverse the string - cp = s; - - // Check mode = Oscillated/Learned - byp(&cp); - if (htow(cp) != 0000) return false; - cp += 4; - - // Extract & set frequency - byp(&cp); - freq = (int)(1000000 / (htow(cp) * 0.241246)); // Rounding errors will occur, tolerance is +/- 10% - usec = (int)(((1.0 / freq) * 1000000) + 0.5); // Another rounding error, thank Cod for analogue electronics - freq /= 1000; // This will introduce a(nother) rounding error which we do not want in the usec calcualtion - cp += 4; - - // Get length of "once" code - byp(&cp); - once = htow(cp); - cp += 4; - - // Get length of "repeat" code - byp(&cp); - rpt = htow(cp); - cp += 4; - - // Which code are we sending? - if (fallback) { // fallback on the "other" code if "this" code is not present - if (!repeat) { // requested 'once' - if (once) len = once * 2, skip = 0 ; // if once exists send it - else len = rpt * 2, skip = 0 ; // else send repeat code - } else { // requested 'repeat' - if (rpt) len = rpt * 2, skip = 0 ; // if rpt exists send it - else len = once * 2, skip = 0 ; // else send once code - } - } else { // Send what we asked for, do not fallback if the code is empty! - if (!repeat) len = once * 2, skip = 0 ; // 'once' starts at 0 - else len = rpt * 2, skip = once ; // 'repeat' starts where 'once' ends - } - - // Skip to start of code - for (i = 0; i < skip; i++, cp += 4) byp(&cp) ; - - // Send code - enableIROut(freq); - for (i = 0; i < len; i++) { - byp(&cp); - if (i & 1) space(htow(cp) * usec); - else mark (htow(cp) * usec); - cp += 4; - } -} - -//+============================================================================= -#if TEST - -int main ( ) -{ - char prontoTest[] = - "0000 0070 0000 0032 0080 0040 0010 0010 0010 0030 " // 10 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 20 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 30 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 40 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 50 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 60 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 70 - "0010 0010 0010 0030 0010 0010 0010 0030 0010 0010 " // 80 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 90 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 100 - "0010 0030 0010 0aa6"; // 104 - - sendPronto(prontoTest, PRONTO_ONCE, PRONTO_FALLBACK); // once code - sendPronto(prontoTest, PRONTO_REPEAT, PRONTO_FALLBACK); // repeat code - sendPronto(prontoTest, PRONTO_ONCE, PRONTO_NOFALLBACK); // once code - sendPronto(prontoTest, PRONTO_REPEAT, PRONTO_NOFALLBACK); // repeat code - - return 0; -} - -#endif // TEST - -#endif // SEND_PRONTO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#if 0 -//****************************************************************************** -// Sources: -// http://www.remotecentral.com/features/irdisp2.htm -// http://www.hifi-remote.com/wiki/index.php?title=Working_With_Pronto_Hex -//****************************************************************************** - -#include -#include - -#define IRPRONTO -#include "IRremoteInt.h" // The Arduino IRremote library defines USECPERTICK - -//------------------------------------------------------------------------------ -// Source: https://www.google.co.uk/search?q=DENON+MASTER+IR+Hex+Command+Sheet -// -> http://assets.denon.com/documentmaster/us/denon%20master%20ir%20hex.xls -// -char prontoTest[] = - "0000 0070 0000 0032 0080 0040 0010 0010 0010 0030 " // 10 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 20 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 30 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 40 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 50 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 60 - "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 70 - "0010 0010 0010 0030 0010 0010 0010 0030 0010 0010 " // 80 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 90 - "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 100 - "0010 0030 0010 0aa6"; // 104 - -//------------------------------------------------------------------------------ -// This is the longest code we can support -#define CODEMAX 200 - -//------------------------------------------------------------------------------ -// This is the data we pull out of the pronto code -typedef - struct { - int freq; // Carrier frequency (in Hz) - int usec; // uSec per tick (based on freq) - - int codeLen; // Length of code - uint16_t code[CODEMAX]; // Code in hex - - int onceLen; // Length of "once" transmit - uint16_t* once; // Pointer to start within 'code' - - int rptLen; // Length of "repeat" transmit - uint16_t* rpt; // Pointer to start within 'code' - } -pronto_t; - -//------------------------------------------------------------------------------ -// From what I have seen, the only time we go over 8-bits is the 'space' -// on the end which creates the lead-out/inter-code gap. Assuming I'm right, -// we can code this up as a special case and otherwise halve the size of our -// data! -// Ignoring the first four values (the config data) and the last value -// (the lead-out), if you find a protocol that uses values greater than 00fe -// we are going to have to revisit this code! -// -// -// So, the 0th byte will be the carrier frequency in Khz (NOT Hz) -// " 1st " " " " length of the "once" code -// " 2nd " " " " length of the "repeat" code -// -// Thereafter, odd bytes will be Mark lengths as a multiple of USECPERTICK uS -// even " " " Space " " " " " " " -// -// Any occurence of "FF" in either a Mark or a Space will indicate -// "Use the 16-bit FF value" which will also be a multiple of USECPERTICK uS -// -// -// As a point of comparison, the test code (prontoTest[]) is 520 bytes -// (yes, more than 0.5KB of our Arduino's precious 32KB) ... after conversion -// to pronto hex that goes down to ((520/5)*2) = 208 bytes ... once converted to -// our format we are down to ((208/2) -1 -1 +2) = 104 bytes -// -// In fariness this is still very memory-hungry -// ...As a rough guide: -// 10 codes cost 1K of memory (this will vary depending on the protocol). -// -// So if you're building a complex remote control, you will probably need to -// keep the codes on an external memory device (not in the Arduino sketch) and -// load them as you need them. Hmmm. -// -// This dictates that "Oscillated Pronto Codes" are probably NOT the way forward -// -// For example, prontoTest[] happens to be: A 48-bit IR code in Denon format -// So we know it starts with 80/40 (Denon header) -// and ends with 10/aa6 (Denon leadout) -// and all (48) bits in between are either 10/10 (Denon 0) -// or 10/30 (Denon 1) -// So we could easily store this data in 1-byte ("Denon") -// + 1-byte (Length=48) -// + 6-bytes (IR code) -// At 8-bytes per code, we can store 128 codes in 1KB or memory - that's a lot -// better than the 2 (two) we started off with! -// -// And serendipitously, by reducing the amount of data, our program will run -// a LOT faster! -// -// Again, I repeat, even after you have spent time converting the "Oscillated -// Pronto Codes" in to IRremote format, it will be a LOT more memory-hungry -// than using sendDenon() (or whichever) ...BUT these codes are easily -// available on the internet, so we'll support them! -// -typedef - struct { - uint16_t FF; - uint8_t code[CODEMAX]; - } -irCode_t; - -//------------------------------------------------------------------------------ -#define DEBUGF(...) printf(__VA_ARGS__) - -//+============================================================================= -// String must be block of 4 hex digits separated with blanks -// -bool validate (char* cp, int* len) -{ - for (*len = 0; *cp; (*len)++, cp += 4) { - byp(&cp); - if ( !ishex(cp[0]) || !ishex(cp[1]) || - !ishex(cp[2]) || !ishex(cp[3]) || !isblank(cp[4]) ) return false ; - } - - return true; -} - -//+============================================================================= -// Hex-to-Byte : Decode a hex digit -// We assume the character has already been validated -// -uint8_t htob (char ch) -{ - if ((ch >= '0') && (ch <= '9')) return ch - '0' ; - if ((ch >= 'A') && (ch <= 'F')) return ch - 'A' + 10 ; - if ((ch >= 'a') && (ch <= 'f')) return ch - 'a' + 10 ; -} - -//+============================================================================= -// Hex-to-Word : Decode a block of 4 hex digits -// We assume the string has already been validated -// and the pointer being passed points at the start of a block of 4 hex digits -// -uint16_t htow (char* cp) -{ - return ( (htob(cp[0]) << 12) | (htob(cp[1]) << 8) | - (htob(cp[2]) << 4) | (htob(cp[3]) ) ) ; -} - -//+============================================================================= -// Convert the pronto string in to data -// -bool decode (char* s, pronto_t* p, irCode_t* ir) -{ - int i, len; - char* cp; - - // Validate the Pronto string - if (!validate(s, &p->codeLen)) { - DEBUGF("Invalid pronto string\n"); - return false ; - } - DEBUGF("Found %d hex codes\n", p->codeLen); - - // Allocate memory to store the decoded string - //if (!(p->code = malloc(p->len))) { - // DEBUGF("Memory allocation failed\n"); - // return false ; - //} - - // Check in case our code is too long - if (p->codeLen > CODEMAX) { - DEBUGF("Code too long, edit CODEMAX and recompile\n"); - return false ; - } - - // Decode the string - cp = s; - for (i = 0; i < p->codeLen; i++, cp += 4) { - byp(&cp); - p->code[i] = htow(cp); - } - - // Announce our findings - DEBUGF("Input: |%s|\n", s); - DEBUGF("Found: |"); - for (i = 0; i < p->codeLen; i++) DEBUGF("%04x ", p->code[i]) ; - DEBUGF("|\n"); - - DEBUGF("Form [%04X] : ", p->code[0]); - if (p->code[0] == 0x0000) DEBUGF("Oscillated (Learned)\n"); - else if (p->code[0] == 0x0100) DEBUGF("Unmodulated\n"); - else DEBUGF("Unknown\n"); - if (p->code[0] != 0x0000) return false ; // Can only handle Oscillated - - // Calculate the carrier frequency (+/- 10%) & uSecs per pulse - // Pronto uses a crystal which generates a timeabse of 0.241246 - p->freq = (int)(1000000 / (p->code[1] * 0.241246)); - p->usec = (int)(((1.0 / p->freq) * 1000000) + 0.5); - ir->code[0] = p->freq / 1000; - DEBUGF("Freq [%04X] : %d Hz (%d uS/pluse) -> %d KHz\n", - p->code[1], p->freq, p->usec, ir->code[0]); - - // Set the length & start pointer for the "once" code - p->onceLen = p->code[2]; - p->once = &p->code[4]; - ir->code[1] = p->onceLen; - DEBUGF("Once [%04X] : %d\n", p->code[2], p->onceLen); - - // Set the length & start pointer for the "repeat" code - p->rptLen = p->code[3]; - p->rpt = &p->code[4 + p->onceLen]; - ir->code[2] = p->rptLen; - DEBUGF("Rpt [%04X] : %d\n", p->code[3], p->rptLen); - - // Check everything tallies - if (1 + 1 + 1 + 1 + (p->onceLen * 2) + (p->rptLen * 2) != p->codeLen) { - DEBUGF("Bad code length\n"); - return false; - } - - // Convert the IR data to our new format - ir->FF = p->code[p->codeLen - 1]; - - len = (p->onceLen * 2) + (p->rptLen * 2); - DEBUGF("Encoded: |"); - for (i = 0; i < len; i++) { - if (p->code[i+4] == ir->FF) { - ir->code[i+3] = 0xFF; - } else if (p->code[i+4] > 0xFE) { - DEBUGF("\n%04X : Mark/Space overflow\n", p->code[i+4]); - return false; - } else { - ir->code[i+3] = (p->code[i+4] * p->usec) / USECPERTICK; - } - DEBUGF("%s%d", !i ? "" : (i&1 ? "," : ", "), ir->code[i+3]); - } - DEBUGF("|\n"); - - ir->FF = (ir->FF * p->usec) / USECPERTICK; - DEBUGF("FF -> %d\n", ir->FF); - - return true; -} - -//+============================================================================= -// -void irDump (irCode_t* ir) -{ - int i, len; - - printf("uint8_t buttonName[%d] = {", len); - - printf("%d,%d, ", (ir->FF >> 8), ir->FF & 0xFF); - printf("%d,%d,%d, ", ir->code[0], ir->code[1], ir->code[2]); - - len = (ir->code[1] * 2) + (ir->code[2] * 2); - for (i = 0; i < len; i++) { - printf("%s%d", !i ? "" : (i&1 ? "," : ", "), ir->code[i+3]); - } - - printf("};\n"); - -} - -//+============================================================================= -// -int main ( ) -{ - pronto_t pCode; - irCode_t irCode; - - decode(prontoTest, &pCode, &irCode); - - irDump(&irCode); - - return 0; -} - -#endif //0 From 542516f116d5ce61c9153e44553b77bf7599eec1 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 12:03:54 -0600 Subject: [PATCH 031/584] Revert "Removed pronto "protocol"" This reverts commit 563c82c6c4fbce090590fd0c30f7c8301a4b2652. --- examples/IRremoteInfo/IRremoteInfo.ino | 1 + src/IRremote.h | 23 ++ src/irPronto.cpp | 513 +++++++++++++++++++++++++ 3 files changed, 537 insertions(+) create mode 100644 src/irPronto.cpp diff --git a/examples/IRremoteInfo/IRremoteInfo.ino b/examples/IRremoteInfo/IRremoteInfo.ino index 45cf7236e..c3f329754 100644 --- a/examples/IRremoteInfo/IRremoteInfo.ino +++ b/examples/IRremoteInfo/IRremoteInfo.ino @@ -188,6 +188,7 @@ void dumpProtocols() { Serial.print(F("DISH: ")); printSendEnabled(SEND_DISH); printDecodeEnabled(DECODE_DISH); Serial.print(F("SHARP: ")); printSendEnabled(SEND_SHARP); printDecodeEnabled(DECODE_SHARP); Serial.print(F("DENON: ")); printSendEnabled(SEND_DENON); printDecodeEnabled(DECODE_DENON); + Serial.print(F("PRONTO: ")); printSendEnabled(SEND_PRONTO); Serial.println(F("(Not Applicable)")); } void printSendEnabled(int flag) { diff --git a/src/IRremote.h b/src/IRremote.h index 6038a92ed..40f28dc2f 100644 --- a/src/IRremote.h +++ b/src/IRremote.h @@ -73,9 +73,27 @@ #define DECODE_DENON 1 #define SEND_DENON 1 +#define DECODE_PRONTO 0 // This function doe not logically make sense +#define SEND_PRONTO 1 + #define DECODE_LEGO_PF 0 // NOT WRITTEN #define SEND_LEGO_PF 1 +//------------------------------------------------------------------------------ +// When sending a Pronto code we request to send either the "once" code +// or the "repeat" code +// If the code requested does not exist we can request to fallback on the +// other code (the one we did not explicitly request) +// +// I would suggest that "fallback" will be the standard calling method +// The last paragraph on this page discusses the rationale of this idea: +// http://www.remotecentral.com/features/irdisp2.htm +// +#define PRONTO_ONCE false +#define PRONTO_REPEAT true +#define PRONTO_FALLBACK true +#define PRONTO_NOFALLBACK false + //------------------------------------------------------------------------------ // An enumerated list of all supported formats // You do NOT need to remove entries from this list when disabling protocols! @@ -99,6 +117,7 @@ typedef DISH, SHARP, DENON, + PRONTO, LEGO_PF, } decode_type_t; @@ -321,6 +340,10 @@ class IRsend //...................................................................... # if SEND_DENON void sendDenon (unsigned long data, int nbits) ; +# endif + //...................................................................... +# if SEND_PRONTO + void sendPronto (char* code, bool repeat, bool fallback) ; # endif //...................................................................... # if SEND_LEGO_PF diff --git a/src/irPronto.cpp b/src/irPronto.cpp new file mode 100644 index 000000000..0f530a900 --- /dev/null +++ b/src/irPronto.cpp @@ -0,0 +1,513 @@ +#define TEST 0 + +#if TEST +# define SEND_PRONTO 1 +# define PRONTO_ONCE false +# define PRONTO_REPEAT true +# define PRONTO_FALLBACK true +# define PRONTO_NOFALLBACK false +#endif + +#if SEND_PRONTO + +//****************************************************************************** +#if TEST +# include + void enableIROut (int freq) { printf("\nFreq = %d KHz\n", freq); } + void mark (int t) { printf("+%d," , t); } + void space (int t) { printf("-%d, ", t); } +#else +# include "IRremote.h" +#endif // TEST + +//+============================================================================= +// Check for a valid hex digit +// +bool ishex (char ch) +{ + return ( ((ch >= '0') && (ch <= '9')) || + ((ch >= 'A') && (ch <= 'F')) || + ((ch >= 'a') && (ch <= 'f')) ) ? true : false ; +} + +//+============================================================================= +// Check for a valid "blank" ... '\0' is a valid "blank" +// +bool isblank (char ch) +{ + return ((ch == ' ') || (ch == '\t') || (ch == '\0')) ? true : false ; +} + +//+============================================================================= +// Bypass spaces +// +bool byp (char** pcp) +{ + while (isblank(**pcp)) (*pcp)++ ; +} + +//+============================================================================= +// Hex-to-Byte : Decode a hex digit +// We assume the character has already been validated +// +uint8_t htob (char ch) +{ + if ((ch >= '0') && (ch <= '9')) return ch - '0' ; + if ((ch >= 'A') && (ch <= 'F')) return ch - 'A' + 10 ; + if ((ch >= 'a') && (ch <= 'f')) return ch - 'a' + 10 ; +} + +//+============================================================================= +// Hex-to-Word : Decode a block of 4 hex digits +// We assume the string has already been validated +// and the pointer being passed points at the start of a block of 4 hex digits +// +uint16_t htow (char* cp) +{ + return ( (htob(cp[0]) << 12) | (htob(cp[1]) << 8) | + (htob(cp[2]) << 4) | (htob(cp[3]) ) ) ; +} + +//+============================================================================= +// +bool sendPronto (char* s, bool repeat, bool fallback) +{ + int i; + int len; + int skip; + char* cp; + uint16_t freq; // Frequency in KHz + uint8_t usec; // pronto uSec/tick + uint8_t once; + uint8_t rpt; + + // Validate the string + for (cp = s; *cp; cp += 4) { + byp(&cp); + if ( !ishex(cp[0]) || !ishex(cp[1]) || + !ishex(cp[2]) || !ishex(cp[3]) || !isblank(cp[4]) ) return false ; + } + + // We will use cp to traverse the string + cp = s; + + // Check mode = Oscillated/Learned + byp(&cp); + if (htow(cp) != 0000) return false; + cp += 4; + + // Extract & set frequency + byp(&cp); + freq = (int)(1000000 / (htow(cp) * 0.241246)); // Rounding errors will occur, tolerance is +/- 10% + usec = (int)(((1.0 / freq) * 1000000) + 0.5); // Another rounding error, thank Cod for analogue electronics + freq /= 1000; // This will introduce a(nother) rounding error which we do not want in the usec calcualtion + cp += 4; + + // Get length of "once" code + byp(&cp); + once = htow(cp); + cp += 4; + + // Get length of "repeat" code + byp(&cp); + rpt = htow(cp); + cp += 4; + + // Which code are we sending? + if (fallback) { // fallback on the "other" code if "this" code is not present + if (!repeat) { // requested 'once' + if (once) len = once * 2, skip = 0 ; // if once exists send it + else len = rpt * 2, skip = 0 ; // else send repeat code + } else { // requested 'repeat' + if (rpt) len = rpt * 2, skip = 0 ; // if rpt exists send it + else len = once * 2, skip = 0 ; // else send once code + } + } else { // Send what we asked for, do not fallback if the code is empty! + if (!repeat) len = once * 2, skip = 0 ; // 'once' starts at 0 + else len = rpt * 2, skip = once ; // 'repeat' starts where 'once' ends + } + + // Skip to start of code + for (i = 0; i < skip; i++, cp += 4) byp(&cp) ; + + // Send code + enableIROut(freq); + for (i = 0; i < len; i++) { + byp(&cp); + if (i & 1) space(htow(cp) * usec); + else mark (htow(cp) * usec); + cp += 4; + } +} + +//+============================================================================= +#if TEST + +int main ( ) +{ + char prontoTest[] = + "0000 0070 0000 0032 0080 0040 0010 0010 0010 0030 " // 10 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 20 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 30 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 40 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 50 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 60 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 70 + "0010 0010 0010 0030 0010 0010 0010 0030 0010 0010 " // 80 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 90 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 100 + "0010 0030 0010 0aa6"; // 104 + + sendPronto(prontoTest, PRONTO_ONCE, PRONTO_FALLBACK); // once code + sendPronto(prontoTest, PRONTO_REPEAT, PRONTO_FALLBACK); // repeat code + sendPronto(prontoTest, PRONTO_ONCE, PRONTO_NOFALLBACK); // once code + sendPronto(prontoTest, PRONTO_REPEAT, PRONTO_NOFALLBACK); // repeat code + + return 0; +} + +#endif // TEST + +#endif // SEND_PRONTO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#if 0 +//****************************************************************************** +// Sources: +// http://www.remotecentral.com/features/irdisp2.htm +// http://www.hifi-remote.com/wiki/index.php?title=Working_With_Pronto_Hex +//****************************************************************************** + +#include +#include + +#define IRPRONTO +#include "IRremoteInt.h" // The Arduino IRremote library defines USECPERTICK + +//------------------------------------------------------------------------------ +// Source: https://www.google.co.uk/search?q=DENON+MASTER+IR+Hex+Command+Sheet +// -> http://assets.denon.com/documentmaster/us/denon%20master%20ir%20hex.xls +// +char prontoTest[] = + "0000 0070 0000 0032 0080 0040 0010 0010 0010 0030 " // 10 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 20 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 30 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 40 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 50 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 " // 60 + "0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 " // 70 + "0010 0010 0010 0030 0010 0010 0010 0030 0010 0010 " // 80 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 90 + "0010 0010 0010 0030 0010 0010 0010 0010 0010 0030 " // 100 + "0010 0030 0010 0aa6"; // 104 + +//------------------------------------------------------------------------------ +// This is the longest code we can support +#define CODEMAX 200 + +//------------------------------------------------------------------------------ +// This is the data we pull out of the pronto code +typedef + struct { + int freq; // Carrier frequency (in Hz) + int usec; // uSec per tick (based on freq) + + int codeLen; // Length of code + uint16_t code[CODEMAX]; // Code in hex + + int onceLen; // Length of "once" transmit + uint16_t* once; // Pointer to start within 'code' + + int rptLen; // Length of "repeat" transmit + uint16_t* rpt; // Pointer to start within 'code' + } +pronto_t; + +//------------------------------------------------------------------------------ +// From what I have seen, the only time we go over 8-bits is the 'space' +// on the end which creates the lead-out/inter-code gap. Assuming I'm right, +// we can code this up as a special case and otherwise halve the size of our +// data! +// Ignoring the first four values (the config data) and the last value +// (the lead-out), if you find a protocol that uses values greater than 00fe +// we are going to have to revisit this code! +// +// +// So, the 0th byte will be the carrier frequency in Khz (NOT Hz) +// " 1st " " " " length of the "once" code +// " 2nd " " " " length of the "repeat" code +// +// Thereafter, odd bytes will be Mark lengths as a multiple of USECPERTICK uS +// even " " " Space " " " " " " " +// +// Any occurence of "FF" in either a Mark or a Space will indicate +// "Use the 16-bit FF value" which will also be a multiple of USECPERTICK uS +// +// +// As a point of comparison, the test code (prontoTest[]) is 520 bytes +// (yes, more than 0.5KB of our Arduino's precious 32KB) ... after conversion +// to pronto hex that goes down to ((520/5)*2) = 208 bytes ... once converted to +// our format we are down to ((208/2) -1 -1 +2) = 104 bytes +// +// In fariness this is still very memory-hungry +// ...As a rough guide: +// 10 codes cost 1K of memory (this will vary depending on the protocol). +// +// So if you're building a complex remote control, you will probably need to +// keep the codes on an external memory device (not in the Arduino sketch) and +// load them as you need them. Hmmm. +// +// This dictates that "Oscillated Pronto Codes" are probably NOT the way forward +// +// For example, prontoTest[] happens to be: A 48-bit IR code in Denon format +// So we know it starts with 80/40 (Denon header) +// and ends with 10/aa6 (Denon leadout) +// and all (48) bits in between are either 10/10 (Denon 0) +// or 10/30 (Denon 1) +// So we could easily store this data in 1-byte ("Denon") +// + 1-byte (Length=48) +// + 6-bytes (IR code) +// At 8-bytes per code, we can store 128 codes in 1KB or memory - that's a lot +// better than the 2 (two) we started off with! +// +// And serendipitously, by reducing the amount of data, our program will run +// a LOT faster! +// +// Again, I repeat, even after you have spent time converting the "Oscillated +// Pronto Codes" in to IRremote format, it will be a LOT more memory-hungry +// than using sendDenon() (or whichever) ...BUT these codes are easily +// available on the internet, so we'll support them! +// +typedef + struct { + uint16_t FF; + uint8_t code[CODEMAX]; + } +irCode_t; + +//------------------------------------------------------------------------------ +#define DEBUGF(...) printf(__VA_ARGS__) + +//+============================================================================= +// String must be block of 4 hex digits separated with blanks +// +bool validate (char* cp, int* len) +{ + for (*len = 0; *cp; (*len)++, cp += 4) { + byp(&cp); + if ( !ishex(cp[0]) || !ishex(cp[1]) || + !ishex(cp[2]) || !ishex(cp[3]) || !isblank(cp[4]) ) return false ; + } + + return true; +} + +//+============================================================================= +// Hex-to-Byte : Decode a hex digit +// We assume the character has already been validated +// +uint8_t htob (char ch) +{ + if ((ch >= '0') && (ch <= '9')) return ch - '0' ; + if ((ch >= 'A') && (ch <= 'F')) return ch - 'A' + 10 ; + if ((ch >= 'a') && (ch <= 'f')) return ch - 'a' + 10 ; +} + +//+============================================================================= +// Hex-to-Word : Decode a block of 4 hex digits +// We assume the string has already been validated +// and the pointer being passed points at the start of a block of 4 hex digits +// +uint16_t htow (char* cp) +{ + return ( (htob(cp[0]) << 12) | (htob(cp[1]) << 8) | + (htob(cp[2]) << 4) | (htob(cp[3]) ) ) ; +} + +//+============================================================================= +// Convert the pronto string in to data +// +bool decode (char* s, pronto_t* p, irCode_t* ir) +{ + int i, len; + char* cp; + + // Validate the Pronto string + if (!validate(s, &p->codeLen)) { + DEBUGF("Invalid pronto string\n"); + return false ; + } + DEBUGF("Found %d hex codes\n", p->codeLen); + + // Allocate memory to store the decoded string + //if (!(p->code = malloc(p->len))) { + // DEBUGF("Memory allocation failed\n"); + // return false ; + //} + + // Check in case our code is too long + if (p->codeLen > CODEMAX) { + DEBUGF("Code too long, edit CODEMAX and recompile\n"); + return false ; + } + + // Decode the string + cp = s; + for (i = 0; i < p->codeLen; i++, cp += 4) { + byp(&cp); + p->code[i] = htow(cp); + } + + // Announce our findings + DEBUGF("Input: |%s|\n", s); + DEBUGF("Found: |"); + for (i = 0; i < p->codeLen; i++) DEBUGF("%04x ", p->code[i]) ; + DEBUGF("|\n"); + + DEBUGF("Form [%04X] : ", p->code[0]); + if (p->code[0] == 0x0000) DEBUGF("Oscillated (Learned)\n"); + else if (p->code[0] == 0x0100) DEBUGF("Unmodulated\n"); + else DEBUGF("Unknown\n"); + if (p->code[0] != 0x0000) return false ; // Can only handle Oscillated + + // Calculate the carrier frequency (+/- 10%) & uSecs per pulse + // Pronto uses a crystal which generates a timeabse of 0.241246 + p->freq = (int)(1000000 / (p->code[1] * 0.241246)); + p->usec = (int)(((1.0 / p->freq) * 1000000) + 0.5); + ir->code[0] = p->freq / 1000; + DEBUGF("Freq [%04X] : %d Hz (%d uS/pluse) -> %d KHz\n", + p->code[1], p->freq, p->usec, ir->code[0]); + + // Set the length & start pointer for the "once" code + p->onceLen = p->code[2]; + p->once = &p->code[4]; + ir->code[1] = p->onceLen; + DEBUGF("Once [%04X] : %d\n", p->code[2], p->onceLen); + + // Set the length & start pointer for the "repeat" code + p->rptLen = p->code[3]; + p->rpt = &p->code[4 + p->onceLen]; + ir->code[2] = p->rptLen; + DEBUGF("Rpt [%04X] : %d\n", p->code[3], p->rptLen); + + // Check everything tallies + if (1 + 1 + 1 + 1 + (p->onceLen * 2) + (p->rptLen * 2) != p->codeLen) { + DEBUGF("Bad code length\n"); + return false; + } + + // Convert the IR data to our new format + ir->FF = p->code[p->codeLen - 1]; + + len = (p->onceLen * 2) + (p->rptLen * 2); + DEBUGF("Encoded: |"); + for (i = 0; i < len; i++) { + if (p->code[i+4] == ir->FF) { + ir->code[i+3] = 0xFF; + } else if (p->code[i+4] > 0xFE) { + DEBUGF("\n%04X : Mark/Space overflow\n", p->code[i+4]); + return false; + } else { + ir->code[i+3] = (p->code[i+4] * p->usec) / USECPERTICK; + } + DEBUGF("%s%d", !i ? "" : (i&1 ? "," : ", "), ir->code[i+3]); + } + DEBUGF("|\n"); + + ir->FF = (ir->FF * p->usec) / USECPERTICK; + DEBUGF("FF -> %d\n", ir->FF); + + return true; +} + +//+============================================================================= +// +void irDump (irCode_t* ir) +{ + int i, len; + + printf("uint8_t buttonName[%d] = {", len); + + printf("%d,%d, ", (ir->FF >> 8), ir->FF & 0xFF); + printf("%d,%d,%d, ", ir->code[0], ir->code[1], ir->code[2]); + + len = (ir->code[1] * 2) + (ir->code[2] * 2); + for (i = 0; i < len; i++) { + printf("%s%d", !i ? "" : (i&1 ? "," : ", "), ir->code[i+3]); + } + + printf("};\n"); + +} + +//+============================================================================= +// +int main ( ) +{ + pronto_t pCode; + irCode_t irCode; + + decode(prontoTest, &pCode, &irCode); + + irDump(&irCode); + + return 0; +} + +#endif //0 From 4eb95a32721e340a96c1abc0262fc17ea2ebca0b Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Mon, 14 Aug 2017 17:12:02 -0600 Subject: [PATCH 032/584] Revert "Removed blinking led" This reverts commit a406f3b9f97864c23cc7fb76f5deb04f5e09c9f8. --- keywords.txt | 1 + src/IRremote.cpp | 11 +++++++++++ src/IRremote.h | 3 ++- src/IRremoteInt.h | 2 ++ src/boarddefs.h | 27 ++++++++++++++++++++++++++- src/irRecv.cpp | 17 ++++++++++++++++- 6 files changed, 58 insertions(+), 3 deletions(-) diff --git a/keywords.txt b/keywords.txt index ea6e0192c..f2b9a4957 100644 --- a/keywords.txt +++ b/keywords.txt @@ -14,6 +14,7 @@ IRsend KEYWORD1 # Methods and Functions (KEYWORD2) ####################################### +blink13 KEYWORD2 decode KEYWORD2 enableIRIn KEYWORD2 resume KEYWORD2 diff --git a/src/IRremote.cpp b/src/IRremote.cpp index c8730d7b3..f41f81878 100644 --- a/src/IRremote.cpp +++ b/src/IRremote.cpp @@ -127,6 +127,7 @@ ISR (TIMER_INTR_NAME) { TIMER_RESET; + // Read if IR Receiver -> SPACE [xmt LED off] or a MARK [xmt LED on] // digitalRead() is very slow. Optimisation is possible, but makes the code unportable uint8_t irdata = (uint8_t)digitalRead(irparams.recvpin); @@ -184,4 +185,14 @@ ISR (TIMER_INTR_NAME) break; } +#ifdef BLINKLED + // If requested, flash LED while receiving IR data + if (irparams.blinkflag) { + if (irdata == MARK) + if (irparams.blinkpin) digitalWrite(irparams.blinkpin, HIGH); // Turn user defined pin LED on + else BLINKLED_ON() ; // if no user defined LED pin, turn default LED pin for the hardware on + else if (irparams.blinkpin) digitalWrite(irparams.blinkpin, LOW); // Turn user defined pin LED on + else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on + } +#endif // BLINKLED } diff --git a/src/IRremote.h b/src/IRremote.h index 40f28dc2f..928284361 100644 --- a/src/IRremote.h +++ b/src/IRremote.h @@ -172,8 +172,9 @@ class IRrecv { public: IRrecv (int recvpin) ; - IRrecv (int recvpin); + IRrecv (int recvpin, int blinkpin); + void blink13 (int blinkflag) ; int decode (decode_results *results) ; void enableIRIn ( ) ; bool isIdle ( ) ; diff --git a/src/IRremoteInt.h b/src/IRremoteInt.h index 08f162e51..1baa05d6d 100644 --- a/src/IRremoteInt.h +++ b/src/IRremoteInt.h @@ -41,6 +41,8 @@ typedef // The fields are ordered to reduce memory over caused by struct-padding uint8_t rcvstate; // State Machine state uint8_t recvpin; // Pin connected to IR data from detector + uint8_t blinkpin; + uint8_t blinkflag; // true -> enable blinking of pin on IR processing uint8_t rawlen; // counter of entries in rawbuf unsigned int timer; // State timer, counts 50uS ticks. unsigned int rawbuf[RAWBUF]; // raw data diff --git a/src/boarddefs.h b/src/boarddefs.h index 5751ba700..5c49465ef 100644 --- a/src/boarddefs.h +++ b/src/boarddefs.h @@ -47,10 +47,29 @@ // is not configurable on the current board. //------------------------------------------------------------------------------ -// Soft Carrier fallback for SAM and SAMD architectures +// Defines for blinking the LED // +#if defined(CORE_LED0_PIN) +# define BLINKLED CORE_LED0_PIN +# define BLINKLED_ON() (digitalWrite(CORE_LED0_PIN, HIGH)) +# define BLINKLED_OFF() (digitalWrite(CORE_LED0_PIN, LOW)) + +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +# define BLINKLED 13 +# define BLINKLED_ON() (PORTB |= B10000000) +# define BLINKLED_OFF() (PORTB &= B01111111) + +#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) +# define BLINKLED 0 +# define BLINKLED_ON() (PORTD |= B00000001) +# define BLINKLED_OFF() (PORTD &= B11111110) + #elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) +# define BLINKLED LED_BUILTIN +# define BLINKLED_ON() (digitalWrite(LED_BUILTIN, HIGH)) +# define BLINKLED_OFF() (digitalWrite(LED_BUILTIN, LOW)) + # define USE_SOFT_CARRIER // Define to use spin wait instead of delayMicros() //# define USE_SPIN_WAIT @@ -60,6 +79,8 @@ # define SEND_PIN 9 #elif defined(ESP32) + // No system LED on ESP32, disable blinking by NOT defining BLINKLED + // avr/interrupt.h is not present # undef HAS_AVR_INTERRUPT_H @@ -69,6 +90,10 @@ // Supply own enbleIRIn # undef USE_DEFAULT_ENABLE_IR_IN +#else +# define BLINKLED 13 +# define BLINKLED_ON() (PORTB |= B00100000) +# define BLINKLED_OFF() (PORTB &= B11011111) #endif //------------------------------------------------------------------------------ diff --git a/src/irRecv.cpp b/src/irRecv.cpp index 8498e16a4..b549dac1c 100644 --- a/src/irRecv.cpp +++ b/src/irRecv.cpp @@ -99,11 +99,15 @@ int IRrecv::decode (decode_results *results) IRrecv::IRrecv (int recvpin) { irparams.recvpin = recvpin; + irparams.blinkflag = 0; } -IRrecv::IRrecv (int recvpin) +IRrecv::IRrecv (int recvpin, int blinkpin) { irparams.recvpin = recvpin; + irparams.blinkpin = blinkpin; + pinMode(blinkpin, OUTPUT); + irparams.blinkflag = 0; } @@ -138,6 +142,17 @@ void IRrecv::enableIRIn ( ) } #endif // USE_DEFAULT_ENABLE_IR_IN +//+============================================================================= +// Enable/disable blinking of pin 13 on IR processing +// +void IRrecv::blink13 (int blinkflag) +{ +#ifdef BLINKLED + irparams.blinkflag = blinkflag; + if (blinkflag) pinMode(BLINKLED, OUTPUT) ; +#endif +} + //+============================================================================= // Return if receiving new IR signals // From 7245efd2f5eeeb12986236ec806f03912a002fe3 Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Fri, 18 Aug 2017 01:32:01 +0200 Subject: [PATCH 033/584] Fix some minor problems in boarddefs.h and IRremote.cpp (#505) * Removed some trailing spaces in IRremote.cpp. * IRremote.cpp: fix some compiler warnings (-Wall -Wextra). Remark: braces necessitated by the macro nature of DBG_PRINTLN. * boarddefs.h: removed spurious #. Nuked trailing spaces. Credits: bengtmartensson --- src/IRremote.cpp | 31 +++++++++++++++++-------------- src/boarddefs.h | 8 ++++---- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/IRremote.cpp b/src/IRremote.cpp index f41f81878..f21f41b0e 100644 --- a/src/IRremote.cpp +++ b/src/IRremote.cpp @@ -52,11 +52,12 @@ int MATCH (int measured, int desired) DBG_PRINT(TICKS_HIGH(desired), DEC); bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired))); - if (passed) + if (passed) { DBG_PRINTLN(F("?; passed")); - else - DBG_PRINTLN(F("?; FAILED")); - return passed; + } else { + DBG_PRINTLN(F("?; FAILED")); + } + return passed; } //+======================================================== @@ -68,7 +69,7 @@ int MATCH_MARK (int measured_ticks, int desired_us) DBG_PRINT(measured_ticks * USECPERTICK, DEC); DBG_PRINT(F("us vs ")); DBG_PRINT(desired_us, DEC); - DBG_PRINT("us"); + DBG_PRINT("us"); DBG_PRINT(": "); DBG_PRINT(TICKS_LOW(desired_us + MARK_EXCESS) * USECPERTICK, DEC); DBG_PRINT(F(" <= ")); @@ -78,11 +79,12 @@ int MATCH_MARK (int measured_ticks, int desired_us) bool passed = ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS)) && (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS))); - if (passed) + if (passed) { DBG_PRINTLN(F("?; passed")); - else - DBG_PRINTLN(F("?; FAILED")); - return passed; + } else { + DBG_PRINTLN(F("?; FAILED")); + } + return passed; } //+======================================================== @@ -94,7 +96,7 @@ int MATCH_SPACE (int measured_ticks, int desired_us) DBG_PRINT(measured_ticks * USECPERTICK, DEC); DBG_PRINT(F("us vs ")); DBG_PRINT(desired_us, DEC); - DBG_PRINT("us"); + DBG_PRINT("us"); DBG_PRINT(": "); DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS) * USECPERTICK, DEC); DBG_PRINT(F(" <= ")); @@ -104,11 +106,12 @@ int MATCH_SPACE (int measured_ticks, int desired_us) bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS)) && (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS))); - if (passed) + if (passed) { DBG_PRINTLN(F("?; passed")); - else - DBG_PRINTLN(F("?; FAILED")); - return passed; + } else { + DBG_PRINTLN(F("?; FAILED")); + } + return passed; } //+============================================================================= diff --git a/src/boarddefs.h b/src/boarddefs.h index 5c49465ef..f70ac4596 100644 --- a/src/boarddefs.h +++ b/src/boarddefs.h @@ -85,7 +85,7 @@ # undef HAS_AVR_INTERRUPT_H // Sending not implemented -# undef SENDING_SUPPORTED# +# undef SENDING_SUPPORTED // Supply own enbleIRIn # undef USE_DEFAULT_ENABLE_IR_IN @@ -161,7 +161,7 @@ || defined(__AVR_ATmega164P__) //#define IR_USE_TIMER1 // tx = pin 13 #define IR_USE_TIMER2 // tx = pin 14 - + //MegaCore - ATmega64, ATmega128 #elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) #define IR_USE_TIMER1 // tx = pin 13 @@ -624,7 +624,7 @@ #define TIMER_RESET #define TIMER_ENABLE_PWM // Not presently used #define TIMER_DISABLE_PWM -#define TIMER_ENABLE_INTR NVIC_EnableIRQ(TC3_IRQn) // Not presently used +#define TIMER_ENABLE_INTR NVIC_EnableIRQ(TC3_IRQn) // Not presently used #define TIMER_DISABLE_INTR NVIC_DisableIRQ(TC3_IRQn) #define TIMER_INTR_NAME TC3_Handler // Not presently used #define TIMER_CONFIG_KHZ(f) @@ -645,7 +645,7 @@ #ifndef SENDPIN_ON #define SENDPIN_ON(pin) digitalWrite(pin, HIGH) #endif - + #ifndef SENDPIN_OFF #define SENDPIN_OFF(pin) digitalWrite(pin, LOW) #endif From 24dd940107c978102fe2a04a7baf49949bde1e73 Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Sun, 20 Aug 2017 23:49:57 +0200 Subject: [PATCH 034/584] Moving private includes to sub-directory, #464 (#507) * Add missing "paragraph" to library.properties. * Move not-to-be-exported includes to subdirectory. Remove #include "IRremoteInt.h" from a number of files since it now does not work any more, and since IRremote.h #includes it already. This resolves #464. * Remove #include from examples, too. * Make ir_Lego_PF_BitStreamEncoder.h exported (again). * Revoked fe24095 (paragraph) to keep 1-1 correspondance to #464. --- examples/IRtest/IRtest.ino | 1 - .../LegoPowerFunctionsSendDemo/LegoPowerFunctionsSendDemo.ino | 1 - src/IRremote.cpp | 3 +-- src/IRremote.h | 2 +- src/esp32.cpp | 1 - src/irRecv.cpp | 1 - src/irSend.cpp | 3 +-- src/ir_Aiwa.cpp | 1 - src/ir_Denon.cpp | 1 - src/ir_Dish.cpp | 1 - src/ir_JVC.cpp | 1 - src/ir_LG.cpp | 1 - src/ir_Lego_PF.cpp | 1 - src/ir_Mitsubishi.cpp | 1 - src/ir_NEC.cpp | 1 - src/ir_Panasonic.cpp | 1 - src/ir_RC5_RC6.cpp | 1 - src/ir_Samsung.cpp | 1 - src/ir_Sanyo.cpp | 1 - src/ir_Sharp.cpp | 1 - src/ir_Sony.cpp | 1 - src/ir_Template.cpp | 1 - src/ir_Whynter.cpp | 1 - src/{ => private}/IRremoteInt.h | 0 src/{ => private}/boarddefs.h | 0 src/sam.cpp | 3 +-- 26 files changed, 4 insertions(+), 27 deletions(-) rename src/{ => private}/IRremoteInt.h (100%) rename src/{ => private}/boarddefs.h (100%) diff --git a/examples/IRtest/IRtest.ino b/examples/IRtest/IRtest.ino index 4845a4a4d..b30256386 100644 --- a/examples/IRtest/IRtest.ino +++ b/examples/IRtest/IRtest.ino @@ -10,7 +10,6 @@ */ #include -#include // Dumps out the decode_results structure. // Call this after IRrecv::decode() diff --git a/examples/LegoPowerFunctionsSendDemo/LegoPowerFunctionsSendDemo.ino b/examples/LegoPowerFunctionsSendDemo/LegoPowerFunctionsSendDemo.ino index e43d06c2e..1afafe5b6 100644 --- a/examples/LegoPowerFunctionsSendDemo/LegoPowerFunctionsSendDemo.ino +++ b/examples/LegoPowerFunctionsSendDemo/LegoPowerFunctionsSendDemo.ino @@ -4,7 +4,6 @@ */ #include -#include IRsend irsend; diff --git a/src/IRremote.cpp b/src/IRremote.cpp index f21f41b0e..0d63b7774 100644 --- a/src/IRremote.cpp +++ b/src/IRremote.cpp @@ -20,8 +20,7 @@ // Defining IR_GLOBAL here allows us to declare the instantiation of global variables #define IR_GLOBAL -# include "IRremote.h" -# include "IRremoteInt.h" +#include "IRremote.h" #undef IR_GLOBAL #ifdef HAS_AVR_INTERRUPT_H diff --git a/src/IRremote.h b/src/IRremote.h index 928284361..e95e068c7 100644 --- a/src/IRremote.h +++ b/src/IRremote.h @@ -21,7 +21,7 @@ //------------------------------------------------------------------------------ // The ISR header contains several useful macros the user may wish to use // -#include "IRremoteInt.h" +#include "private/IRremoteInt.h" //------------------------------------------------------------------------------ // Supported IR protocols diff --git a/src/esp32.cpp b/src/esp32.cpp index ef4d79476..9710098c2 100644 --- a/src/esp32.cpp +++ b/src/esp32.cpp @@ -3,7 +3,6 @@ // This file contains functions specific to the ESP32. #include "IRremote.h" -#include "IRremoteInt.h" // "Idiot check" #ifdef USE_DEFAULT_ENABLE_IR_IN diff --git a/src/irRecv.cpp b/src/irRecv.cpp index b549dac1c..f3e12aae1 100644 --- a/src/irRecv.cpp +++ b/src/irRecv.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //+============================================================================= // Decodes the received IR message diff --git a/src/irSend.cpp b/src/irSend.cpp index a01b5a012..0561408b6 100644 --- a/src/irSend.cpp +++ b/src/irSend.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" #ifdef SENDING_SUPPORTED //+============================================================================= @@ -136,4 +135,4 @@ void IRsend::custom_delay_usec(unsigned long uSecs) { //} } -#endif // SENDING_SUPPORTED \ No newline at end of file +#endif // SENDING_SUPPORTED diff --git a/src/ir_Aiwa.cpp b/src/ir_Aiwa.cpp index 50ec58d8c..78cd48aa0 100644 --- a/src/ir_Aiwa.cpp +++ b/src/ir_Aiwa.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // AAA IIIII W W AAA diff --git a/src/ir_Denon.cpp b/src/ir_Denon.cpp index c54e28654..848af79db 100644 --- a/src/ir_Denon.cpp +++ b/src/ir_Denon.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" // Reverse Engineered by looking at RAW dumps generated by IRremote diff --git a/src/ir_Dish.cpp b/src/ir_Dish.cpp index fa8e06516..e2f5c15d8 100644 --- a/src/ir_Dish.cpp +++ b/src/ir_Dish.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // DDDD IIIII SSSS H H diff --git a/src/ir_JVC.cpp b/src/ir_JVC.cpp index eeec20fe9..2a418cb66 100644 --- a/src/ir_JVC.cpp +++ b/src/ir_JVC.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // JJJJJ V V CCCC diff --git a/src/ir_LG.cpp b/src/ir_LG.cpp index ba532cb60..476196a6d 100644 --- a/src/ir_LG.cpp +++ b/src/ir_LG.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // L GGGG diff --git a/src/ir_Lego_PF.cpp b/src/ir_Lego_PF.cpp index 37d507ceb..9f9c515f6 100644 --- a/src/ir_Lego_PF.cpp +++ b/src/ir_Lego_PF.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" #include "ir_Lego_PF_BitStreamEncoder.h" //============================================================================== diff --git a/src/ir_Mitsubishi.cpp b/src/ir_Mitsubishi.cpp index 7f83e530f..751ed82ef 100644 --- a/src/ir_Mitsubishi.cpp +++ b/src/ir_Mitsubishi.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // MMMMM IIIII TTTTT SSSS U U BBBB IIIII SSSS H H IIIII diff --git a/src/ir_NEC.cpp b/src/ir_NEC.cpp index 3b4932100..284eab8af 100644 --- a/src/ir_NEC.cpp +++ b/src/ir_NEC.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // N N EEEEE CCCC diff --git a/src/ir_Panasonic.cpp b/src/ir_Panasonic.cpp index dc0dd7317..13288d2c1 100644 --- a/src/ir_Panasonic.cpp +++ b/src/ir_Panasonic.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // PPPP AAA N N AAA SSSS OOO N N IIIII CCCC diff --git a/src/ir_RC5_RC6.cpp b/src/ir_RC5_RC6.cpp index 10e79278e..402ded73d 100644 --- a/src/ir_RC5_RC6.cpp +++ b/src/ir_RC5_RC6.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //+============================================================================= // Gets one undecoded level at a time from the raw buffer. diff --git a/src/ir_Samsung.cpp b/src/ir_Samsung.cpp index 224487dbc..b605b000b 100644 --- a/src/ir_Samsung.cpp +++ b/src/ir_Samsung.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // SSSS AAA MMM SSSS U U N N GGGG diff --git a/src/ir_Sanyo.cpp b/src/ir_Sanyo.cpp index c775d6118..754444d87 100644 --- a/src/ir_Sanyo.cpp +++ b/src/ir_Sanyo.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // SSSS AAA N N Y Y OOO diff --git a/src/ir_Sharp.cpp b/src/ir_Sharp.cpp index 73462c5bc..da0af1a35 100644 --- a/src/ir_Sharp.cpp +++ b/src/ir_Sharp.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // SSSS H H AAA RRRR PPPP diff --git a/src/ir_Sony.cpp b/src/ir_Sony.cpp index 31e67cf78..b3e15ef47 100644 --- a/src/ir_Sony.cpp +++ b/src/ir_Sony.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // SSSS OOO N N Y Y diff --git a/src/ir_Template.cpp b/src/ir_Template.cpp index eee2b0bb2..2b895e144 100644 --- a/src/ir_Template.cpp +++ b/src/ir_Template.cpp @@ -92,7 +92,6 @@ Regards, */ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // diff --git a/src/ir_Whynter.cpp b/src/ir_Whynter.cpp index a830562c6..5ec373de4 100644 --- a/src/ir_Whynter.cpp +++ b/src/ir_Whynter.cpp @@ -1,5 +1,4 @@ #include "IRremote.h" -#include "IRremoteInt.h" //============================================================================== // W W H H Y Y N N TTTTT EEEEE RRRRR diff --git a/src/IRremoteInt.h b/src/private/IRremoteInt.h similarity index 100% rename from src/IRremoteInt.h rename to src/private/IRremoteInt.h diff --git a/src/boarddefs.h b/src/private/boarddefs.h similarity index 100% rename from src/boarddefs.h rename to src/private/boarddefs.h diff --git a/src/sam.cpp b/src/sam.cpp index 06575891c..4cb1b9f13 100644 --- a/src/sam.cpp +++ b/src/sam.cpp @@ -1,7 +1,6 @@ // Support routines for SAM processor boards #include "IRremote.h" -#include "IRremoteInt.h" #if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) @@ -99,4 +98,4 @@ void TC3_Handler(void) } } -#endif // defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) \ No newline at end of file +#endif // defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) From 5bbd55c65015a387063fd3877c58ee4affedd20e Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Tue, 22 Aug 2017 15:47:20 -0600 Subject: [PATCH 035/584] Fix #510 --- library.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/library.properties b/library.properties index 0e23d4cf2..56f8a78f4 100644 --- a/library.properties +++ b/library.properties @@ -3,6 +3,7 @@ version=2.4.0 author=shirriff, z3t0 maintainer=z3t0 sentence=Send and receive infrared signals with multiple protocols +paragraph=Find more information at https://github.com/z3t0/Arduino-IRremote category=Communication url=https://github.com/z3t0/Arduino-IRremote architectures=* From e206e122e5afbf2a495671dbb8fba5cf67ef849a Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Wed, 23 Aug 2017 21:57:05 +0200 Subject: [PATCH 036/584] Doxygen API documentation in the sense of #461 (#512) * new file: Doxyfile; #461. * Doxygen related documentation to two files. (Not complete.) #461. --- Doxyfile | 2417 +++++++++++++++++++++++++++++++++++++ src/IRremote.h | 105 +- src/private/IRremoteInt.h | 35 +- 3 files changed, 2516 insertions(+), 41 deletions(-) create mode 100644 Doxyfile diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 000000000..a4274ab79 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,2417 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "IRremote" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = YES + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = src src/private . + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = README.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = api-doc + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /