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:
parent
845e912e9f
commit
4e5608f25f
|
@ -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
|
||||
- [Neco777](https://github.com/neco777) : 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.
|
||||
|
||||
|
|
|
@ -142,6 +142,22 @@ void dumpCode (decode_results *results)
|
|||
|
||||
// Newline
|
||||
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 "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
|
||||
// Returns 0 if no data ready, 1 if data ready.
|
||||
|
@ -142,6 +90,58 @@ int IRrecv::decode (decode_results *results)
|
|||
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.
|
||||
// Instead of decoding using a standard encoding scheme
|
||||
|
|
|
@ -59,7 +59,7 @@ void IRsend::enableIROut (int khz)
|
|||
// COM2A = 00: disconnect OC2A
|
||||
// COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
|
||||
// WGM2 = 101: phase-correct PWM with OCRA as top
|
||||
// CS2 = 000: no prescaling
|
||||
// CS2 = 000: no prescaling
|
||||
// The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A.
|
||||
TIMER_CONFIG_KHZ(khz);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue