Blogger

Delete comment from: Ken Shirriff's blog

®¿® said...

For those that wanted the Sharp TV Remote decode (Remote Used: LCDTV - GA667WJSA), see below:

long IRrecv::decodeSharp(decode_result_type *results) {
long data = 0;
int offset = 1; //Skip the first long space

// Check raw bit length, should be 32 (15 mark bits + 16 space bits + 1 leading space bit)
if (_irparams.rawlen < 2 * SHARP_BITS + 2)
return ERR;

for (int i = 0; i < SHARP_BITS; i++) {

if (!MATCH_MARK(results->rawbuf[offset], SHARP_BIT_MARK)) {
return ERR;
}

offset++;

if (MATCH_SPACE(results->rawbuf[offset], SHARP_ONE_SPACE)) {
data = (data << 1) | 1;
}
else if (MATCH_SPACE(results->rawbuf[offset], SHARP_ZERO_SPACE)) {
data <<= 1;
}
else {
return ERR;
}
offset++;
}
// Success
results->bits = SHARP_BITS;
results->value = data;
results->decode_type = SHARP;

//Delay for USECPERTICK (50 ms) to skip next interrupt to avoid getting garbage (need to get the actual reason for this)
//If you double this value (USECPERTICK*2 = 100 ms), you won't get a duplicated IR code, but this may not be to SHARP IR protocol, so it seems
_delay_ms(USECPERTICK);

return DECODED;
}

Note: I used AVR Studio and the _delay_ms() call is from "util/delay.h", you can simply sub that for the Ardiuno Studio's version.

Note (2): There is a bug in the decodeSony(). When a duplicate is found, the code returns SANYO and not SONY for 'decode_type'

Oct 16, 2013, 2:37:00 AM


Posted to A Multi-Protocol Infrared Remote Library for the Arduino

Google apps
Main menu