From 5719e7c00fc71997f5ca4b366280ff9b26770904 Mon Sep 17 00:00:00 2001 From: Piotr Dobrowolski Date: Wed, 17 Sep 2014 21:31:53 +0200 Subject: [PATCH] sendSharp API change to make it compatible with decodeSharp --- IRremote.cpp | 11 +++++++---- IRremote.h | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/IRremote.cpp b/IRremote.cpp index 2c0f90d..f8ccedb 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -1106,8 +1106,7 @@ 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; +void IRsend::sendSharpRaw(unsigned long data, int nbits) { enableIROut(38); // Sending codes in bursts of 3 (normal, inverted, normal) makes transmission @@ -1132,8 +1131,12 @@ void IRsend::sendSharp(unsigned long data, int nbits) { } } -void IRsend::sendDISH(unsigned long data, int nbits) -{ +// Sharp send compatible with data obtained through decodeSharp +void IRsend::sendSharp(unsigned int address, unsigned int command) { + sendSharpRaw((address << 10) | (command << 2) | 2, 15); +} + +void IRsend::sendDISH(unsigned long data, int nbits) { enableIROut(56); mark(DISH_HDR_MARK); space(DISH_HDR_SPACE); diff --git a/IRremote.h b/IRremote.h index e4463e8..17d5e81 100644 --- a/IRremote.h +++ b/IRremote.h @@ -28,7 +28,10 @@ class decode_results { public: int decode_type; // NEC, SONY, RC5, UNKNOWN - unsigned int panasonicAddress; // This is only used for decoding Panasonic data + union { // This is used for decoding Panasonic and Sharp data + unsigned int panasonicAddress; + unsigned int sharpAddress; + }; unsigned long value; // Decoded value int bits; // Number of bits in decoded value volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks @@ -101,7 +104,8 @@ public: void sendRC5(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); + void sendSharp(unsigned int address, unsigned int command); + void sendSharpRaw(unsigned long data, int nbits); void sendPanasonic(unsigned int address, unsigned long data); 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. // private: