mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-13 01:46:21 +00:00
Add Sharp and DISH transmission support.
This change is from Todd Treece: http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html?showComment=1264093513759#c3138785324309374640
This commit is contained in:
72
IRremote.cpp
72
IRremote.cpp
@@ -652,3 +652,75 @@ long IRrecv::decodeHash(decode_results *results) {
|
|||||||
results->decode_type = UNKNOWN;
|
results->decode_type = UNKNOWN;
|
||||||
return DECODED;
|
return DECODED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sharp and DISH support by Todd Treece
|
||||||
|
|
||||||
|
The Dish send function needs to be repeated 4 times and the Sharp function
|
||||||
|
has the necessary repeats built in. I know that it's not consistent,
|
||||||
|
but I don't have the time to update my code.
|
||||||
|
|
||||||
|
Here are the LIRC files that I found that seem to match the remote codes
|
||||||
|
from the oscilloscope:
|
||||||
|
|
||||||
|
Sharp LCD TV:
|
||||||
|
http://lirc.sourceforge.net/remotes/sharp/GA538WJSA
|
||||||
|
|
||||||
|
DISH NETWORK (echostar 301):
|
||||||
|
http://lirc.sourceforge.net/remotes/echostar/301_501_3100_5100_58xx_59xx
|
||||||
|
|
||||||
|
For the DISH codes, only send the last for characters of the hex.
|
||||||
|
i.e. use 0x1C10 instead of 0x0000000000001C10 which is listed in the
|
||||||
|
linked LIRC file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void IRsend::sendSharp(unsigned long data, int nbits) {
|
||||||
|
unsigned long invertdata = data ^ SHARP_TOGGLE_MASK;
|
||||||
|
enableIROut(38);
|
||||||
|
for (int i = 0; i < nbits; i++) {
|
||||||
|
if (data & 0x4000) {
|
||||||
|
mark(SHARP_BIT_MARK);
|
||||||
|
space(SHARP_ONE_SPACE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mark(SHARP_BIT_MARK);
|
||||||
|
space(SHARP_ZERO_SPACE);
|
||||||
|
}
|
||||||
|
data <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mark(SHARP_BIT_MARK);
|
||||||
|
space(SHARP_ZERO_SPACE);
|
||||||
|
delay(46);
|
||||||
|
for (int i = 0; i < nbits; i++) {
|
||||||
|
if (invertdata & 0x4000) {
|
||||||
|
mark(SHARP_BIT_MARK);
|
||||||
|
space(SHARP_ONE_SPACE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mark(SHARP_BIT_MARK);
|
||||||
|
space(SHARP_ZERO_SPACE);
|
||||||
|
}
|
||||||
|
invertdata <<= 1;
|
||||||
|
}
|
||||||
|
mark(SHARP_BIT_MARK);
|
||||||
|
space(SHARP_ZERO_SPACE);
|
||||||
|
delay(46);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IRsend::sendDISH(unsigned long data, int nbits)
|
||||||
|
{
|
||||||
|
enableIROut(56);
|
||||||
|
mark(DISH_HDR_MARK);
|
||||||
|
space(DISH_HDR_SPACE);
|
||||||
|
for (int i = 0; i < nbits; i++) {
|
||||||
|
if (data & DISH_TOP_BIT) {
|
||||||
|
mark(DISH_BIT_MARK);
|
||||||
|
space(DISH_ONE_SPACE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mark(DISH_BIT_MARK);
|
||||||
|
space(DISH_ZERO_SPACE);
|
||||||
|
}
|
||||||
|
data <<= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public:
|
|||||||
#define SONY 2
|
#define SONY 2
|
||||||
#define RC5 3
|
#define RC5 3
|
||||||
#define RC6 4
|
#define RC6 4
|
||||||
|
#define DISH 5
|
||||||
|
#define SHARP 6
|
||||||
#define UNKNOWN -1
|
#define UNKNOWN -1
|
||||||
|
|
||||||
// Decoded value for NEC when a repeat code is received
|
// Decoded value for NEC when a repeat code is received
|
||||||
@@ -78,6 +80,8 @@ public:
|
|||||||
void sendRaw(unsigned int buf[], int len, int hz);
|
void sendRaw(unsigned int buf[], int len, int hz);
|
||||||
void sendRC5(unsigned long data, int nbits);
|
void sendRC5(unsigned long data, int nbits);
|
||||||
void sendRC6(unsigned long data, int nbits);
|
void sendRC6(unsigned long data, int nbits);
|
||||||
|
void sendDISH(unsigned long data, int nbits);
|
||||||
|
void sendSharp(unsigned long data, int nbits);
|
||||||
// private:
|
// private:
|
||||||
void enableIROut(int khz);
|
void enableIROut(int khz);
|
||||||
VIRTUAL void mark(int usec);
|
VIRTUAL void mark(int usec);
|
||||||
|
|||||||
@@ -59,6 +59,24 @@
|
|||||||
#define RC6_T1 444
|
#define RC6_T1 444
|
||||||
#define RC6_RPT_LENGTH 46000
|
#define RC6_RPT_LENGTH 46000
|
||||||
|
|
||||||
|
#define SHARP_BIT_MARK 245
|
||||||
|
#define SHARP_ONE_SPACE 1805
|
||||||
|
#define SHARP_ZERO_SPACE 795
|
||||||
|
#define SHARP_GAP 600000
|
||||||
|
#define SHARP_TOGGLE_MASK 0x3FF
|
||||||
|
#define SHARP_RPT_SPACE 3000
|
||||||
|
|
||||||
|
#define DISH_HDR_MARK 400
|
||||||
|
#define DISH_HDR_SPACE 6100
|
||||||
|
#define DISH_BIT_MARK 400
|
||||||
|
#define DISH_ONE_SPACE 1700
|
||||||
|
#define DISH_ZERO_SPACE 2800
|
||||||
|
#define DISH_RPT_SPACE 6200
|
||||||
|
#define DISH_TOP_BIT 0x8000
|
||||||
|
|
||||||
|
#define SHARP_BITS 15
|
||||||
|
#define DISH_BITS 16
|
||||||
|
|
||||||
#define TOLERANCE 25 // percent tolerance in measurements
|
#define TOLERANCE 25 // percent tolerance in measurements
|
||||||
#define LTOL (1.0 - TOLERANCE/100.)
|
#define LTOL (1.0 - TOLERANCE/100.)
|
||||||
#define UTOL (1.0 + TOLERANCE/100.)
|
#define UTOL (1.0 + TOLERANCE/100.)
|
||||||
|
|||||||
Reference in New Issue
Block a user