From 7925fcd36baa6fc3a920933888ad9283a4a40963 Mon Sep 17 00:00:00 2001 From: AnalysIR Date: Wed, 19 Aug 2015 23:17:03 +0100 Subject: [PATCH 1/2] changes to senRAW, mark,space,custom_delay_usec parameters changed from int to unsigned int to allow longer mark/space durations and signal length.hz changed to allow for potential future use of 455kHz carrier frequency. (Ther may be existing modes to the library, using this frequency) removed "asm" workaround for compiler, because it was not need ed on my system. Original autor should verify this again. It could be alternatice compiler optimization settings? Alternatively, place the volatile keyword before the variables in the function to avoid the "optimization out" --- irSend.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/irSend.cpp b/irSend.cpp index 0b2e119..1340e63 100644 --- a/irSend.cpp +++ b/irSend.cpp @@ -2,12 +2,12 @@ #include "IRremoteInt.h" //+============================================================================= -void IRsend::sendRaw (unsigned int buf[], unsigned char len, unsigned char hz) +void IRsend::sendRaw (unsigned int buf[], unsigned int len, unsigned int hz) { // Set IR carrier frequency enableIROut(hz); - for (unsigned char i = 0; i < len; i++) { + for (unsigned int i = 0; i < len; i++) { if (i & 1) space(buf[i]) ; else mark (buf[i]) ; } @@ -19,7 +19,7 @@ void IRsend::sendRaw (unsigned int buf[], unsigned char len, unsigned char hz // Sends an IR mark for the specified number of microseconds. // The mark output is modulated at the PWM frequency. // -void IRsend::mark (int time) +void IRsend::mark (unsigned int time) { TIMER_ENABLE_PWM; // Enable pin 3 PWM output if (time > 0) custom_delay_usec(time); @@ -30,7 +30,7 @@ void IRsend::mark (int time) // Sends an IR space for the specified number of microseconds. // A space is no output, so the PWM output is disabled. // -void IRsend::space (int time) +void IRsend::space (unsigned int time) { TIMER_DISABLE_PWM; // Disable pin 3 PWM output if (time > 0) IRsend::custom_delay_usec(time); @@ -79,8 +79,9 @@ void IRsend::custom_delay_usec(unsigned long uSecs) { while ( micros() > start ) {} // wait until overflow } while ( micros() < endMicros ) {} // normal wait - } else { - __asm__("nop\n\t"); // must have or compiler optimizes out - } + } + //else { + // __asm__("nop\n\t"); // must have or compiler optimizes out + //} } From b00f6ad5e14f36e10dc20c68bfc890186af451fc Mon Sep 17 00:00:00 2001 From: AnalysIR Date: Wed, 19 Aug 2015 23:24:59 +0100 Subject: [PATCH 2/2] Update parameters for mark,space and sendraw parameters changed from int to unsigned int to allow longer mark/space durations and signal length. hz changed to allow for potential future use of 455kHz carrier frequency. (Ther may be existing modes to the library, using this frequency) --- IRremote.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IRremote.h b/IRremote.h index fcfb0b8..898bd15 100644 --- a/IRremote.h +++ b/IRremote.h @@ -255,9 +255,9 @@ class IRsend void custom_delay_usec (unsigned long uSecs); void enableIROut (int khz) ; - void mark (int usec) ; - void space (int usec) ; - void sendRaw (unsigned int buf[], unsigned char len, unsigned char hz) ; + void mark (unsigned int usec) ; + void space (unsigned int usec) ; + void sendRaw (unsigned int buf[], unsigned int len, unsigned int hz) ; //...................................................................... # if SEND_RC5