Removed blinking led

It is difficult to maintain this over different architectures and also
not entirely that useful.

Fixes #462
This commit is contained in:
Rafi Khan
2017-08-13 11:42:39 -06:00
parent 31968a4875
commit a406f3b9f9
6 changed files with 3 additions and 58 deletions

View File

@@ -14,7 +14,6 @@ IRsend KEYWORD1
# Methods and Functions (KEYWORD2)
#######################################
blink13 KEYWORD2
decode KEYWORD2
enableIRIn KEYWORD2
resume KEYWORD2

View File

@@ -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
}

View File

@@ -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 ( ) ;

View File

@@ -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

View File

@@ -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
//------------------------------------------------------------------------------

View File

@@ -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
//