diff --git a/Contributors.md b/Contributors.md index bf1e64dbd..ae2489008 100644 --- a/Contributors.md +++ b/Contributors.md @@ -18,6 +18,5 @@ 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/IRremote.cpp b/IRremote.cpp index e811cfc7b..c9907ebe7 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -18,17 +18,14 @@ // Whynter A/C ARC-110WD added by Francesco Meschia //****************************************************************************** +#include + // 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 @@ -123,11 +120,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; diff --git a/README.md b/README.md index 305c7bd9c..2ec302c58 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ 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. @@ -43,7 +42,6 @@ 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/boarddefs.h b/boarddefs.h index 17e25513e..62b6be4fb 100644 --- a/boarddefs.h +++ b/boarddefs.h @@ -39,14 +39,9 @@ # 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 @@ -130,17 +125,15 @@ // 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 -#elif defined(ESP32) - #define IR_TIMER_USE_ESP32 -#else // 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 @@ -545,28 +538,6 @@ #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 -#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 - //--------------------------------------------------------- // Unknown Timer // diff --git a/changelog.md b/changelog.md index 81339f2e6..0702ddcf9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,3 @@ -## 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 - Fix calculation of pause length in LEGO PF protocol [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/427) diff --git a/examples/IRrecvDemo/IRrecvDemo.ino b/examples/IRrecvDemo/IRrecvDemo.ino index 3e2d280eb..3a498328d 100644 --- a/examples/IRrecvDemo/IRrecvDemo.ino +++ b/examples/IRrecvDemo/IRrecvDemo.ino @@ -17,11 +17,7 @@ decode_results results; void setup() { 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"); } void loop() { diff --git a/examples/IRrecvDump/IRrecvDump.ino b/examples/IRrecvDump/IRrecvDump.ino index fa25cd8ea..90b47ba69 100644 --- a/examples/IRrecvDump/IRrecvDump.ino +++ b/examples/IRrecvDump/IRrecvDump.ino @@ -15,7 +15,7 @@ * You can change this to another available Arduino Pin. * Your IR receiver should be connected to the pin defined here */ -int RECV_PIN = 11; +int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); diff --git a/irRecv.cpp b/irRecv.cpp index 12b0806b1..63438566a 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 @@ -122,17 +117,6 @@ IRrecv::IRrecv (int recvpin, int blinkpin) // 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 cli(); // Setup pulse clock timer interrupt // Prescale /8 (16M/8 = 0.5 microseconds per tick) @@ -146,7 +130,6 @@ 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 c3ef3ffac..253c941a9 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -54,8 +54,6 @@ 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 // Disable the Timer2 Interrupt (which is used for receiving IR) TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt @@ -68,7 +66,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 } //+============================================================================= diff --git a/library.json b/library.json index d8cd523a7..de93d16e5 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.2.3", "frameworks": "arduino", "platforms": "atmelavr", "authors" :