Add Denon support

Improve comments
Fixup DECODE_AIWA_RC_T50
Simplify template
This commit is contained in:
Bluechip
2015-06-21 01:20:44 +01:00
parent 89d82ad930
commit 87639f8b45
5 changed files with 135 additions and 25 deletions

View File

@@ -102,16 +102,16 @@ Regards,
//
//==============================================================================
#define SHUZU_BITS 32 // The number of bits in the command
#define BITS 32 // The number of bits in the command
#define SHUZU_HDR_MARK 1000 // The length of the Header:Mark
#define SHUZU_HDR_SPACE 2000 // The lenght of the Header:Space
#define HDR_MARK 1000 // The length of the Header:Mark
#define HDR_SPACE 2000 // The lenght of the Header:Space
#define SHUZU_BIT_MARK 3000 // The length of a Bit:Mark
#define SHUZU_ONE_SPACE 4000 // The length of a Bit:Space for 1's
#define SHUZU_ZERO_SPACE 5000 // The length of a Bit:Space for 0's
#define BIT_MARK 3000 // The length of a Bit:Mark
#define ONE_SPACE 4000 // The length of a Bit:Space for 1's
#define ZERO_SPACE 5000 // The length of a Bit:Space for 0's
#define SHUZU_OTHER 1234 // Other things you may need to define
#define OTHER 1234 // Other things you may need to define
//+=============================================================================
//
@@ -122,22 +122,22 @@ void IRsend::sendShuzu (unsigned long data, int nbits)
enableIROut(38);
// Header
mark (SHUZU_HDR_MARK);
space(SHUZU_HDR_SPACE);
mark (HDR_MARK);
space(HDR_SPACE);
// Data
for (unsigned long mask = 1 << (nbits - 1); mask; mask >>= 1) {
if (data & mask) {
mark (SHUZU_BIT_MARK);
space(SHUZU_ONE_SPACE);
mark (BIT_MARK);
space(ONE_SPACE);
} else {
mark (SHUZU_BIT_MARK);
space(SHUZU_ZERO_SPACE);
mark (BIT_MARK);
space(ZERO_SPACE);
}
}
// Footer
mark(SHUZU_BIT_MARK);
mark(BIT_MARK);
space(0); // Always end with the LED off
}
#endif
@@ -151,27 +151,27 @@ bool IRrecv::decodeShuzu (decode_results *results)
int offset = 1; // Skip the Gap reading
// Check we have the right amount of data
if (irparams.rawlen != 1 + 2 + (2 * SHUZU_BITS) + 1) return false ;
if (irparams.rawlen != 1 + 2 + (2 * BITS) + 1) return false ;
// Check initial Mark+Space match
if (!MATCH_MARK (results->rawbuf[offset++], SHUZU_HDR_MARK )) return false ;
if (!MATCH_SPACE(results->rawbuf[offset++], SHUZU_HDR_SPACE)) return false ;
if (!MATCH_MARK (results->rawbuf[offset++], HDR_MARK )) return false ;
if (!MATCH_SPACE(results->rawbuf[offset++], HDR_SPACE)) return false ;
// Read the bits in
for (int i = 0; i < SHUZU_BITS; i++) {
// Each bit looks like: MARK + SPACE_1 -> 1
// or : MARK + SPACE_0 -> 0
if (!MATCH_MARK(results->rawbuf[offset++], SAMSUNG_BIT_MARK)) return false ;
if (!MATCH_MARK(results->rawbuf[offset++], BIT_MARK)) return false ;
// IR data is big-endian, so we shuffle it in from the right:
if (MATCH_SPACE(results->rawbuf[offset], SHUZU_ONE_SPACE)) data = (data << 1) | 1 ;
else if (MATCH_SPACE(results->rawbuf[offset], SHUZU_ZERO_SPACE)) data = (data << 1) | 0 ;
else return false ;
if (MATCH_SPACE(results->rawbuf[offset], ONE_SPACE)) data = (data << 1) | 1 ;
else if (MATCH_SPACE(results->rawbuf[offset], ZERO_SPACE)) data = (data << 1) | 0 ;
else return false ;
offset++;
}
// Success
results->bits = SHUZU_BITS;
results->bits = BITS;
results->value = data;
results->decode_type = SHUZU;
return true;