mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2026-01-09 06:32:48 +00:00
Merging Sharp
This commit is contained in:
71
IRremote.cpp
71
IRremote.cpp
@@ -458,6 +458,12 @@ int IRrecv::decode(decode_results *results) {
|
|||||||
if (decodeSanyo(results)) {
|
if (decodeSanyo(results)) {
|
||||||
return DECODED;
|
return DECODED;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.println("Attempting Sharp decode");
|
||||||
|
#endif
|
||||||
|
if (decodeSharp(results)) {
|
||||||
|
return DECODED;
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.println("Attempting Mitsubishi decode");
|
Serial.println("Attempting Mitsubishi decode");
|
||||||
#endif
|
#endif
|
||||||
@@ -618,6 +624,7 @@ long IRrecv::decodeSony(decode_results *results) {
|
|||||||
return DECODED;
|
return DECODED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
long IRrecv::decodeWhynter(decode_results *results) {
|
long IRrecv::decodeWhynter(decode_results *results) {
|
||||||
long data = 0;
|
long data = 0;
|
||||||
|
|
||||||
@@ -657,14 +664,7 @@ long IRrecv::decodeWhynter(decode_results *results) {
|
|||||||
data = (data << 1) | 1;
|
data = (data << 1) | 1;
|
||||||
}
|
}
|
||||||
else if (MATCH_SPACE(results->rawbuf[offset],WHYNTER_ZERO_SPACE)) {
|
else if (MATCH_SPACE(results->rawbuf[offset],WHYNTER_ZERO_SPACE)) {
|
||||||
data <<= 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ERR;
|
|
||||||
}
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// trailing mark
|
// trailing mark
|
||||||
if (!MATCH_MARK(results->rawbuf[offset], WHYNTER_BIT_MARK)) {
|
if (!MATCH_MARK(results->rawbuf[offset], WHYNTER_BIT_MARK)) {
|
||||||
return ERR;
|
return ERR;
|
||||||
@@ -677,6 +677,61 @@ long IRrecv::decodeWhynter(decode_results *results) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
long IRrecv::decodeSharp(decode_results *results) {
|
||||||
|
long data = 0;
|
||||||
|
if (irparams.rawlen < 32) {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int offset = 0; // Dont skip first space, check its size
|
||||||
|
|
||||||
|
if (results->rawbuf[offset] < SHARP_RPT_SPACE) {
|
||||||
|
// Serial.print("IR Gap found: ");
|
||||||
|
results->bits = 0;
|
||||||
|
results->value = REPEAT;
|
||||||
|
results->decode_type = SHARP;
|
||||||
|
return DECODED;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset++;
|
||||||
|
|
||||||
|
while (offset + 1 < irparams.rawlen) {
|
||||||
|
if (!MATCH_MARK(results->rawbuf[offset], SHARP_BIT_MARK)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (data & 1 || !(data & 2)) {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success
|
||||||
|
results->bits = (offset - 1) / 2;
|
||||||
|
if (results->bits < 15) {
|
||||||
|
results->bits = 0;
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
results->sharpAddress = (data >> 10) & 0b11111;
|
||||||
|
results->value = (data >> 2) & 0xff;
|
||||||
|
results->decode_type = SHARP;
|
||||||
|
return DECODED;
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> 0b9d907da992bbb56493164e79d37006ec52e777
|
||||||
// I think this is a Sanyo decoder - serial = SA 8650B
|
// I think this is a Sanyo decoder - serial = SA 8650B
|
||||||
// Looks like Sony except for timings, 48 chars of data and time/space different
|
// Looks like Sony except for timings, 48 chars of data and time/space different
|
||||||
long IRrecv::decodeSanyo(decode_results *results) {
|
long IRrecv::decodeSanyo(decode_results *results) {
|
||||||
|
|||||||
11
IRremote.h
11
IRremote.h
@@ -29,9 +29,9 @@
|
|||||||
class decode_results {
|
class decode_results {
|
||||||
public:
|
public:
|
||||||
int decode_type; // NEC, SONY, RC5, UNKNOWN
|
int decode_type; // NEC, SONY, RC5, UNKNOWN
|
||||||
union { // This is used for decoding Panasonic and Sharp data
|
union {
|
||||||
unsigned int panasonicAddress;
|
unsigned int panasonicAddress; // This is only used for decoding Panasonic data
|
||||||
unsigned int sharpAddress;
|
unsigned int sharpAddress; // This is only used for decoding Panasonic data
|
||||||
};
|
};
|
||||||
unsigned long value; // Decoded value
|
unsigned long value; // Decoded value
|
||||||
int bits; // Number of bits in decoded value
|
int bits; // Number of bits in decoded value
|
||||||
@@ -52,7 +52,11 @@ public:
|
|||||||
#define MITSUBISHI 10
|
#define MITSUBISHI 10
|
||||||
#define SAMSUNG 11
|
#define SAMSUNG 11
|
||||||
#define LG 12
|
#define LG 12
|
||||||
|
<<<<<<< HEAD
|
||||||
#define WHYNTER 13
|
#define WHYNTER 13
|
||||||
|
=======
|
||||||
|
#define SHARP 13
|
||||||
|
>>>>>>> 0b9d907da992bbb56493164e79d37006ec52e777
|
||||||
#define UNKNOWN -1
|
#define UNKNOWN -1
|
||||||
|
|
||||||
// Decoded value for NEC when a repeat code is received
|
// Decoded value for NEC when a repeat code is received
|
||||||
@@ -72,6 +76,7 @@ private:
|
|||||||
int getRClevel(decode_results *results, int *offset, int *used, int t1);
|
int getRClevel(decode_results *results, int *offset, int *used, int t1);
|
||||||
long decodeNEC(decode_results *results);
|
long decodeNEC(decode_results *results);
|
||||||
long decodeSony(decode_results *results);
|
long decodeSony(decode_results *results);
|
||||||
|
long decodeSharp(decode_results *results);
|
||||||
long decodeSanyo(decode_results *results);
|
long decodeSanyo(decode_results *results);
|
||||||
long decodeMitsubishi(decode_results *results);
|
long decodeMitsubishi(decode_results *results);
|
||||||
long decodeRC5(decode_results *results);
|
long decodeRC5(decode_results *results);
|
||||||
|
|||||||
@@ -149,7 +149,7 @@
|
|||||||
#define SHARP_ZERO_SPACE 795
|
#define SHARP_ZERO_SPACE 795
|
||||||
#define SHARP_GAP 600000
|
#define SHARP_GAP 600000
|
||||||
#define SHARP_TOGGLE_MASK 0x3FF
|
#define SHARP_TOGGLE_MASK 0x3FF
|
||||||
#define SHARP_RPT_SPACE 3000
|
#define SHARP_RPT_SPACE 950 // 40ms
|
||||||
|
|
||||||
#define DISH_HDR_MARK 400
|
#define DISH_HDR_MARK 400
|
||||||
#define DISH_HDR_SPACE 6100
|
#define DISH_HDR_SPACE 6100
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ void dump(decode_results *results) {
|
|||||||
Serial.print(results->panasonicAddress,HEX);
|
Serial.print(results->panasonicAddress,HEX);
|
||||||
Serial.print(" Value: ");
|
Serial.print(" Value: ");
|
||||||
}
|
}
|
||||||
|
else if (results->decode_type == SHARP) {
|
||||||
|
Serial.print("Decoded SHARP - Address: ");
|
||||||
|
Serial.print(results->sharpAddress,HEX);
|
||||||
|
Serial.print(" Value: ");
|
||||||
|
}
|
||||||
else if (results->decode_type == LG) {
|
else if (results->decode_type == LG) {
|
||||||
Serial.print("Decoded LG: ");
|
Serial.print("Decoded LG: ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ SHARP LITERAL1
|
|||||||
PANASONIC LITERAL1
|
PANASONIC LITERAL1
|
||||||
JVC LITERAL1
|
JVC LITERAL1
|
||||||
LG LITERAL1
|
LG LITERAL1
|
||||||
|
SHARP LITERAL1
|
||||||
UNKNOWN LITERAL1
|
UNKNOWN LITERAL1
|
||||||
REPEAT LITERAL1
|
REPEAT LITERAL1
|
||||||
|
|||||||
Reference in New Issue
Block a user