Skip to content

Commit 6510b2c

Browse files
committed
1 parent e12e9ea commit 6510b2c

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

IRremote.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,75 @@ long IRrecv::decodeHash(decode_results *results) {
652652
results->decode_type = UNKNOWN;
653653
return DECODED;
654654
}
655+
656+
/* Sharp and DISH support by Todd Treece
657+
658+
The Dish send function needs to be repeated 4 times and the Sharp function
659+
has the necessary repeats built in. I know that it's not consistent,
660+
but I don't have the time to update my code.
661+
662+
Here are the LIRC files that I found that seem to match the remote codes
663+
from the oscilloscope:
664+
665+
Sharp LCD TV:
666+
http://lirc.sourceforge.net/remotes/sharp/GA538WJSA
667+
668+
DISH NETWORK (echostar 301):
669+
http://lirc.sourceforge.net/remotes/echostar/301_501_3100_5100_58xx_59xx
670+
671+
For the DISH codes, only send the last for characters of the hex.
672+
i.e. use 0x1C10 instead of 0x0000000000001C10 which is listed in the
673+
linked LIRC file.
674+
*/
675+
676+
void IRsend::sendSharp(unsigned long data, int nbits) {
677+
unsigned long invertdata = data ^ SHARP_TOGGLE_MASK;
678+
enableIROut(38);
679+
for (int i = 0; i < nbits; i++) {
680+
if (data & 0x4000) {
681+
mark(SHARP_BIT_MARK);
682+
space(SHARP_ONE_SPACE);
683+
}
684+
else {
685+
mark(SHARP_BIT_MARK);
686+
space(SHARP_ZERO_SPACE);
687+
}
688+
data <<= 1;
689+
}
690+
691+
mark(SHARP_BIT_MARK);
692+
space(SHARP_ZERO_SPACE);
693+
delay(46);
694+
for (int i = 0; i < nbits; i++) {
695+
if (invertdata & 0x4000) {
696+
mark(SHARP_BIT_MARK);
697+
space(SHARP_ONE_SPACE);
698+
}
699+
else {
700+
mark(SHARP_BIT_MARK);
701+
space(SHARP_ZERO_SPACE);
702+
}
703+
invertdata <<= 1;
704+
}
705+
mark(SHARP_BIT_MARK);
706+
space(SHARP_ZERO_SPACE);
707+
delay(46);
708+
}
709+
710+
void IRsend::sendDISH(unsigned long data, int nbits)
711+
{
712+
enableIROut(56);
713+
mark(DISH_HDR_MARK);
714+
space(DISH_HDR_SPACE);
715+
for (int i = 0; i < nbits; i++) {
716+
if (data & DISH_TOP_BIT) {
717+
mark(DISH_BIT_MARK);
718+
space(DISH_ONE_SPACE);
719+
}
720+
else {
721+
mark(DISH_BIT_MARK);
722+
space(DISH_ZERO_SPACE);
723+
}
724+
data <<= 1;
725+
}
726+
}

IRremote.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class decode_results {
3535
#define SONY 2
3636
#define RC5 3
3737
#define RC6 4
38+
#define DISH 5
39+
#define SHARP 6
3840
#define UNKNOWN -1
3941

4042
// Decoded value for NEC when a repeat code is received
@@ -78,6 +80,8 @@ class IRsend
7880
void sendRaw(unsigned int buf[], int len, int hz);
7981
void sendRC5(unsigned long data, int nbits);
8082
void sendRC6(unsigned long data, int nbits);
83+
void sendDISH(unsigned long data, int nbits);
84+
void sendSharp(unsigned long data, int nbits);
8185
// private:
8286
void enableIROut(int khz);
8387
VIRTUAL void mark(int usec);

IRremoteInt.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@
5959
#define RC6_T1444
6060
#define RC6_RPT_LENGTH46000
6161

62+
#define SHARP_BIT_MARK 245
63+
#define SHARP_ONE_SPACE 1805
64+
#define SHARP_ZERO_SPACE 795
65+
#define SHARP_GAP 600000
66+
#define SHARP_TOGGLE_MASK 0x3FF
67+
#define SHARP_RPT_SPACE 3000
68+
69+
#define DISH_HDR_MARK 400
70+
#define DISH_HDR_SPACE 6100
71+
#define DISH_BIT_MARK 400
72+
#define DISH_ONE_SPACE 1700
73+
#define DISH_ZERO_SPACE 2800
74+
#define DISH_RPT_SPACE 6200
75+
#define DISH_TOP_BIT 0x8000
76+
77+
#define SHARP_BITS 15
78+
#define DISH_BITS 16
79+
6280
#define TOLERANCE 25 // percent tolerance in measurements
6381
#define LTOL (1.0 - TOLERANCE/100.)
6482
#define UTOL (1.0 + TOLERANCE/100.)

0 commit comments

Comments
 (0)