From 5c217f0ee928a93596c05b11a57cd2037bfc1b24 Mon Sep 17 00:00:00 2001 From: Bluechip Date: Sat, 20 Jun 2015 18:27:10 +0100 Subject: [PATCH] Abbreviated (Panasonic) address handling --- IRremote.h | 63 ++++++++++++++++++++++++++---------------------- ir_Panasonic.cpp | 8 +++--- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/IRremote.h b/IRremote.h index a45605c..6507f9d 100644 --- a/IRremote.h +++ b/IRremote.h @@ -69,42 +69,47 @@ int MATCH (int measured, int desired) ; // #define TEST //------------------------------------------------------------------------------ -enum decode_type_t { - UNKNOWN = -1, - UNUSED = 0, - NEC = 1, - SONY = 2, - RC5 = 3, - RC6 = 4, - DISH = 5, - SHARP = 6, - PANASONIC = 7, - JVC = 8, - SANYO = 9, - MITSUBISHI = 10, - SAMSUNG = 11, - LG = 12, - WHYNTER = 13, - AIWA_RC_T501 = 14, -}; +// An enumerated list of all supported formats +// +typedef + enum { + UNKNOWN = -1, + UNUSED = 0, + NEC = 1, + SONY = 2, + RC5 = 3, + RC6 = 4, + DISH = 5, + SHARP = 6, + PANASONIC = 7, + JVC = 8, + SANYO = 9, + MITSUBISHI = 10, + SAMSUNG = 11, + LG = 12, + WHYNTER = 13, + AIWA_RC_T501 = 14, + } +decode_type_t; //------------------------------------------------------------------------------ // Results returned from the decoder -class decode_results { -public: - decode_type_t decode_type; // NEC, SONY, RC5, UNKNOWN - 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 - int rawlen; // Number of records in rawbuf. +// +class decode_results +{ + public: + decode_type_t decode_type; // UNKNOWN, NEC, SONY, RC5, ... + unsigned int address; // Used by Panasonic & Sharp + unsigned long value; // Decoded value + int bits; // Number of bits in decoded value + volatile unsigned int *rawbuf; // Raw intervals in 50uS ticks + int rawlen; // Number of records in rawbuf. + int overflow; // true iff IR raw code too long }; //------------------------------------------------------------------------------ // Decoded value for NEC when a repeat code is received +// #define REPEAT 0xffffffff //------------------------------------------------------------------------------ diff --git a/ir_Panasonic.cpp b/ir_Panasonic.cpp index 494c28d..8d88ade 100644 --- a/ir_Panasonic.cpp +++ b/ir_Panasonic.cpp @@ -69,10 +69,10 @@ long IRrecv::decodePanasonic (decode_results *results) offset++; } - results->value = (unsigned long)data; - results->panasonicAddress = (unsigned int)(data >> 32); - results->decode_type = PANASONIC; - results->bits = PANASONIC_BITS; + results->value = (unsigned long)data; + results->address = (unsigned int)(data >> 32); + results->decode_type = PANASONIC; + results->bits = PANASONIC_BITS; return true; }