Skip to content

Commit 5719e7c

Browse files
committed
sendSharp API change to make it compatible with decodeSharp
1 parent 95f93e6 commit 5719e7c

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

IRremote.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,7 @@ i.e. use 0x1C10 instead of 0x0000000000001C10 which is listed in the
11061106
linked LIRC file.
11071107
*/
11081108

1109-
void IRsend::sendSharp(unsigned long data, int nbits) {
1110-
unsigned long invertdata = data ^ SHARP_TOGGLE_MASK;
1109+
void IRsend::sendSharpRaw(unsigned long data, int nbits) {
11111110
enableIROut(38);
11121111

11131112
// Sending codes in bursts of 3 (normal, inverted, normal) makes transmission
@@ -1132,8 +1131,12 @@ void IRsend::sendSharp(unsigned long data, int nbits) {
11321131
}
11331132
}
11341133

1135-
void IRsend::sendDISH(unsigned long data, int nbits)
1136-
{
1134+
// Sharp send compatible with data obtained through decodeSharp
1135+
void IRsend::sendSharp(unsigned int address, unsigned int command) {
1136+
sendSharpRaw((address << 10) | (command << 2) | 2, 15);
1137+
}
1138+
1139+
void IRsend::sendDISH(unsigned long data, int nbits) {
11371140
enableIROut(56);
11381141
mark(DISH_HDR_MARK);
11391142
space(DISH_HDR_SPACE);

IRremote.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
class decode_results {
2929
public:
3030
int decode_type; // NEC, SONY, RC5, UNKNOWN
31-
unsigned int panasonicAddress; // This is only used for decoding Panasonic data
31+
union { // This is used for decoding Panasonic and Sharp data
32+
unsigned int panasonicAddress;
33+
unsigned int sharpAddress;
34+
};
3235
unsigned long value; // Decoded value
3336
int bits; // Number of bits in decoded value
3437
volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
@@ -101,7 +104,8 @@ class IRsend
101104
void sendRC5(unsigned long data, int nbits);
102105
void sendRC6(unsigned long data, int nbits);
103106
void sendDISH(unsigned long data, int nbits);
104-
void sendSharp(unsigned long data, int nbits);
107+
void sendSharp(unsigned int address, unsigned int command);
108+
void sendSharpRaw(unsigned long data, int nbits);
105109
void sendPanasonic(unsigned int address, unsigned long data);
106110
void sendJVC(unsigned long data, int nbits, int repeat); // *Note instead of sending the REPEAT constant if you want the JVC repeat signal sent, send the original code value and change the repeat argument from 0 to 1. JVC protocol repeats by skipping the header NOT by sending a separate code value like NEC does.
107111
// private:

0 commit comments

Comments
 (0)