mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-13 01:46:21 +00:00
Improve output for recvDumpV2 Added my name to the contributors list (not 'cos I really care for the credit <whatever> but so people know who to "blame" [non-pejorative]) Moved the decode() function to the top of the source as it is likely to be edited the most
This commit is contained in:
@@ -11,6 +11,7 @@ These are the active contributors of this project that you may contact if there
|
|||||||
- [crash7](https://github.com/crash7) : Active contributor
|
- [crash7](https://github.com/crash7) : Active contributor
|
||||||
- [Neco777](https://github.com/neco777) : Active contributor
|
- [Neco777](https://github.com/neco777) : Active contributor
|
||||||
- [Lauszus](https://github.com/lauszus) : Active contributor
|
- [Lauszus](https://github.com/lauszus) : Active contributor
|
||||||
|
- [csBlueChip](https://github.com/csbluechip) : Active contributor
|
||||||
|
|
||||||
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed.
|
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed.
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,22 @@ void dumpCode (decode_results *results)
|
|||||||
|
|
||||||
// Newline
|
// Newline
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
|
// Now dump "known" codes
|
||||||
|
if (results->decode_type != UNKNOWN) {
|
||||||
|
|
||||||
|
// Some protocols have an address
|
||||||
|
if (results->decode_type == PANASONIC) {
|
||||||
|
Serial.print("unsigned int addr = 0x");
|
||||||
|
Serial.print(results->address, HEX);
|
||||||
|
Serial.println(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
// All protocols have data
|
||||||
|
Serial.print("unsigned int data = 0x");
|
||||||
|
Serial.print(results->value, HEX);
|
||||||
|
Serial.println(";");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
|
|||||||
104
irRecv.cpp
104
irRecv.cpp
@@ -1,58 +1,6 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
#include "IRremoteInt.h"
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
IRrecv::IRrecv (int recvpin)
|
|
||||||
{
|
|
||||||
irparams.recvpin = recvpin;
|
|
||||||
irparams.blinkflag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
// initialization
|
|
||||||
//
|
|
||||||
void IRrecv::enableIRIn ( )
|
|
||||||
{
|
|
||||||
cli();
|
|
||||||
// setup pulse clock timer interrupt
|
|
||||||
//Prescale /8 (16M/8 = 0.5 microseconds per tick)
|
|
||||||
// Therefore, the timer interval can range from 0.5 to 128 microseconds
|
|
||||||
// depending on the reset value (255 to 0)
|
|
||||||
TIMER_CONFIG_NORMAL();
|
|
||||||
|
|
||||||
//Timer2 Overflow Interrupt Enable
|
|
||||||
TIMER_ENABLE_INTR;
|
|
||||||
|
|
||||||
TIMER_RESET;
|
|
||||||
|
|
||||||
sei(); // enable interrupts
|
|
||||||
|
|
||||||
// initialize state machine variables
|
|
||||||
irparams.rcvstate = STATE_IDLE;
|
|
||||||
irparams.rawlen = 0;
|
|
||||||
|
|
||||||
// set pin modes
|
|
||||||
pinMode(irparams.recvpin, INPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
// enable/disable blinking of pin 13 on IR processing
|
|
||||||
//
|
|
||||||
void IRrecv::blink13 (int blinkflag)
|
|
||||||
{
|
|
||||||
irparams.blinkflag = blinkflag;
|
|
||||||
if (blinkflag) pinMode(BLINKLED, OUTPUT) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
// Restart the ISR state machine
|
|
||||||
//
|
|
||||||
void IRrecv::resume ( )
|
|
||||||
{
|
|
||||||
irparams.rcvstate = STATE_IDLE;
|
|
||||||
irparams.rawlen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// Decodes the received IR message
|
// Decodes the received IR message
|
||||||
// Returns 0 if no data ready, 1 if data ready.
|
// Returns 0 if no data ready, 1 if data ready.
|
||||||
@@ -142,6 +90,58 @@ int IRrecv::decode (decode_results *results)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//+=============================================================================
|
||||||
|
IRrecv::IRrecv (int recvpin)
|
||||||
|
{
|
||||||
|
irparams.recvpin = recvpin;
|
||||||
|
irparams.blinkflag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+=============================================================================
|
||||||
|
// initialization
|
||||||
|
//
|
||||||
|
void IRrecv::enableIRIn ( )
|
||||||
|
{
|
||||||
|
cli();
|
||||||
|
// Setup pulse clock timer interrupt
|
||||||
|
// Prescale /8 (16M/8 = 0.5 microseconds per tick)
|
||||||
|
// Therefore, the timer interval can range from 0.5 to 128 microseconds
|
||||||
|
// Depending on the reset value (255 to 0)
|
||||||
|
TIMER_CONFIG_NORMAL();
|
||||||
|
|
||||||
|
// Timer2 Overflow Interrupt Enable
|
||||||
|
TIMER_ENABLE_INTR;
|
||||||
|
|
||||||
|
TIMER_RESET;
|
||||||
|
|
||||||
|
sei(); // enable interrupts
|
||||||
|
|
||||||
|
// Initialize state machine variables
|
||||||
|
irparams.rcvstate = STATE_IDLE;
|
||||||
|
irparams.rawlen = 0;
|
||||||
|
|
||||||
|
// Set pin modes
|
||||||
|
pinMode(irparams.recvpin, INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
//+=============================================================================
|
||||||
|
// Enable/disable blinking of pin 13 on IR processing
|
||||||
|
//
|
||||||
|
void IRrecv::blink13 (int blinkflag)
|
||||||
|
{
|
||||||
|
irparams.blinkflag = blinkflag;
|
||||||
|
if (blinkflag) pinMode(BLINKLED, OUTPUT) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+=============================================================================
|
||||||
|
// Restart the ISR state machine
|
||||||
|
//
|
||||||
|
void IRrecv::resume ( )
|
||||||
|
{
|
||||||
|
irparams.rcvstate = STATE_IDLE;
|
||||||
|
irparams.rawlen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// hashdecode - decode an arbitrary IR code.
|
// hashdecode - decode an arbitrary IR code.
|
||||||
// Instead of decoding using a standard encoding scheme
|
// Instead of decoding using a standard encoding scheme
|
||||||
|
|||||||
Reference in New Issue
Block a user