From a406f3b9f97864c23cc7fb76f5deb04f5e09c9f8 Mon Sep 17 00:00:00 2001 From: Rafi Khan Date: Sun, 13 Aug 2017 11:42:39 -0600 Subject: [PATCH] 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 f2b9a49..ea6e019 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 f41f818..c8730d7 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 9282843..40f28dc 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 1baa05d..08f162e 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 5c49465..5751ba7 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 b549dac..8498e16 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 //