3 #ifdef SENDING_SUPPORTED
5 void IRsend::sendRaw(
const unsigned int buf[],
unsigned int len,
unsigned int hz) {
9 for (
unsigned int i = 0; i < len; i++) {
27 for (
unsigned int i = 0; i < len; i++) {
28 uint16_t duration = pgm_read_word_near(buf +
sizeof(uint16_t) * i);
40 #ifdef USE_SOFT_CARRIER
41 void inline IRsend::sleepMicros(
unsigned long us) {
43 sleepUntilMicros(micros() + us);
46 delayMicroseconds((
unsigned int) us);
51 void inline IRsend::sleepUntilMicros(
unsigned long targetTime) {
53 while (micros() < targetTime)
56 unsigned long now = micros();
57 if (now < targetTime) {
58 sleepMicros(targetTime - now);
62 #endif // USE_SOFT_CARRIER
70 #ifdef USE_SOFT_CARRIER
71 unsigned long start = micros();
72 unsigned long stop = start + time;
73 if (stop + periodTime < start) {
78 unsigned long nextPeriodEnding = start;
79 unsigned long now = micros();
82 sleepMicros (periodOnTime);
84 nextPeriodEnding += periodTime;
85 sleepUntilMicros(nextPeriodEnding);
88 #elif defined(USE_NO_CARRIER)
89 digitalWrite(sendPin, LOW);
104 #if defined(USE_NO_CARRIER)
105 digitalWrite(sendPin, HIGH);
114 #ifdef USE_DEFAULT_ENABLE_IR_OUT
128 #ifdef USE_SOFT_CARRIER
129 periodTime = (1000U + khz / 2) / khz;
133 #if defined(USE_NO_CARRIER)
134 pinMode(sendPin, OUTPUT);
135 digitalWrite(sendPin, HIGH);
140 pinMode(sendPin, OUTPUT);
149 TIMER_CONFIG_KHZ(khz);
159 unsigned long start = micros();
160 unsigned long endMicros = start + uSecs - 4;
161 if (endMicros < start) {
162 while (micros() > start) {
165 while (micros() < endMicros) {
173 #endif // SENDING_SUPPORTED