diff --git a/Contributors.md b/Contributors.md index 2bb8d9d..4a9b88d 100644 --- a/Contributors.md +++ b/Contributors.md @@ -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. diff --git a/examples/IRrecvDumpV2/IRrecvDumpV2.ino b/examples/IRrecvDumpV2/IRrecvDumpV2.ino index a610bff..a2add9f 100644 --- a/examples/IRrecvDumpV2/IRrecvDumpV2.ino +++ b/examples/IRrecvDumpV2/IRrecvDumpV2.ino @@ -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(";"); + } } //+============================================================================= diff --git a/irRecv.cpp b/irRecv.cpp index d3a7060..4614020 100644 --- a/irRecv.cpp +++ b/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 diff --git a/irSend.cpp b/irSend.cpp index df3b1d9..1ec97a5 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -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); }