Skip to content

Commit 1e72064

Browse files
committed
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"
1 parent 24d20e3 commit 1e72064

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

irSend.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
#include "IRremoteInt.h"
33

44
//+=============================================================================
5-
void IRsend::sendRaw (unsigned int buf[], unsigned char len, unsigned char hz)
5+
void IRsend::sendRaw (unsigned int buf[], unsigned int len, unsigned int hz)
66
{
77
// Set IR carrier frequency
88
enableIROut(hz);
99

10-
for (unsigned char i = 0; i < len; i++) {
10+
for (unsigned int i = 0; i < len; i++) {
1111
if (i & 1) space(buf[i]) ;
1212
else mark (buf[i]) ;
1313
}
@@ -19,7 +19,7 @@ void IRsend::sendRaw (unsigned int buf[], unsigned char len, unsigned char hz
1919
// Sends an IR mark for the specified number of microseconds.
2020
// The mark output is modulated at the PWM frequency.
2121
//
22-
void IRsend::mark (int time)
22+
void IRsend::mark (unsigned int time)
2323
{
2424
TIMER_ENABLE_PWM; // Enable pin 3 PWM output
2525
if (time > 0) custom_delay_usec(time);
@@ -30,7 +30,7 @@ void IRsend::mark (int time)
3030
// Sends an IR space for the specified number of microseconds.
3131
// A space is no output, so the PWM output is disabled.
3232
//
33-
void IRsend::space (int time)
33+
void IRsend::space (unsigned int time)
3434
{
3535
TIMER_DISABLE_PWM; // Disable pin 3 PWM output
3636
if (time > 0) IRsend::custom_delay_usec(time);
@@ -79,8 +79,9 @@ void IRsend::custom_delay_usec(unsigned long uSecs) {
7979
while ( micros() > start ) {} // wait until overflow
8080
}
8181
while ( micros() < endMicros ) {} // normal wait
82-
} else {
83-
__asm__("nop\n\t"); // must have or compiler optimizes out
84-
}
82+
}
83+
//else {
84+
// __asm__("nop\n\t"); // must have or compiler optimizes out
85+
//}
8586
}
8687

0 commit comments

Comments
 (0)