12 #if (DECODE_RC5 || DECODE_RC6)
13 int IRrecv::getRClevel(
decode_results *results,
unsigned int *offset,
int *used,
int t1) {
19 if (*offset >= results->
rawlen) {
22 width = results->
rawbuf[*offset];
26 if (
MATCH(width, (t1) + correction)) {
28 }
else if (
MATCH(width, (2 * t1) + correction)) {
30 }
else if (
MATCH(width, (3 * t1) + correction)) {
57 #define MIN_RC5_SAMPLES 11
59 #define RC5_RPT_LENGTH 46000
73 for (
unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
90 unsigned long addressBits = 5;
91 unsigned long commandBits = 7;
98 unsigned long cmdBit6 = (1UL << (commandBits - 1)) & cmd;
110 static int toggleBit = 1;
112 if (toggleBit == 0) {
127 for (
unsigned long mask = 1UL << (addressBits - 1); mask; mask >>= 1) {
138 for (
unsigned long mask = 1UL << (commandBits - 1); mask; mask >>= 1) {
159 unsigned int offset = 1;
166 if (getRClevel(results, &offset, &used,
RC5_T1) !=
MARK) {
169 if (getRClevel(results, &offset, &used,
RC5_T1) !=
SPACE) {
172 if (getRClevel(results, &offset, &used,
RC5_T1) !=
MARK) {
177 int levelA = getRClevel(results, &offset, &used,
RC5_T1);
178 int levelB = getRClevel(results, &offset, &used,
RC5_T1);
180 if ((levelA ==
SPACE) && (levelB ==
MARK)) {
181 data = (data << 1) | 1;
182 }
else if ((levelA ==
MARK) && (levelB ==
SPACE)) {
183 data = (data << 1) | 0;
190 results->
bits = nbits;
191 results->
value = data;
206 #define MIN_RC6_SAMPLES 1
207 #define RC6_HDR_MARK 2666
208 #define RC6_HDR_SPACE 889
210 #define RC6_RPT_LENGTH 46000
226 for (
unsigned long i = 1, mask = 1UL << (nbits - 1); mask; i++, mask >>= 1) {
248 unsigned int offset = 1;
266 if (getRClevel(results, &offset, &used,
RC6_T1) !=
MARK) {
269 if (getRClevel(results, &offset, &used,
RC6_T1) !=
SPACE) {
273 for (nbits = 0; offset < results->
rawlen; nbits++) {
276 levelA = getRClevel(results, &offset, &used,
RC6_T1);
279 if (levelA != getRClevel(results, &offset, &used,
RC6_T1)) {
284 levelB = getRClevel(results, &offset, &used,
RC6_T1);
287 if (levelB != getRClevel(results, &offset, &used,
RC6_T1)) {
292 if ((levelA ==
MARK) && (levelB ==
SPACE)) {
293 data = (data << 1) | 1;
294 }
else if ((levelA ==
SPACE) && (levelB ==
MARK)) {
295 data = (data << 1) | 0;
302 results->
bits = nbits;
303 results->
value = data;