Merge pull request #201 from AnalysIR/master

Updates to IRremote.h, irSend.cpp. by @AnalysIR
This commit is contained in:
Rafi Khan
2015-08-19 17:07:35 -06:00
2 changed files with 11 additions and 10 deletions

View File

@@ -255,9 +255,9 @@ class IRsend
void custom_delay_usec (unsigned long uSecs); void custom_delay_usec (unsigned long uSecs);
void enableIROut (int khz) ; void enableIROut (int khz) ;
void mark (int usec) ; void mark (unsigned int usec) ;
void space (int usec) ; void space (unsigned int usec) ;
void sendRaw (unsigned int buf[], unsigned char len, unsigned char hz) ; void sendRaw (unsigned int buf[], unsigned int len, unsigned int hz) ;
//...................................................................... //......................................................................
# if SEND_RC5 # if SEND_RC5

View File

@@ -2,12 +2,12 @@
#include "IRremoteInt.h" #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 // Set IR carrier frequency
enableIROut(hz); enableIROut(hz);
for (unsigned char i = 0; i < len; i++) { for (unsigned int i = 0; i < len; i++) {
if (i & 1) space(buf[i]) ; if (i & 1) space(buf[i]) ;
else mark (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. // Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency. // 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 TIMER_ENABLE_PWM; // Enable pin 3 PWM output
if (time > 0) custom_delay_usec(time); 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. // Sends an IR space for the specified number of microseconds.
// A space is no output, so the PWM output is disabled. // 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 TIMER_DISABLE_PWM; // Disable pin 3 PWM output
if (time > 0) IRsend::custom_delay_usec(time); 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() > start ) {} // wait until overflow
} }
while ( micros() < endMicros ) {} // normal wait 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
//}
} }