McMajan Library Pack  v 2.00
Improve your Arduino !
Ss_McIRDA.cpp
Go to the documentation of this file.
1 //#if defined(ARDUINO_ARCH_AVR)
2 
3 /*
4 McIRDA derived from old verion of IR_Remote by Ken Shirriff
5 This version is by Stefano Smania, www.mcmajan.com
6  */
7 
8 
9 #include "Ss_McIRDA_Int.h"
10 
11 
12 
13 
14 volatile irparams_t irparams;
15 
16 // These versions of MATCH, MATCH_MARK, and MATCH_SPACE are only for debugging.
17 // To use them, set McIRDA_DEBUG in McIRDAInt.h
18 // Normally macros are used for efficiency
19 #ifdef McIRDA_DEBUG
20 //#warning definisco funzioni McIRDA debug
21 unsigned int MATCH(unsigned int measured, unsigned int desired) {
22  Serial.print("Testing: ");
23  Serial.print(TICKS_LOW(desired), DEC);
24  Serial.print(" <= ");
25  Serial.print(measured, DEC);
26  Serial.print(" <= ");
27  Serial.println(TICKS_HIGH(desired), DEC);
28  return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
29 }
30 
31 unsigned int MATCH_MARK(unsigned int measured_ticks,unsigned int desired_us) {
32  Serial.print("Testing mark ");
33  Serial.print(measured_ticks * USECPERTICK, DEC);
34  Serial.print(" vs ");
35  Serial.print(desired_us, DEC);
36  Serial.print(": ");
37  Serial.print(TICKS_LOW(desired_us + MARK_EXCESS), DEC);
38  Serial.print(" <= ");
39  Serial.print(measured_ticks, DEC);
40  Serial.print(" <= ");
41  Serial.println(TICKS_HIGH(desired_us + MARK_EXCESS), DEC);
42  return measured_ticks >= TICKS_LOW(desired_us + MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS);
43 }
44 
45 unsigned int MATCH_SPACE(unsigned int measured_ticks,unsigned int desired_us) {
46  Serial.print("Testing space ");
47  Serial.print(measured_ticks * USECPERTICK, DEC);
48  Serial.print(" vs ");
49  Serial.print(desired_us, DEC);
50  Serial.print(": ");
51  Serial.print(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
52  Serial.print(" <= ");
53  Serial.print(measured_ticks, DEC);
54  Serial.print(" <= ");
55  Serial.println(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
56  return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
57 }
58 #else
59 
60 //#warning definisco funzioni McIRDA LINEARI
61 
62 unsigned int MATCH(unsigned int measured,unsigned int desired) {return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);}
63 unsigned int MATCH_MARK(unsigned int measured_ticks,unsigned int desired_us) {return MATCH(measured_ticks, (desired_us + MARK_EXCESS));}
64 unsigned int MATCH_SPACE(unsigned int measured_ticks, unsigned int desired_us) {return MATCH(measured_ticks, (desired_us - MARK_EXCESS));}
65 // Debugging versions are in McIRDA.cpp
66 
67 #endif
68 
69 
70 void IRsend::sendNEC(unsigned long data, int nbits)
71 {
72  enableIROut(38);
75  for (int i = 0; i < nbits; i++) {
76  if (data & TOPBIT) {
79  }
80  else {
83  }
84  data <<= 1;
85  }
87  space(0);
88 }
89 
90 
91 
92  void IRsend::sendSamsung(unsigned long data, int nbits)
93 {
94  enableIROut(38);
97  for (int i = 0; i < nbits; i++) {
98  if (data & TOPBIT) {
101  }
102  else {
105  }
106  data <<= 1;
107  }
109  space(0);
110 }
111 
112 
113 void IRsend::sendDaikinByte(uint8_t buf)
114 {
115  for(char bit=0;bit<8;bit++)
116  {
118  if((buf>>bit)&1) space(DAIKIN_ONE_SPACE);
119  else space(DAIKIN_ZERO_SPACE);
120 
121  }
122 
123 }
124 
126 {
127 int data2;
128  enableIROut(38);
129 
130  for(char i=0;i<5;i++)
131  {
134  }
135 
136  //-MARK_EXCESS
137 
138  mark(DAIKIN_MARK); //465
139  space(DAIKIN_LONG_SPACE); //24900
140 
141  mark(DAIKIN_LONG_MARK); //3400
143 
144  sendDaikinByte(0x11);
145  sendDaikinByte(0xDA);
146  sendDaikinByte(0x27);
147  sendDaikinByte(0x00);
148  sendDaikinByte(0xC5);
149  sendDaikinByte(0x10);
150  sendDaikinByte(0x00);
151  sendDaikinByte(0xE7);
152 
155 
156  mark(DAIKIN_LONG_MARK); //3400
158 
159  sendDaikinByte(0x11);
160  sendDaikinByte(0xDA);
161  sendDaikinByte(0x27);
162  sendDaikinByte(0x00);
163  sendDaikinByte(0x42);
164  sendDaikinByte(0x25);
165  sendDaikinByte(0x14);
166  sendDaikinByte(0x8D);
167 
168 
171 
172 
173  mark(DAIKIN_LONG_MARK); //3400
175 
176 
177  sendDaikinByte(0x11);
178  sendDaikinByte(0xDA);
179  sendDaikinByte(0x27);
180  sendDaikinByte(0x00);
181  sendDaikinByte(0x42);
182 sendDaikinByte(0x25);
183 sendDaikinByte(0x14);
184 sendDaikinByte(0x8D);
185 
186 
187 
188 // sequenza finale
189 sendDaikinByte(0x11);
190 sendDaikinByte(0xDA);
191 sendDaikinByte(0x27);
192 sendDaikinByte(0x00);
193 sendDaikinByte(0x00);
194 
195 
196  // dati veri e propri
197  sendDaikinByte(0x38); // on, timer off, mode cool
198  sendDaikinByte(0x50); //25gradi
199 
200 sendDaikinByte(0x00);
201 sendDaikinByte(0xA0);
202 sendDaikinByte(0x00);
203 sendDaikinByte(0x06);
204 sendDaikinByte(0x60);
205 
206 sendDaikinByte(0x00);
207 sendDaikinByte(0x00);
208 sendDaikinByte(0xC1);
209 
210 sendDaikinByte(0x80);
211 sendDaikinByte(0x00);
212 
213 //sendDaikinByte(0x67);
214 
215 
216 #define DAIKIN_ONE_SPACE 1270
217 #define DAIKIN_ZERO_SPACE 425
218 
221 
224 
227 
230 
233 
236 
239 
240 
241 
242 
243  }
244 
245 
246 
247 void IRsend::sendSony(unsigned long data, int nbits) {
248  enableIROut(40);
251  data = data << (32 - nbits);
252  for (int i = 0; i < nbits; i++) {
253  if (data & TOPBIT) {
256  }
257  else {
260  }
261  data <<= 1;
262  }
263 }
264 
265 
266 void IRsend::sendRaw(unsigned int buf[], int len, int hz)
267 {
268  enableIROut(hz);
269  for (int i = 0; i < len; i++) {
270  if (i & 1) {
271  space(buf[i]);
272  }
273  else {
274  mark(buf[i]);
275  }
276  }
277  space(0); // Just to be sure
278 }
279 
280 
281 // Note: first bit must be a one (start bit)
282 void IRsend::sendRC5(unsigned long data, int nbits)
283 {
284  enableIROut(36);
285  data = data << (32 - nbits);
286  mark(RC5_T1); // First start bit
287  space(RC5_T1); // Second start bit
288  mark(RC5_T1); // Second start bit
289  for (int i = 0; i < nbits; i++) {
290  if (data & TOPBIT) {
291  space(RC5_T1); // 1 is space, then mark
292  mark(RC5_T1);
293  }
294  else {
295  mark(RC5_T1);
297  }
298  data <<= 1;
299  }
300  space(0); // Turn off at end
301 }
302 
303 
304 
305 // Caller needs to take care of flipping the toggle bit
306 void IRsend::sendRC6(unsigned long data, int nbits)
307 {
308  enableIROut(36);
309  data = data << (32 - nbits);
312  mark(RC6_T1); // start bit
314  int t;
315  for (int i = 0; i < nbits; i++) {
316  if (i == 3) {
317  // double-wide trailer bit
318  t = 2 * RC6_T1;
319  }
320  else {
321  t = RC6_T1;
322  }
323  if (data & TOPBIT) {
324  mark(t);
325  space(t);
326  }
327  else {
328  space(t);
329  mark(t);
330  }
331 
332  data <<= 1;
333  }
334  space(0); // Turn off at end
335 }
336 
337 
338 
339 void IRsend::sendPanasonic(unsigned int address, unsigned long data) {
340  enableIROut(35);
343 
344  for(int i=0;i<16;i++)
345  {
347  if (address & 0x8000) {
349  } else {
351  }
352  address <<= 1;
353  }
354  for (int i=0; i < 32; i++) {
356  if (data & TOPBIT) {
358  } else {
360  }
361  data <<= 1;
362  }
364  space(0);
365 }
366 
367 
368 void IRsend::sendJVC(unsigned long data, int nbits, int repeat)
369 {
370  enableIROut(38);
371  data = data << (32 - nbits);
372  if (!repeat){
375  }
376  for (int i = 0; i < nbits; i++) {
377  if (data & TOPBIT) {
380  }
381  else {
384  }
385  data <<= 1;
386  }
388  space(0);
389 }
390 
391 void LongMicroDelay(unsigned int micros)
392 {
393  if(micros>16383)
394  {
395  uint8_t cicli=micros/16383;
396  unsigned int resto=micros%16383;
397  for(uint8_t i=0;i<cicli;i++) delayMicroseconds(16383);
398  delayMicroseconds(resto);
399  }
400  else delayMicroseconds(micros);
401 
402 /*if (micros > 16383) {
403  int millis = micros - (micros % 16000);
404  micros -= millis;
405  millis /= 1000;
406  delay(millis);
407  }
408  delayMicroseconds(micros);*/
409 
410 
411 }
412 
413 void IRsend::mark(unsigned int time) {
414  // Sends an IR mark for the specified number of microseconds.
415  // The mark output is modulated at the PWM frequency.
416  TIMER_ENABLE_PWM; // Enable pin 3 PWM output
417  //delayMicroseconds(time);
418  #ifdef USE_DAIKIN_FTX
419  LongMicroDelay(time+20);
420  #else
421  LongMicroDelay(time);
422  #endif
423 
424  #ifdef McIRDA_DEBUG
425  Serial.print("M: ");
426  Serial.println(time, DEC);
427  #endif
428  }
429 
430 /* Leave pin off for time (given in microseconds) */
431 void IRsend::space(unsigned int time)
432 {
433  // Sends an IR space for the specified number of microseconds.
434  // A space is no output, so the PWM output is disabled.
435  TIMER_DISABLE_PWM; // Disable pin 3 PWM output
436  //delayMicroseconds(time);
437  #ifdef USE_DAIKIN_FTX
438  LongMicroDelay(time+20);
439  #else
440  LongMicroDelay(time);
441  #endif
442  #ifdef McIRDA_DEBUG
443  Serial.print("S: ");
444  Serial.println(time, DEC);
445  #endif
446 }
447 
448 void IRsend::enableIROut(int khz) {
449  // Enables IR output. The khz value controls the modulation frequency in kilohertz.
450  // The IR output will be on pin 3 (OC2B).
451  // This routine is designed for 36-40KHz; if you use it for other values, it's up to you
452  // to make sure it gives reasonable results. (Watch out for overflow / underflow / rounding.)
453  // TIMER2 is used in phase-correct PWM mode, with OCR2A controlling the frequency and OCR2B
454  // controlling the duty cycle.
455  // There is no prescaling, so the output frequency is 16MHz / (2 * OCR2A)
456  // To turn the output on and off, we leave the PWM running, but connect and disconnect the output pin.
457  // A few hours staring at the ATmega documentation and this will all make sense.
458  // See my Secrets of Arduino PWM at http://arcfn.com/2009/07/secrets-of-arduino-pwm.html for details.
459 
460 
461  // Disable the Timer2 Interrupt (which is used for receiving IR)
462  TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt
463 
464  pinMode(TIMER_PWM_PIN, OUTPUT);
465  digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low
466 
467  // COM2A = 00: disconnect OC2A
468  // COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
469  // WGM2 = 101: phase-correct PWM with OCRA as top
470  // CS2 = 000: no prescaling
471  // The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A.
472  TIMER_CONFIG_KHZ(khz);
473 }
474 
475 IRrecv::IRrecv(int recvpin)
476 {
477  irparams.recvpin = recvpin;
478  irparams.blinkflag = 0;
479 }
480 
481 // initialization
483  cli();
484  // setup pulse clock timer interrupt
485  //Prescale /8 (16M/8 = 0.5 microseconds per tick)
486  // Therefore, the timer interval can range from 0.5 to 128 microseconds
487  // depending on the reset value (255 to 0)
489 
490  //Timer2 Overflow Interrupt Enable
492 
493  TIMER_RESET;
494 
495  sei(); // enable interrupts
496 
497  // initialize state machine variables
498  irparams.rcvstate = STATE_IDLE;
499  irparams.rawlen = 0;
500 
501  // set pin modes
502  pinMode(irparams.recvpin, INPUT);
503 }
504 
505 // enable/disable blinking of pin 13 on IR processing
506 void IRrecv::blink13(int blinkflag)
507 {
508  irparams.blinkflag = blinkflag;
509  if (blinkflag)
510  pinMode(BLINKLED, OUTPUT);
511 }
512 
513 // TIMER2 interrupt code to collect raw data.
514 // Widths of alternating SPACE, MARK are recorded in rawbuf.
515 // Recorded in ticks of 50 microseconds.
516 // rawlen counts the number of entries recorded so far.
517 // First entry is the SPACE between transmissions.
518 // As soon as a SPACE gets long, ready is set, state switches to IDLE, timing of SPACE continues.
519 // As soon as first MARK arrives, gap width is recorded, ready is cleared, and new logging starts
521 {
522  TIMER_RESET;
523 
524  uint8_t irdata = (uint8_t)digitalRead(irparams.recvpin);
525 
526  irparams.timer++; // One more 50us tick
527  if (irparams.rawlen >= RAWBUF) {
528  // Buffer overflow
529  irparams.rcvstate = STATE_STOP;
530  }
531  switch(irparams.rcvstate) {
532  case STATE_IDLE: // In the middle of a gap
533  if (irdata == MARK)
534  {
535  if (irparams.timer < GAP_TICKS) {
536  // Not big enough to be a gap.
537  irparams.timer = 0;
538  }
539  else {
540  // gap just ended, record duration and start recording transmission
541  irparams.rawlen = 0;
542  irparams.rawbuf[irparams.rawlen++] = irparams.timer;
543  irparams.timer = 0;
544  irparams.rcvstate = STATE_MARK;
545  }
546  }
547  break;
548  case STATE_MARK: // timing MARK
549  if (irdata == SPACE) { // MARK ended, record time
550  irparams.rawbuf[irparams.rawlen++] = irparams.timer;
551  irparams.timer = 0;
552  irparams.rcvstate = STATE_SPACE;
553  }
554  break;
555  case STATE_SPACE: // timing SPACE
556  if (irdata == MARK) { // SPACE just ended, record it
557  irparams.rawbuf[irparams.rawlen++] = irparams.timer;
558  irparams.timer = 0;
559  irparams.rcvstate = STATE_MARK;
560  }
561  else { // SPACE
562  if (irparams.timer > GAP_TICKS) {
563  // big SPACE, indicates gap between codes
564  // Mark current code as ready for processing
565  // Switch to STOP
566  // Don't reset timer; keep counting space width
567  irparams.rcvstate = STATE_STOP;
568  }
569  }
570  break;
571  case STATE_STOP: // waiting, measuring gap
572  if (irdata == MARK) { // reset gap timer
573  irparams.timer = 0;
574  }
575  break;
576  }
577 
578  if (irparams.blinkflag) {
579  if (irdata == MARK) {
580  BLINKLED_ON(); // turn pin 13 LED on
581  }
582  else {
583  BLINKLED_OFF(); // turn pin 13 LED off
584  }
585  }
586 }
587 
588 void IRrecv::resume() {
589  irparams.rcvstate = STATE_IDLE;
590  irparams.rawlen = 0;
591 }
592 
593 
594 
595 // Decodes the received IR message
596 // Returns 0 if no data ready, 1 if data ready.
597 // Results of decoding are stored in results
598 int IRrecv::decode(decode_results *results) {
599  results->rawbuf = irparams.rawbuf;
600  results->rawlen = irparams.rawlen;
601  if (irparams.rcvstate != STATE_STOP) return ERR;
602 
603 
604 #ifdef USE_NEC
605  #ifdef McIRDA_DEBUG
606  Serial.println("Attempting NEC decode");
607  #endif
608  if (decodeNEC(results))return DECODED;
609 #endif
610 
611 #ifdef USE_SONY
612  #ifdef McIRDA_DEBUG
613  Serial.println("Attempting Sony decode");
614  #endif
615  if (decodeSony(results)) return DECODED;
616 #endif
617 
618 #ifdef USE_MITSUBISHI
619  #ifdef McIRDA_DEBUG
620  Serial.println("Attempting Mitsubishi decode");
621  #endif
622  if (decodeMitsubishi(results)) return DECODED;
623 #endif
624 
625 #ifdef USE_RC5
626  #ifdef McIRDA_DEBUG
627  Serial.println("Attempting RC5 decode");
628  #endif
629  if (decodeRC5(results)) return DECODED;
630 #endif
631 
632 #ifdef USE_RC6
633  #ifdef McIRDA_DEBUG
634  Serial.println("Attempting RC6 decode");
635  #endif
636  if (decodeRC6(results)) return DECODED;
637 #endif
638 
639 #ifdef USE_SAMSUNG
640  #ifdef McIRDA_DEBUG
641  Serial.println("Attempting Samsung decode");
642  #endif
643  if (decodeSamsung(results)) return DECODED;
644 #endif
645 
646 #ifdef USE_PANASONIC
647  #ifdef McIRDA_DEBUG
648  Serial.println("Attempting Panasonic decode");
649  #endif
650  if (decodePanasonic(results)) return DECODED;
651 #endif
652 #ifdef USE_JVC
653  #ifdef McIRDA_DEBUG
654  Serial.println("Attempting JVC decode");
655  #endif
656  if (decodeJVC(results)) return DECODED;
657 #endif
658 
659 #ifdef USE_SANYO
660  #ifdef McIRDA_DEBUG
661  Serial.println("Attempting Sanyo decode");
662  #endif
663  if (decodeSanyo(results)) return DECODED;
664 #endif
665 
666 
667 #ifdef USE_DAIKIN_FTX
668  #ifdef McIRDA_DEBUG
669  Serial.println("Attempting Daikin decode");
670  #endif
671  if (decodeDaikin(results)) return DECODED;
672 #endif
673 
674 
675 
676  // decodeHash returns a hash on any input.
677  // Thus, it needs to be last in the list.
678  // If you add any decodes, add them before this.
679  if (decodeHash(results)) {
680  return DECODED;
681  }
682  // Throw away and start over
683  resume();
684  return ERR;
685 }
686 
687 #ifdef USE_NEC
688 // NECs have a repeat only 4 items long
689 long IRrecv::decodeNEC(decode_results *results) {
690  long data = 0;
691  int offset = 1; // Skip first space
692  // Initial mark
693  if (!MATCH_MARK(results->rawbuf[offset], NEC_HDR_MARK)) {
694  return ERR;
695  }
696  offset++;
697  // Check for repeat
698  if (irparams.rawlen == 4 &&
699  MATCH_SPACE(results->rawbuf[offset], NEC_RPT_SPACE) &&
700  MATCH_MARK(results->rawbuf[offset+1], NEC_BIT_MARK)) {
701  results->bits = 0;
702  results->value = REPEAT;
703  results->decode_type = NEC;
704  return DECODED;
705  }
706  if (irparams.rawlen < 2 * NEC_BITS + 4) {
707  return ERR;
708  }
709  // Initial space
710  if (!MATCH_SPACE(results->rawbuf[offset], NEC_HDR_SPACE)) {
711  return ERR;
712  }
713  offset++;
714  for (int i = 0; i < NEC_BITS; i++) {
715  if (!MATCH_MARK(results->rawbuf[offset], NEC_BIT_MARK)) {
716  return ERR;
717  }
718  offset++;
719  if (MATCH_SPACE(results->rawbuf[offset], NEC_ONE_SPACE)) {
720  data = (data << 1) | 1;
721  }
722  else if (MATCH_SPACE(results->rawbuf[offset], NEC_ZERO_SPACE)) {
723  data <<= 1;
724  }
725  else {
726  return ERR;
727  }
728  offset++;
729  }
730  // Success
731  results->bits = NEC_BITS;
732  results->value = data;
733  results->decode_type = NEC;
734  return DECODED;
735 }
736 #endif
737 
738 #ifdef USE_SAMSUNG
739 long IRrecv::decodeSamsung(decode_results *results) {
740  long data = 0;
741  int offset = 1; // Skip first space
742  // Initial mark
743  if (!MATCH_MARK(results->rawbuf[offset], SAMSUNG_HDR_MARK)) {
744  return ERR;
745  }
746  offset++;
747 
748  // Check bits
749  if (irparams.rawlen < 2 * SAMSUNG_BITS + 4) {
750  return ERR;
751  }
752 
753  // Initial space
754  if (!MATCH_SPACE(results->rawbuf[offset], SAMSUNG_HDR_SPACE)) {
755  return ERR;
756  }
757  offset++;
758 
759  for (int i = 0; i < SAMSUNG_BITS; i++) {
760  if (!MATCH_MARK(results->rawbuf[offset], SAMSUNG_BIT_MARK)) {
761  return ERR;
762  }
763  offset++;
764  if (MATCH_SPACE(results->rawbuf[offset], SAMSUNG_ONE_SPACE)) {
765  data = (data << 1) | 1;
766  }
767  else if (MATCH_SPACE(results->rawbuf[offset], SAMSUNG_ZERO_SPACE)) {
768  data <<= 1;
769  }
770  else {
771  return ERR;
772  }
773  offset++;
774  }
775  // Success
776  results->bits = SAMSUNG_BITS;
777  results->value = data;
778  results->decode_type = SAMSUNG;
779  return DECODED;
780 }
781 #endif
782 
783 #ifdef USE_DAIKIN_FTX
784 long IRrecv::decodeDaikin(decode_results *results) {
785  unsigned int localbit = 0;
786  unsigned int offset = 1; // Skip first space
787  bool err=0;
788 
789  if (irparams.rawlen < 2 * DAIKIN_BITS + 4)
790  {
791  Serial.print("Err lunghezza ingresso - rawlen is: ");
792  Serial.print(irparams.rawlen, DEC);
793  Serial.print(" vs ");
794  Serial.println( 2 * DAIKIN_BITS + 4, DEC);
795  return ERR;
796  }
797  else
798  {
799  Serial.println("OK lunghezza ingresso ");
800  }
801 
802  #ifdef McIRDA_DEBUG
803  for (int i = 0; i < irparams.rawlen; i++) {Serial.print(USECPERTICK*results->rawbuf[i], DEC);Serial.print(" "); }
804  #endif
805 
806  Serial.println(" ");
807 
808  for(int i=0;i<37;i++) results->DaikinBuffer[i]=0;
809 
810 
811  for (int i = 0; i < DAIKIN_BITS; i++)
812  {
813  if (MATCH_MARK(results->rawbuf[offset], DAIKIN_MARK)) {err=1;}// Serial.println(" OK MATCH_MARK: ");
814  else if(MATCH_MARK(results->rawbuf[offset], DAIKIN_LONG_MARK)){err=1;}// Serial.println(" OK MATCH LONG MARK: ");
815  //else Serial.print(" ERROR MACH MARK");//return ERR;
816  else return ERR;
817 
818  offset++;
819 
820  if (MATCH_SPACE(results->rawbuf[offset], DAIKIN_ZERO_SPACE)) {
821  //data = (data << 1) | 1;
822  SetBitN(results->DaikinBuffer,localbit,0);
823  Serial.print("0 ");
824  }
825  else if (MATCH_SPACE(results->rawbuf[offset], DAIKIN_ONE_SPACE)) {
826  SetBitN(results->DaikinBuffer,localbit,1);//data <<= 1;
827  Serial.print("1 ");
828  }
829  else if (MATCH_SPACE(results->rawbuf[offset], DAIKIN_POST_SPACE)) {
830  SetBitN(results->DaikinBuffer,localbit,1);//data <<= 1;
831  Serial.print("X ");
832  //Serial.print(localbit, DEC);
833  }
834  else if (MATCH_SPACE(results->rawbuf[offset], DAIKIN_LONG_SPACE)) {
835  //data <<= 1;
836  SetBitN(results->DaikinBuffer,localbit,1);//data <<= 1;
837  Serial.print("Y ");
838  //Serial.print(localbit, DEC);
839  //Serial.println("OK. Match long space");
840  }
841  else if (MATCH_SPACE(results->rawbuf[offset], DAIKIN_VERY_LONG_SPACE)) {
842  //data <<= 1;
843  SetBitN(results->DaikinBuffer,localbit,1);//data <<= 1;
844  Serial.print("Z ");
845  //Serial.print(localbit, DEC);
846  //Serial.println("OK. Match long space");
847  }
848 
849 
850 
851  else
852  {
853  Serial.println("ERROR MACH SPACE:");
854  #ifdef McIRDA_DEBUG
855  Serial.println("TIKS: ");
856  Serial.print(results->rawbuf[offset], DEC);
857  Serial.println("TIME: ");
858  Serial.print(USECPERTICK*results->rawbuf[offset], DEC);
859  Serial.println("--");
860  #endif
861  return ERR;
862  }
863  localbit++;
864  offset++;
865  }
866 
867  // Success
868  results->bits = DAIKIN_BITS;
869  results->value = 0;
870  results->decode_type = DAIKIN;
871  return DECODED;
872 }
873 #endif
874 
875 
876 
877 #ifdef USE_SONY
878 long IRrecv::decodeSony(decode_results *results) {
879  long data = 0;
880  if (irparams.rawlen < 2 * SONY_BITS + 2) {
881  return ERR;
882  }
883  int offset = 0; // Dont skip first space, check its size
884 
885  // Some Sony's deliver repeats fast after first
886  // unfortunately can't spot difference from of repeat from two fast clicks
887  if (results->rawbuf[offset] < SONY_DOUBLE_SPACE_USECS) {
888  // Serial.print("IR Gap found: ");
889  results->bits = 0;
890  results->value = REPEAT;
891  results->decode_type = SANYO;
892  return DECODED;
893  }
894  offset++;
895 
896  // Initial mark
897  if (!MATCH_MARK(results->rawbuf[offset], SONY_HDR_MARK)) {
898  return ERR;
899  }
900  offset++;
901 
902  while (offset + 1 < irparams.rawlen) {
903  if (!MATCH_SPACE(results->rawbuf[offset], SONY_HDR_SPACE)) {
904  break;
905  }
906  offset++;
907  if (MATCH_MARK(results->rawbuf[offset], SONY_ONE_MARK)) {
908  data = (data << 1) | 1;
909  }
910  else if (MATCH_MARK(results->rawbuf[offset], SONY_ZERO_MARK)) {
911  data <<= 1;
912  }
913  else {
914  return ERR;
915  }
916  offset++;
917  }
918 
919  // Success
920  results->bits = (offset - 1) / 2;
921  if (results->bits < 12) {
922  results->bits = 0;
923  return ERR;
924  }
925  results->value = data;
926  results->decode_type = SONY;
927  return DECODED;
928 }
929 #endif
930 
931 #ifdef USE_SANYO
932 // I think this is a Sanyo decoder - serial = SA 8650B
933 // Looks like Sony except for timings, 48 chars of data and time/space different
934 long IRrecv::decodeSanyo(decode_results *results) {
935  long data = 0;
936  if (irparams.rawlen < 2 * SANYO_BITS + 2) {
937  return ERR;
938  }
939  int offset = 0; // Skip first space
940  // Initial space
941  /* Put this back in for debugging - note can't use #McIRDA_DEBUG as if Debug on we don't see the repeat cos of the delay
942  Serial.print("IR Gap: ");
943  Serial.println( results->rawbuf[offset]);
944  Serial.println( "test against:");
945  Serial.println(results->rawbuf[offset]);
946  */
947  if (results->rawbuf[offset] < SANYO_DOUBLE_SPACE_USECS) {
948  // Serial.print("IR Gap found: ");
949  results->bits = 0;
950  results->value = REPEAT;
951  results->decode_type = SANYO;
952  return DECODED;
953  }
954  offset++;
955 
956  // Initial mark
957  if (!MATCH_MARK(results->rawbuf[offset], SANYO_HDR_MARK)) {
958  return ERR;
959  }
960  offset++;
961 
962  // Skip Second Mark
963  if (!MATCH_MARK(results->rawbuf[offset], SANYO_HDR_MARK)) {
964  return ERR;
965  }
966  offset++;
967 
968  while (offset + 1 < irparams.rawlen) {
969  if (!MATCH_SPACE(results->rawbuf[offset], SANYO_HDR_SPACE)) {
970  break;
971  }
972  offset++;
973  if (MATCH_MARK(results->rawbuf[offset], SANYO_ONE_MARK)) {
974  data = (data << 1) | 1;
975  }
976  else if (MATCH_MARK(results->rawbuf[offset], SANYO_ZERO_MARK)) {
977  data <<= 1;
978  }
979  else {
980  return ERR;
981  }
982  offset++;
983  }
984 
985  // Success
986  results->bits = (offset - 1) / 2;
987  if (results->bits < 12) {
988  results->bits = 0;
989  return ERR;
990  }
991  results->value = data;
992  results->decode_type = SANYO;
993  return DECODED;
994 }
995 #endif
996 
997 //USE_MITSUBISHI
998 
999 #ifdef USE_MITSUBISHI
1000 // Looks like Sony except for timings, 48 chars of data and time/space different
1001 long IRrecv::decodeMitsubishi(decode_results *results) {
1002  // Serial.print("?!? decoding Mitsubishi:");Serial.print(irparams.rawlen); Serial.print(" want "); Serial.println( 2 * MITSUBISHI_BITS + 2);
1003  long data = 0;
1004  if (irparams.rawlen < 2 * MITSUBISHI_BITS + 2) {
1005  return ERR;
1006  }
1007  int offset = 0; // Skip first space
1008  // Initial space
1009  /* Put this back in for debugging - note can't use #McIRDA_DEBUG as if Debug on we don't see the repeat cos of the delay
1010  Serial.print("IR Gap: ");
1011  Serial.println( results->rawbuf[offset]);
1012  Serial.println( "test against:");
1013  Serial.println(results->rawbuf[offset]);
1014  */
1015  /* Not seeing double keys from Mitsubishi
1016  if (results->rawbuf[offset] < MITSUBISHI_DOUBLE_SPACE_USECS) {
1017  // Serial.print("IR Gap found: ");
1018  results->bits = 0;
1019  results->value = REPEAT;
1020  results->decode_type = MITSUBISHI;
1021  return DECODED;
1022  }
1023  */
1024  offset++;
1025 
1026  // Typical
1027  // 14200 7 41 7 42 7 42 7 17 7 17 7 18 7 41 7 18 7 17 7 17 7 18 7 41 8 17 7 17 7 18 7 17 7
1028 
1029  // Initial Space
1030  if (!MATCH_MARK(results->rawbuf[offset], MITSUBISHI_HDR_SPACE)) {
1031  return ERR;
1032  }
1033  offset++;
1034  while (offset + 1 < irparams.rawlen) {
1035  if (MATCH_MARK(results->rawbuf[offset], MITSUBISHI_ONE_MARK)) {
1036  data = (data << 1) | 1;
1037  }
1038  else if (MATCH_MARK(results->rawbuf[offset], MITSUBISHI_ZERO_MARK)) {
1039  data <<= 1;
1040  }
1041  else {
1042  // Serial.println("A"); Serial.println(offset); Serial.println(results->rawbuf[offset]);
1043  return ERR;
1044  }
1045  offset++;
1046  if (!MATCH_SPACE(results->rawbuf[offset], MITSUBISHI_HDR_SPACE)) {
1047  // Serial.println("B"); Serial.println(offset); Serial.println(results->rawbuf[offset]);
1048  break;
1049  }
1050  offset++;
1051  }
1052 
1053  // Success
1054  results->bits = (offset - 1) / 2;
1055  if (results->bits < MITSUBISHI_BITS) {
1056  results->bits = 0;
1057  return ERR;
1058  }
1059  results->value = data;
1060  results->decode_type = MITSUBISHI;
1061  return DECODED;
1062 }
1063 #endif
1064 
1065 // Gets one undecoded level at a time from the raw buffer.
1066 // The RC5/6 decoding is easier if the data is broken into time intervals.
1067 // E.g. if the buffer has MARK for 2 time intervals and SPACE for 1,
1068 // successive calls to getRClevel will return MARK, MARK, SPACE.
1069 // offset and used are updated to keep track of the current position.
1070 // t1 is the time interval for a single bit in microseconds.
1071 // Returns -1 for error (measured time interval is not a multiple of t1).
1072 int IRrecv::getRClevel(decode_results *results, int *offset, int *used, int t1) {
1073  if (*offset >= results->rawlen) {
1074  // After end of recorded buffer, assume SPACE.
1075  return SPACE;
1076  }
1077  int width = results->rawbuf[*offset];
1078  int val = ((*offset) % 2) ? MARK : SPACE;
1079  int correction = (val == MARK) ? MARK_EXCESS : - MARK_EXCESS;
1080 
1081  int avail;
1082  if (MATCH(width, t1 + correction)) {
1083  avail = 1;
1084  }
1085  else if (MATCH(width, 2*t1 + correction)) {
1086  avail = 2;
1087  }
1088  else if (MATCH(width, 3*t1 + correction)) {
1089  avail = 3;
1090  }
1091  else {
1092  return -1;
1093  }
1094 
1095  (*used)++;
1096  if (*used >= avail) {
1097  *used = 0;
1098  (*offset)++;
1099  }
1100 #ifdef McIRDA_DEBUG
1101  if (val == MARK) {
1102  Serial.println("MARK");
1103  }
1104  else {
1105  Serial.println("SPACE");
1106  }
1107 #endif
1108  return val;
1109 }
1110 #ifdef USE_RC5
1111 long IRrecv::decodeRC5(decode_results *results) {
1112  if (irparams.rawlen < MIN_RC5_SAMPLES + 2) {
1113  return ERR;
1114  }
1115  int offset = 1; // Skip gap space
1116  long data = 0;
1117  int used = 0;
1118  // Get start bits
1119  if (getRClevel(results, &offset, &used, RC5_T1) != MARK) return ERR;
1120  if (getRClevel(results, &offset, &used, RC5_T1) != SPACE) return ERR;
1121  if (getRClevel(results, &offset, &used, RC5_T1) != MARK) return ERR;
1122  int nbits;
1123  for (nbits = 0; offset < irparams.rawlen; nbits++) {
1124  int levelA = getRClevel(results, &offset, &used, RC5_T1);
1125  int levelB = getRClevel(results, &offset, &used, RC5_T1);
1126  if (levelA == SPACE && levelB == MARK) {
1127  // 1 bit
1128  data = (data << 1) | 1;
1129  }
1130  else if (levelA == MARK && levelB == SPACE) {
1131  // zero bit
1132  data <<= 1;
1133  }
1134  else {
1135  return ERR;
1136  }
1137  }
1138 
1139  // Success
1140  results->bits = nbits;
1141  results->value = data;
1142  results->decode_type = RC5;
1143  return DECODED;
1144 }
1145 #endif
1146 
1147 #ifdef USE_RC6
1148 long IRrecv::decodeRC6(decode_results *results) {
1149  if (results->rawlen < MIN_RC6_SAMPLES) {
1150  return ERR;
1151  }
1152  int offset = 1; // Skip first space
1153  // Initial mark
1154  if (!MATCH_MARK(results->rawbuf[offset], RC6_HDR_MARK)) {
1155  return ERR;
1156  }
1157  offset++;
1158  if (!MATCH_SPACE(results->rawbuf[offset], RC6_HDR_SPACE)) {
1159  return ERR;
1160  }
1161  offset++;
1162  long data = 0;
1163  int used = 0;
1164  // Get start bit (1)
1165  if (getRClevel(results, &offset, &used, RC6_T1) != MARK) return ERR;
1166  if (getRClevel(results, &offset, &used, RC6_T1) != SPACE) return ERR;
1167  int nbits;
1168  for (nbits = 0; offset < results->rawlen; nbits++) {
1169  int levelA, levelB; // Next two levels
1170  levelA = getRClevel(results, &offset, &used, RC6_T1);
1171  if (nbits == 3) {
1172  // T bit is double wide; make sure second half matches
1173  if (levelA != getRClevel(results, &offset, &used, RC6_T1)) return ERR;
1174  }
1175  levelB = getRClevel(results, &offset, &used, RC6_T1);
1176  if (nbits == 3) {
1177  // T bit is double wide; make sure second half matches
1178  if (levelB != getRClevel(results, &offset, &used, RC6_T1)) return ERR;
1179  }
1180  if (levelA == MARK && levelB == SPACE) { // reversed compared to RC5
1181  // 1 bit
1182  data = (data << 1) | 1;
1183  }
1184  else if (levelA == SPACE && levelB == MARK) {
1185  // zero bit
1186  data <<= 1;
1187  }
1188  else {
1189  return ERR; // Error
1190  }
1191  }
1192  // Success
1193  results->bits = nbits;
1194  results->value = data;
1195  results->decode_type = RC6;
1196  return DECODED;
1197 }
1198 #endif
1199 #ifdef USE_PANASONIC
1200 long IRrecv::decodePanasonic(decode_results *results) {
1201  unsigned long long data = 0;
1202  int offset = 1;
1203 
1204  if (!MATCH_MARK(results->rawbuf[offset], PANASONIC_HDR_MARK)) {
1205  return ERR;
1206  }
1207  offset++;
1208  if (!MATCH_MARK(results->rawbuf[offset], PANASONIC_HDR_SPACE)) {
1209  return ERR;
1210  }
1211  offset++;
1212 
1213  // decode address
1214  for (int i = 0; i < PANASONIC_BITS; i++) {
1215  if (!MATCH_MARK(results->rawbuf[offset++], PANASONIC_BIT_MARK)) {
1216  return ERR;
1217  }
1218  if (MATCH_SPACE(results->rawbuf[offset],PANASONIC_ONE_SPACE)) {
1219  data = (data << 1) | 1;
1220  } else if (MATCH_SPACE(results->rawbuf[offset],PANASONIC_ZERO_SPACE)) {
1221  data <<= 1;
1222  } else {
1223  return ERR;
1224  }
1225  offset++;
1226  }
1227  results->value = (unsigned long)data;
1228  results->panasonicAddress = (unsigned int)(data >> 32);
1229  results->decode_type = PANASONIC;
1230  results->bits = PANASONIC_BITS;
1231  return DECODED;
1232 }
1233 #endif
1234 #ifdef USE_JVC
1235 long IRrecv::decodeJVC(decode_results *results) {
1236  long data = 0;
1237  int offset = 1; // Skip first space
1238  // Check for repeat
1239  if (irparams.rawlen - 1 == 33 &&
1240  MATCH_MARK(results->rawbuf[offset], JVC_BIT_MARK) &&
1242  results->bits = 0;
1243  results->value = REPEAT;
1244  results->decode_type = JVC;
1245  return DECODED;
1246  }
1247  // Initial mark
1248  if (!MATCH_MARK(results->rawbuf[offset], JVC_HDR_MARK)) {
1249  return ERR;
1250  }
1251  offset++;
1252  if (irparams.rawlen < 2 * JVC_BITS + 1 ) {
1253  return ERR;
1254  }
1255  // Initial space
1256  if (!MATCH_SPACE(results->rawbuf[offset], JVC_HDR_SPACE)) {
1257  return ERR;
1258  }
1259  offset++;
1260  for (int i = 0; i < JVC_BITS; i++) {
1261  if (!MATCH_MARK(results->rawbuf[offset], JVC_BIT_MARK)) {
1262  return ERR;
1263  }
1264  offset++;
1265  if (MATCH_SPACE(results->rawbuf[offset], JVC_ONE_SPACE)) {
1266  data = (data << 1) | 1;
1267  }
1268  else if (MATCH_SPACE(results->rawbuf[offset], JVC_ZERO_SPACE)) {
1269  data <<= 1;
1270  }
1271  else {
1272  return ERR;
1273  }
1274  offset++;
1275  }
1276  //Stop bit
1277  if (!MATCH_MARK(results->rawbuf[offset], JVC_BIT_MARK)){
1278  return ERR;
1279  }
1280  // Success
1281  results->bits = JVC_BITS;
1282  results->value = data;
1283  results->decode_type = JVC;
1284  return DECODED;
1285 }
1286 #endif
1287 
1288 /* -----------------------------------------------------------------------
1289  * hashdecode - decode an arbitrary IR code.
1290  * Instead of decoding using a standard encoding scheme
1291  * (e.g. Sony, NEC, RC5), the code is hashed to a 32-bit value.
1292  *
1293  * The algorithm: look at the sequence of MARK signals, and see if each one
1294  * is shorter (0), the same length (1), or longer (2) than the previous.
1295  * Do the same with the SPACE signals. Hszh the resulting sequence of 0's,
1296  * 1's, and 2's to a 32-bit value. This will give a unique value for each
1297  * different code (probably), for most code systems.
1298  *
1299  * http://arcfn.com/2010/01/using-arbitrary-remotes-with-arduino.html
1300  */
1301 
1302 // Compare two tick values, returning 0 if newval is shorter,
1303 // 1 if newval is equal, and 2 if newval is longer
1304 // Use a tolerance of 20%
1305 int IRrecv::compare(unsigned int oldval, unsigned int newval) {
1306  if (newval < oldval * .8) {
1307  return 0;
1308  }
1309  else if (oldval < newval * .8) {
1310  return 2;
1311  }
1312  else {
1313  return 1;
1314  }
1315 }
1316 
1317 // Use FNV hash algorithm: http://isthe.com/chongo/tech/comp/fnv/#FNV-param
1318 #define FNV_PRIME_32 16777619
1319 #define FNV_BASIS_32 2166136261
1320 
1321 /* Converts the raw code values into a 32-bit hash code.
1322  * Hopefully this code is unique for each button.
1323  * This isn't a "real" decoding, just an arbitrary value.
1324  */
1325 long IRrecv::decodeHash(decode_results *results) {
1326  // Require at least 6 samples to prevent triggering on noise
1327  if (results->rawlen < 6) {
1328  return ERR;
1329  }
1330  long hash = FNV_BASIS_32;
1331  for (int i = 1; i+2 < results->rawlen; i++) {
1332  int value = compare(results->rawbuf[i], results->rawbuf[i+2]);
1333  // Add value into the hash
1334  hash = (hash * FNV_PRIME_32) ^ value;
1335  }
1336  results->value = hash;
1337  results->bits = 32;
1338  results->decode_type = UNKNOWN;
1339  return DECODED;
1340 }
1341 
1342 /* Sharp and DISH support by Todd Treece ( http://unionbridge.org/design/ircommand )
1343 
1344 The Dish send function needs to be repeated 4 times, and the Sharp function
1345 has the necessary repeat built in because of the need to invert the signal.
1346 
1347 Sharp protocol documentation:
1348 http://www.sbprojects.com/knowledge/ir/sharp.htm
1349 
1350 Here are the LIRC files that I found that seem to match the remote codes
1351 from the oscilloscope:
1352 
1353 Sharp LCD TV:
1354 http://lirc.sourceforge.net/remotes/sharp/GA538WJSA
1355 
1356 DISH NETWORK (echostar 301):
1357 http://lirc.sourceforge.net/remotes/echostar/301_501_3100_5100_58xx_59xx
1358 
1359 For the DISH codes, only send the last for characters of the hex.
1360 i.e. use 0x1C10 instead of 0x0000000000001C10 which is listed in the
1361 linked LIRC file.
1362 */
1363 
1364 void IRsend::sendSharp(unsigned long data, int nbits) {
1365  unsigned long invertdata = data ^ SHARP_TOGGLE_MASK;
1366  enableIROut(38);
1367  for (int i = 0; i < nbits; i++) {
1368  if (data & 0x4000) {
1371  }
1372  else {
1375  }
1376  data <<= 1;
1377  }
1378 
1381  delay(46);
1382  for (int i = 0; i < nbits; i++) {
1383  if (invertdata & 0x4000) {
1386  }
1387  else {
1390  }
1391  invertdata <<= 1;
1392  }
1395  delay(46);
1396 }
1397 
1398 
1399 void IRsend::sendDISH(unsigned long data, int nbits)
1400 {
1401  enableIROut(56);
1404  for (int i = 0; i < nbits; i++) {
1405  if (data & DISH_TOP_BIT) {
1408  }
1409  else {
1412  }
1413  data <<= 1;
1414  }
1415 }
1416 
1417 
1418 
1419 /*
1420 #elif defined(ARDUINO_ARCH_SAM)
1421  #error Arduino SAM family is not supported by McIRDA
1422 #else
1423  #error Yor platform is not supported by McIRDA
1424 #endif
1425  */
#define JVC_BIT_MARK
void sendSharp(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:1364
#define JVC
Definition: Ss_McIRDA.h:48
void enableIRIn()
Definition: Ss_McIRDA.cpp:482
#define SAMSUNG_HDR_SPACE
#define PANASONIC_HDR_MARK
#define JVC_HDR_MARK
unsigned long value
Definition: Ss_McIRDA.h:34
#define BLINKLED
#define DAIKIN_POST_SPACE
#define DISH_TOP_BIT
#define FNV_BASIS_32
Definition: Ss_McIRDA.cpp:1319
#define DAIKIN_LONG_SPACE
#define PANASONIC_ZERO_SPACE
#define DAIKIN_VERY_LONG_SPACE
#define NEC_HDR_SPACE
#define SAMSUNG
Definition: Ss_McIRDA.h:51
#define STATE_STOP
#define TICKS_HIGH(us)
#define TICKS_LOW(us)
#define TIMER_ENABLE_INTR
IRrecv(int recvpin)
Definition: Ss_McIRDA.cpp:475
#define MITSUBISHI
Definition: Ss_McIRDA.h:50
#define RC6_HDR_SPACE
#define SAMSUNG_HDR_MARK
#define SANYO_BITS
#define TIMER_CONFIG_KHZ(val)
#define DAIKIN_LONG_MARK
#define USECPERTICK
Definition: Ss_McIRDA.h:154
void enableIROut(int khz)
Definition: Ss_McIRDA.cpp:448
#define TIMER_RESET
#define MIN_RC6_SAMPLES
#define PANASONIC_BIT_MARK
void sendDaikinByte(uint8_t)
Definition: Ss_McIRDA.cpp:113
volatile unsigned int * rawbuf
Definition: Ss_McIRDA.h:36
void sendRC5(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:282
#define TIMER_DISABLE_PWM
#define BLINKLED_OFF()
#define NEC_HDR_MARK
#define RC6_HDR_MARK
#define STATE_MARK
#define MITSUBISHI_ZERO_MARK
#define SONY_HDR_SPACE
#define NEC_ONE_SPACE
#define DISH_ZERO_SPACE
#define UNKNOWN
Definition: Ss_McIRDA.h:53
#define DISH_BIT_MARK
#define MITSUBISHI_ONE_MARK
#define GAP_TICKS
void sendRaw(unsigned int buf[], int len, int hz)
Definition: Ss_McIRDA.cpp:266
#define MARK_EXCESS
Definition: Ss_McIRDA.h:163
#define SHARP_TOGGLE_MASK
#define TOPBIT
#define RC5
Definition: Ss_McIRDA.h:43
#define DAIKIN_ZERO_SPACE
#define MARK
#define SAMSUNG_BIT_MARK
#define SANYO_ONE_MARK
#define SHARP_BIT_MARK
#define NEC_RPT_SPACE
#define NEC_BITS
void sendDISH(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:1399
#define TIMER_DISABLE_INTR
#define SPACE
#define PANASONIC_ONE_SPACE
#define REPEAT
Definition: Ss_McIRDA.h:56
void blink13(int blinkflag)
Definition: Ss_McIRDA.cpp:506
#define FNV_PRIME_32
Definition: Ss_McIRDA.cpp:1318
#define JVC_BITS
unsigned int rawlen
unsigned int MATCH_SPACE(unsigned int measured_ticks, unsigned int desired_us)
Definition: Ss_McIRDA.cpp:45
#define BLINKLED_ON()
#define MIN_RC5_SAMPLES
#define TIMER_CONFIG_NORMAL()
#define PANASONIC_BITS
void sendDaikin()
Definition: Ss_McIRDA.cpp:125
#define SONY_ONE_MARK
#define NEC_ZERO_SPACE
#define RC6
Definition: Ss_McIRDA.h:44
#define NEC
Definition: Ss_McIRDA.h:41
void sendPanasonic(unsigned int address, unsigned long data)
Definition: Ss_McIRDA.cpp:339
#define SHARP_ONE_SPACE
#define NEC_BIT_MARK
#define JVC_HDR_SPACE
#define RAWBUF
Definition: Ss_McIRDA.h:158
void sendJVC(unsigned long data, int nbits, int repeat)
Definition: Ss_McIRDA.cpp:368
unsigned int MATCH_MARK(unsigned int measured_ticks, unsigned int desired_us)
Definition: Ss_McIRDA.cpp:31
#define SAMSUNG_BITS
#define TIMER_ENABLE_PWM
#define DISH_HDR_SPACE
#define ERR
#define JVC_ZERO_SPACE
unsigned int panasonicAddress
Definition: Ss_McIRDA.h:29
#define SAMSUNG_ONE_SPACE
#define SONY_HDR_MARK
void sendSony(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:247
volatile irparams_t irparams
Definition: Ss_McIRDA.cpp:14
#define SANYO
Definition: Ss_McIRDA.h:49
unsigned int MATCH(unsigned int measured, unsigned int desired)
Definition: Ss_McIRDA.cpp:21
#define STATE_SPACE
void sendRC6(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:306
#define TIMER_INTR_NAME
#define DAIKIN_MARK
#define DAIKIN_ONE_SPACE
#define STATE_IDLE
#define DISH_ONE_SPACE
VIRTUAL void space(unsigned int usec)
Definition: Ss_McIRDA.cpp:431
void resume()
Definition: Ss_McIRDA.cpp:588
#define JVC_ONE_SPACE
#define SANYO_HDR_SPACE
int decode(decode_results *results)
Definition: Ss_McIRDA.cpp:598
#define RC5_T1
#define DISH_HDR_MARK
#define SANYO_HDR_MARK
#define TIMER_PWM_PIN
VIRTUAL void mark(unsigned int usec)
Definition: Ss_McIRDA.cpp:413
#define SANYO_ZERO_MARK
#define DECODED
void LongMicroDelay(unsigned int micros)
Definition: Ss_McIRDA.cpp:391
#define MITSUBISHI_BITS
#define PANASONIC_HDR_SPACE
#define SAMSUNG_ZERO_SPACE
void sendSamsung(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:92
#define RC6_T1
#define SANYO_DOUBLE_SPACE_USECS
#define SHARP_ZERO_SPACE
#define MITSUBISHI_HDR_SPACE
#define PANASONIC
Definition: Ss_McIRDA.h:47
unsigned int rawbuf[RAWBUF]
void sendNEC(unsigned long data, int nbits)
Definition: Ss_McIRDA.cpp:70
#define SONY_ZERO_MARK