10000 merging 110 · githubgrax/Arduino-IRremote@117059a · GitHub
[go: up one dir, main page]

Skip to content

Commit 117059a

Browse files
committed
merging 110
2 parents ce1c79b + 549d92d commit 117059a

File tree

3 files changed

+147
-8
lines changed

3 files changed

+147
-8
lines changed

IRremote.cpp

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ int MATCH_SPACE(int measured_ticks, int desired_us) {return MATCH(measured_ticks
7474
// Debugging versions are in IRremote.cpp
7575
#endif
7676

77+
#ifdef NEC
7778
void IRsend::sendNEC(unsigned long data, int nbits)
7879
{
7980
enableIROut(38);
@@ -93,7 +94,9 @@ void IRsend::sendNEC(unsigned long data, int nbits)
9394
mark(NEC_BIT_MARK);
9495
space(0);
9596
}
97+
#endif
9698

99+
#ifdef WHYNTER
97100
void IRsend::sendWhynter(unsigned long data, int nbits) {
98101
enableIROut(38);
99102
mark(WHYNTER_ZERO_MARK);
@@ -114,7 +117,9 @@ void IRsend::sendWhynter(unsigned long data, int nbits) {
114117
mark(WHYNTER_ZERO_MARK);
115118
space(WHYNTER_ZERO_SPACE);
116119
}
120+
#endif
117121

122+
#ifdef SONY
118123
void IRsend::sendSony(unsigned long data, int nbits) {
119124
enableIROut(40);
120125
mark(SONY_HDR_MARK);
@@ -132,6 +137,7 @@ void IRsend::sendSony(unsigned long data, int nbits) {
132137
data <<= 1;
133138
}
134139
}
140+
#endif
135141

136142
void IRsend::sendRaw(unsigned int buf[], int len, int hz)
137143
{
@@ -200,6 +206,8 @@ void IRsend::sendRC6(unsigned long data, int nbits)
200206
}
201207
space(0); // Turn off at end
202208
}
209+
210+
#ifdef PANASONIC
203211
void IRsend::sendPanasonic(unsigned int address, unsigned long data) {
204212
enableIROut(35);
205213
mark(PANASONIC_HDR_MARK);
@@ -227,6 +235,9 @@ void IRsend::sendPanasonic(unsigned int address, unsigned long data) {
227235
mark(PANASONIC_BIT_MARK);
228236
space(0);
229237
}
238+
#endif
239+
240+
#ifdef JVC
230241
void IRsend::sendJVC(unsigned long data, int nbits, int repeat)
231242
{
232243
enableIROut(38);
@@ -249,7 +260,9 @@ void IRsend::sendJVC(unsigned long data, int nbits, int repeat)
249260
mark(JVC_BIT_MARK);
250261
space(0);
251262
}
263+
#endif
252264

265+
#ifdef SAMSUNG
253266
void IRsend::sendSAMSUNG(unsigned long data, int nbits)
254267
{
255268
enableIROut(38);
@@ -269,6 +282,7 @@ void IRsend::sendSAMSUNG(unsigned long data, int nbits)
269282
mark(SAMSUNG_BIT_MARK);
270283
space(0);
271284
}
285+
#endif
272286

273287
void IRsend::mark(int time) {
274288
// Sends an IR mark for the specified number of microseconds.
@@ -440,48 +454,70 @@ int IRrecv::decode(decode_results *results) {
440454
if (irparams.rcvstate != STATE_STOP) {
441455
return ERR;
442456
}
457+
#ifdef NEC
443458
#ifdef DEBUG
444459
Serial.println("Attempting NEC decode");
445460
#endif
446461
if (decodeNEC(results)) {
447462
return DECODED;
448463
}
464+
#endif
465+
466+
#ifdef SONY
449467
#ifdef DEBUG
450468
Serial.println("Attempting Sony decode");
451469
#endif
452470
if (decodeSony(results)) {
453471
return DECODED;
454472
}
473+
#endif
474+
475+
#ifdef SANYO
455476
#ifdef DEBUG
456477
Serial.println("Attempting Sanyo decode");
457478
#endif
458479
if (decodeSanyo(results)) {
459480
return DECODED;
460481
}
482+
#endif
483+
484+
#ifdef MITSUBISHI
461485
#ifdef DEBUG
462486
Serial.println("Attempting Mitsubishi decode");
463487
#endif
464488
if (decodeMitsubishi(results)) {
465489
return DECODED;
466490
}
491+
#endif
492+
493+
#ifdef RC5
467494
#ifdef DEBUG
468495
Serial.println("Attempting RC5 decode");
469496
#endif
470497
if (decodeRC5(results)) {
471498
return DECODED;
472499
}
500+
#endif
501+
502+
#ifdef RC6
473503
#ifdef DEBUG
474504
Serial.println("Attempting RC6 decode");
475505
#endif
476506
if (decodeRC6(results)) {
477507
return DECODED;
478508
}
509+
#endif
510+
511+
#ifdef PANASONIC
479512
#ifdef DEBUG
480513
Serial.println("Attempting Panasonic decode");
481514
#endif
482515
if (decodePanasonic(results)) {
483516
return DECODED;
484517
}
518+
#endif
519+
520+
#ifdef JVC
485521
#ifdef DEBUG
486522
Serial.println("Attempting LG decode");
487523
#endif
@@ -494,6 +530,9 @@ int IRrecv::decode(decode_results *results) {
494530
if (decodeJVC(results)) {
495531
return DECODED;
496532
}
533+
#endif
534+
535+
#ifdef SAMSUNG
497536
#ifdef DEBUG
498537
Serial.println("Attempting SAMSUNG decode");
499538
#endif
@@ -507,12 +546,15 @@ int IRrecv::decode(decode_results *results) {
507546
return DECODED;
508547
}
509548
// Aiwa RC-T501
549+
#ifdef AIWA_RC_T501
510550
#ifdef DEBUG
511551
Serial.println("Attempting Aiwa RC-T501 decode");
512552
#endif
513553
if (decodeAiwaRCT501(results)) {
514554
return DECODED;
515555
}
556+
#endif
557+
516558
// decodeHash returns a hash on any input.
517559
// Thus, it needs to be last in the list.
518560
// If you add any decodes, add them before this.
@@ -524,6 +566,7 @@ int IRrecv::decode(decode_results *results) {
524566
return ERR;
525567
}
526568

569+
#ifdef NEC
527570
// NECs have a repeat only 4 items long
528571
long IRrecv::decodeNEC(decode_results *results) {
529572
long data = 0;
@@ -572,7 +615,9 @@ long IRrecv::decodeNEC(decode_results *results) {
572615
results->decode_type = NEC;
573616
return DECODED;
574617
}
618+
#endif
575619

620+
#ifdef SONY
576621
long IRrecv::decodeSony(decode_results *results) {
577622
long data = 0;
578623
if (irparams.rawlen < 2 * SONY_BITS + 2) {
@@ -586,7 +631,11 @@ long IRrecv::decodeSony(decode_results *results) {
586631
// Serial.print("IR Gap found: ");
587632
results->bits = 0;
588633
results->value = REPEAT;
634+
#ifdef SANYO
589635
results->decode_type = SANYO;
636+
#else
637+
results->decode_type = UNKNOWN;
638+
#endif
590639
return DECODED;
591640
}
592641
offset++;
@@ -624,6 +673,7 @@ long IRrecv::decodeSony(decode_results *results) {
624673
results->decode_type = SONY;
625674
return DECODED;
626675
}
676+
#endif
627677

628678
long IRrecv::decodeWhynter(decode_results *results) {
629679
long data = 0;
@@ -684,6 +734,7 @@ long IRrecv::decodeWhynter(decode_results *results) {
684734
}
685735

686736

737+
#ifdef SANYO
687738
// I think this is a Sanyo decoder - serial = SA 8650B
688739
// Looks like Sony except for timings, 48 chars of data and time/space different
689740
long IRrecv::decodeSanyo(decode_results *results) {
@@ -747,7 +798,9 @@ long IRrecv::decodeSanyo(decode_results *results) {
747798
results->decode_type = SANYO;
748799
return DECODED;
749800
}
801 1C6A +
#endif
750802

803+
#ifdef MITSUBISHI
751804
// Looks like Sony except for timings, 48 chars of data and time/space different
752805
long IRrecv::decodeMitsubishi(decode_results *results) {
753806
// Serial.print("?!? decoding Mitsubishi:");Serial.print(irparams.rawlen); Serial.print(" want "); Serial.println( 2 * MITSUBISHI_BITS + 2);
@@ -811,7 +864,7 @@ long IRrecv::decodeMitsubishi(decode_results *results) {
811864
results->decode_type = MITSUBISHI;
812865
return DECODED;
813866
}
814-
867+
#endif
815868

816869
// Gets one undecoded level at a time from the raw buffer.
817870
// The RC5/6 decoding is easier if the data is broken into time intervals.
@@ -858,6 +911,7 @@ int IRrecv::getRClevel(decode_results *results, int *offset, int *used, int t1)
858911
#endif
859912
return val;
860913
}
914+
#endif
861915

862916
long IRrecv::decodeRC5(decode_results *results) {
863917
if (irparams.rawlen < MIN_RC5_SAMPLES + 2) {
@@ -944,6 +998,8 @@ long IRrecv::decodeRC6(decode_results *results) {
944998
results->decode_type = RC6;
945999
return DECODED;
9461000
}
1001+
1002+
#ifdef PANASONIC
9471003
long IRrecv::decodePanasonic(decode_results *results) {
9481004
unsigned long long data = 0;
9491005
int offset = 1;
@@ -977,7 +1033,9 @@ long IRrecv::decodePanasonic(decode_results *results) {
9771033
results->bits = PANASONIC_BITS;
9781034
return DECODED;
9791035
}
1036+
#endif
9801037

1038+
#ifdef LG
9811039
long IRrecv::decodeLG(decode_results *results) {
9821040
long data = 0;
9831041
int offset = 1; // Skip first space
@@ -1023,6 +1081,9 @@ long IRrecv::decodeLG(decode_results *results) {
10231081
}
10241082

10251083

1084+
#endif
1085+
1086+
#ifdef JVC
10261087
long IRrecv::decodeJVC(decode_results *results) {
10271088
long data = 0;
10281089
int offset = 1; // Skip first space
@@ -1074,7 +1135,9 @@ long IRrecv::decodeJVC(decode_results *results) {
10741135
results->decode_type = JVC;
10751136
return DECODED;
10761137
}
1138+
#endif
10771139

1140+
#ifdef SAMSUNG
10781141
// SAMSUNGs have a repeat only 4 items long
10791142
long IRrecv::decodeSAMSUNG(decode_results *results) {
10801143
long data = 0;
@@ -1123,13 +1186,15 @@ long IRrecv::decodeSAMSUNG(decode_results *results) {
11231186
results->decode_type = SAMSUNG;
11241187
return DECODED;
11251188
}
1189+
#endif
11261190

11271191
/**
11281192
* Aiwa system
11291193
* Remote control RC-T501
11301194
* Lirc file http://lirc.sourceforge.net/remotes/aiwa/RC-T501
11311195
*
11321196
*/
1197+
#ifdef AIWA_RC_T501
11331198
long IRrecv::decodeAiwaRCT501(decode_results *results) {
11341199
int data = 0;
11351200
int offset = 1; // skip first garbage read
@@ -1183,6 +1248,8 @@ long IRrecv::decodeAiwaRCT501(decode_results *results) {
11831248
return DECODED;
11841249
}
11851250

1251+
#endif
1252+
11861253
/* -----------------------------------------------------------------------
11871254
* hashdecode - decode an arbitrary IR code.
11881255
* Instead of decoding using a standard encoding scheme
@@ -1259,7 +1326,9 @@ i.e. use 0x1C10 instead of 0x0000000000001C10 which is listed in the
12591326
linked LIRC file.
12601327
*/
12611328

1262-
void IRsend::sendSharpRaw(unsigned long data, int nbits) {
1329+
#ifdef IRsendSHARP
1330+
void IRsend::sendSharp(unsigned long data, int nbits) {
1331+
unsigned long invertdata = data ^ SHARP_TOGGLE_MASK;
12631332
enableIROut(38);
12641333

12651334
// Sending codes in bursts of 3 (normal, inverted, normal) makes transmission
@@ -1289,7 +1358,11 @@ void IRsend::sendSharp(unsigned int address, unsigned int command) {
12891358
sendSharpRaw((address << 10) | (command << 2) | 2, 15);
12901359
}
12911360

1292-
void IRsend::sendDISH(unsigned long data, int nbits) {
1361+
#endif
1362+
1363+
#ifdef IRsendDISH
1364+
void IRsend::sendDISH(unsigned long data, int nbits)
1365+
{
12931366
enableIROut(56);
12941367
mark(DISH_HDR_MARK);
12951368
space(DISH_HDR_SPACE);
@@ -1305,13 +1378,15 @@ void IRsend::sendDISH(unsigned long data, int nbits) {
13051378
data <<= 1;
13061379
}
13071380
}
1308-
1381+
#endif
13091382
/**
13101383
* Aiwa system
13111384
* Remote control RC-T501
13121385
* Lirc file http://lirc.sourceforge.net/remotes/aiwa/RC-T501
13131386
*
13141387
*/
1388+
1389+
#ifdef AIWA_RC_T501
13151390
void IRsend::sendAiwaRCT501(int code) {
13161391
// PRE-DATA, 26 bits, 0x227EEC0
13171392
long int pre = 0x227EEC0;
@@ -1354,4 +1429,5 @@ void IRsend::sendAiwaRCT501(int code) {
13541429

13551430
mark(AIWA_RC_T501_BIT_MARK);
13561431
space(0);
1357-
}
1432+
}
1433+
#endif

0 commit comments

Comments
 (0)
0