当前位置: 首页>>代码示例>>C++>>正文


C++ MATCH_MARK函数代码示例

本文整理汇总了C++中MATCH_MARK函数的典型用法代码示例。如果您正苦于以下问题:C++ MATCH_MARK函数的具体用法?C++ MATCH_MARK怎么用?C++ MATCH_MARK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MATCH_MARK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

bool IRrecv::decodeLightStrike(decode_results *results) {
	long  data = 0;  // We decode in to here; Start with nothing
	int   offset = 1;  // Index in to results; Skip first entry!?

	// Check header "mark"
	if (!MATCH_MARK(results->rawbuf[offset], LS_HDR_MARK))  return false;

	// Check we have enough data
	if (irparams.rawlen < (2 * LS_BITS) + 2) 
		return false;

	// Build the data
	for (int i = 0; i < LS_BITS; i++) {
		// Determine if the bit is a 1 or 0
		offset++;
		if (MATCH_SPACE(results->rawbuf[offset], LS_ONE_SPACE))
			data = (data << 1) | 1;
		else if (MATCH_SPACE(results->rawbuf[offset], LS_ZERO_SPACE))
			data = (data << 1) | 0;
		else
			return false;

		// Check data "mark"
		offset++;
		if (!MATCH_MARK(results->rawbuf[offset], LS_BIT_MARK))
			return false;
	}

	// Success
	results->bits = LS_BITS;
	results->value = data;
	results->decode_type = LIGHTSTRIKE;

	return true;
}
开发者ID:Corom,项目名称:Arduino-IRremote,代码行数:35,代码来源:ir_LightStrike.cpp

示例2: decodeTagShot

bool  IRrecv::decodeTagShot (decode_results *results)
{
	unsigned long  data   = 0;  // Somewhere to build our code
	int            offset = 1;  // Skip the Gap reading

	// Check we have the right amount of data
	if (irparams.rawlen != 1 + 2 + (2 * BITS) + 1)  return false ;

	// Check initial Mark+Space match
	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 < BITS;  i++) {
		// Each bit looks like: MARK + SPACE_1 -> 1
		//                 or : MARK + SPACE_0 -> 0
		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], 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        = BITS;
	results->value       = data;
	results->decode_type = TAGSHOT;
	return true;
}
开发者ID:phillipblevins,项目名称:Arduino-IRremote,代码行数:31,代码来源:ir_TagShot.cpp

示例3: if

bool  IRrecv::decodeLG (decode_results *results)
{
    long  data   = 0;
    int   offset = 1; // Skip first space

	// Check we have the right amount of data
    if (irparams.rawlen < (2 * LG_BITS) + 1 )  return false ;

    // Initial mark/space
    if (!MATCH_MARK(results->rawbuf[offset++], LG_HDR_MARK))  return false ;
    if (!MATCH_SPACE(results->rawbuf[offset++], LG_HDR_SPACE))  return false ;

    for (int i = 0;  i < LG_BITS;  i++) {
        if (!MATCH_MARK(results->rawbuf[offset++], LG_BIT_MARK))  return false ;

        if      (MATCH_SPACE(results->rawbuf[offset], LG_ONE_SPACE))   data = (data << 1) | 1 ;
        else if (MATCH_SPACE(results->rawbuf[offset], LG_ZERO_SPACE))  data = (data << 1) | 0 ;
        else                                                           return false ;
        offset++;
    }

    // Stop bit
    if (!MATCH_MARK(results->rawbuf[offset], LG_BIT_MARK))   return false ;

    // Success
    results->bits        = LG_BITS;
    results->value       = data;
    results->decode_type = LG;
    return true;
}
开发者ID:Brawn1,项目名称:Arduino_Experimente,代码行数:30,代码来源:ir_LG.cpp

示例4: decodePanasonic

bool  IRrecv::decodePanasonic ()
{
    unsigned long long  data   = 0;
    int                 offset = 1;

    if (!MATCH_MARK(irparams.rawbuf[offset++], PANASONIC_HDR_MARK ))  return false ;
    if (!MATCH_MARK(irparams.rawbuf[offset++], PANASONIC_HDR_SPACE))  return false ;

    // decode address
    for (int i = 0;  i < PANASONIC_BITS;  i++) {
        if (!MATCH_MARK(irparams.rawbuf[offset++], PANASONIC_BIT_MARK))  return false ;

        if      (MATCH_SPACE(irparams.rawbuf[offset],PANASONIC_ONE_SPACE ))  data = (data << 1) | 1 ;
        else if (MATCH_SPACE(irparams.rawbuf[offset],PANASONIC_ZERO_SPACE))  data = (data << 1) | 0 ;
        else                                                                 return false ;
        offset++;
    }

    results.value       = (unsigned long)data;
    results.address     = (unsigned int)(data >> 32);
    results.decode_type = PANASONIC;
    results.bits        = PANASONIC_BITS;

    return true;
}
开发者ID:DrDiettrich,项目名称:Arduino-IRremote,代码行数:25,代码来源:ir_Panasonic.cpp

示例5: decodePanasonic

long IRrecvSF::decodePanasonic(decode_resultsSF *results) {
    unsigned long long data = 0;
    int offset = 1;
    
    if (!MATCH_MARK(results->rawbuf[offset], PANASONIC_HDR_MARK)) {
        return ERR;
    }
    offset++;
    if (!MATCH_MARK(results->rawbuf[offset], PANASONIC_HDR_SPACE)) {
        return ERR;
    }
    offset++;
    
    // decode address
    for (int i = 0; i < PANASONIC_BITS; i++) {
        if (!MATCH_MARK(results->rawbuf[offset++], PANASONIC_BIT_MARK)) {
            return ERR;
        }
        if (MATCH_SPACE(results->rawbuf[offset],PANASONIC_ONE_SPACE)) {
            data = (data << 1) | 1;
        } else if (MATCH_SPACE(results->rawbuf[offset],PANASONIC_ZERO_SPACE)) {
            data <<= 1;
        } else {
            return ERR;
        }
        offset++;
    }
    results->value = (unsigned long)data;
    results->panasonicAddress = (unsigned int)(data >> 32);
    results->decode_type = PANASONIC;
    results->bits = PANASONIC_BITS;
    return DECODED;
}
开发者ID:Eih3,项目名称:v0.83,代码行数:33,代码来源:IRremoteSF.cpp

示例6: MATCH_MARK

bool IRRemote::decodeSAMSUNG(int rawlen)

{
    long data = 0;
    int offset = 1; // Skip first space
    // Initial mark
    if (!MATCH_MARK(_rawbuf[offset], SAMSUNG_HDR_MARK))
    {
        return false;
    }
    offset++;
    // Check for repeat
    if (rawlen == 4 && MATCH_SPACE(_rawbuf[offset], SAMSUNG_RPT_SPACE)
            && MATCH_MARK(_rawbuf[offset + 1], SAMSUNG_BIT_MARK))
    {
        _bits = 0;
        _value = REPEAT;
        _decode_type = SAMSUNG;
        //TODO  see what happens if return false on repeat
        //return true;
        return false;
    }
    else if (rawlen < 2 * SAMSUNG_BITS + 4)
    {
        return false;
    }
    // Initial space
    if (!MATCH_SPACE(_rawbuf[offset], SAMSUNG_HDR_SPACE))
    {
        return false;
    }
    offset++;
    for (int i = 0; i < SAMSUNG_BITS; i++)
    {
        if (!MATCH_MARK(_rawbuf[offset], SAMSUNG_BIT_MARK))
        {
            return false;
        }
        offset++;
        if (MATCH_SPACE(_rawbuf[offset], SAMSUNG_ONE_SPACE))
        {
            data = (data << 1) | 1;
        }
        else if (MATCH_SPACE(_rawbuf[offset], SAMSUNG_ZERO_SPACE))
        {
            data <<= 1;
        }
        else
        {
            return false;
        }
        offset++;
    }
    // Success
    _bits = SAMSUNG_BITS;
    _value = data;
    _decode_type = SAMSUNG;
    return true;
}
开发者ID:nihuyaka,项目名称:libarmpit-cortex,代码行数:59,代码来源:IRremote.cpp

示例7: if

long IRrecv::decodeWhynter(decode_results *results) {
  long data = 0;
  
  if (irparams.rawlen < 2 * WHYNTER_BITS + 6) {
     return ERR;
  }
  
  int offset = 1; // Skip first space


  // sequence begins with a bit mark and a zero space
  if (!MATCH_MARK(results->rawbuf[offset], WHYNTER_BIT_MARK)) {
    return ERR;
  }
  offset++;
  if (!MATCH_SPACE(results->rawbuf[offset], WHYNTER_ZERO_SPACE)) {
    return ERR;
  }
  offset++;

  // header mark and space
  if (!MATCH_MARK(results->rawbuf[offset], WHYNTER_HDR_MARK)) {
    return ERR;
  }
  offset++;
  if (!MATCH_SPACE(results->rawbuf[offset], WHYNTER_HDR_SPACE)) {
    return ERR;
  }
  offset++;

  // data bits
  for (int i = 0; i < WHYNTER_BITS; i++) {
    if (!MATCH_MARK(results->rawbuf[offset], WHYNTER_BIT_MARK)) {
      return ERR;
    }
    offset++;
    if (MATCH_SPACE(results->rawbuf[offset], WHYNTER_ONE_SPACE)) {
      data = (data << 1) | 1;
    } 
    else if (MATCH_SPACE(results->rawbuf[offset],WHYNTER_ZERO_SPACE)) {
      data <<= 1;
    } 
    else {
      return ERR;
    }
    offset++;
  }
  
  // trailing mark
  if (!MATCH_MARK(results->rawbuf[offset], WHYNTER_BIT_MARK)) {
    return ERR;
  }
  // Success
  results->bits = WHYNTER_BITS;
  results->value = data;
  results->decode_type = WHYNTER;
  return DECODED;
}
开发者ID:Leenix,项目名称:Tengu,代码行数:58,代码来源:IRremoteESP8266.cpp

示例8: while

bool  IRrecv::decodeMitsubishi (decode_results *results)
{
  // Serial.print("?!? decoding Mitsubishi:");Serial.print(irparams.rawlen); Serial.print(" want "); Serial.println( 2 * MITSUBISHI_BITS + 2);
  long data = 0;
  if (irparams.rawlen < 2 * MITSUBISHI_BITS + 2)  return false ;
  int offset = 0; // Skip first space
  // Initial space

#if 0
  // Put this back in for debugging - note can't use #DEBUG as if Debug on we don't see the repeat cos of the delay
  Serial.print("IR Gap: ");
  Serial.println( results->rawbuf[offset]);
  Serial.println( "test against:");
  Serial.println(results->rawbuf[offset]);
#endif

#if 0
  // Not seeing double keys from Mitsubishi
  if (results->rawbuf[offset] < MITSUBISHI_DOUBLE_SPACE_USECS) {
    // Serial.print("IR Gap found: ");
    results->bits = 0;
    results->value = REPEAT;
    results->decode_type = MITSUBISHI;
    return true;
  }
#endif

  offset++;

  // Typical
  // 14200 7 41 7 42 7 42 7 17 7 17 7 18 7 41 7 18 7 17 7 17 7 18 7 41 8 17 7 17 7 18 7 17 7

  // Initial Space
  if (!MATCH_MARK(results->rawbuf[offset], MITSUBISHI_HDR_SPACE))  return false ;
  offset++;

  while (offset + 1 < irparams.rawlen) {
    if      (MATCH_MARK(results->rawbuf[offset], MITSUBISHI_ONE_MARK))   data = (data << 1) | 1 ;
    else if (MATCH_MARK(results->rawbuf[offset], MITSUBISHI_ZERO_MARK))  data <<= 1 ;
    else                                                                 return false ;
    offset++;

    if (!MATCH_SPACE(results->rawbuf[offset], MITSUBISHI_HDR_SPACE))  break ;
    offset++;
  }

  // Success
  results->bits = (offset - 1) / 2;
  if (results->bits < MITSUBISHI_BITS) {
    results->bits = 0;
    return false;
  }

  results->value       = data;
  results->decode_type = MITSUBISHI;
  return true;
}
开发者ID:1OOSUR,项目名称:Arduino-IRremote,代码行数:57,代码来源:ir_Mitsubishi.cpp

示例9: while

long IRrecv::decodeSony(decode_results *results) {
  long data = 0;
  if (irparams.rawlen < 2 * SONY_BITS + 2) {
    return ERR;
  }
  int offset = 0; // Dont skip first space, check its size

  // Some Sony's deliver repeats fast after first
  // unfortunately can't spot difference from of repeat from two fast clicks
  if (results->rawbuf[offset] < SONY_DOUBLE_SPACE_USECS) {
    // Serial.print("IR Gap found: ");
    results->bits = 0;
    results->value = REPEAT;
#ifdef SANYO
    results->decode_type = SANYO;
#else
    results->decode_type = UNKNOWN;
#endif
    return DECODED;
  }
  offset++;

  // Initial mark
  if (!MATCH_MARK(results->rawbuf[offset], SONY_HDR_MARK)) {
    return ERR;
  }
  offset++;

  while (offset + 1 < irparams.rawlen) {
    if (!MATCH_SPACE(results->rawbuf[offset], SONY_HDR_SPACE)) {
      break;
    }
    offset++;
    if (MATCH_MARK(results->rawbuf[offset], SONY_ONE_MARK)) {
      data = (data << 1) | 1;
    } 
    else if (MATCH_MARK(results->rawbuf[offset], SONY_ZERO_MARK)) {
      data <<= 1;
    } 
    else {
      return ERR;
    }
    offset++;
  }

  // Success
  results->bits = (offset - 1) / 2;
  if (results->bits < 12) {
    results->bits = 0;
    return ERR;
  }
  results->value = data;
  results->decode_type = SONY;
  return DECODED;
}
开发者ID:sstefanov,项目名称:Arduino-IRremote,代码行数:55,代码来源:IRremote.cpp

示例10: decodeJVC

static long decodeJVC(decode_results *results) {
  long data = 0;
  int offset = 1; // Skip first space
  int i = 0;

  // Check for repeat
  if (irparams.rawlen - 1 == 33 &&
      MATCH_MARK(results->rawbuf[offset], JVC_BIT_MARK) &&
      MATCH_MARK(results->rawbuf[irparams.rawlen-1], JVC_BIT_MARK)) {
    results->bits = 0;
    results->value = REPEAT;
    results->decode_type = JVC;
    return DECODED;
  } 

  // Initial mark
  if (!MATCH_MARK(results->rawbuf[offset], JVC_HDR_MARK)) {
    return ERR;
  }
  offset++; 
  if (irparams.rawlen < 2 * JVC_BITS + 1 ) {
    return ERR;
  }
  // Initial space 
  if (!MATCH_SPACE(results->rawbuf[offset], JVC_HDR_SPACE)) {
    return ERR;
  }
  offset++;
  for (i = 0; i < JVC_BITS; i++) {
    if (!MATCH_MARK(results->rawbuf[offset], JVC_BIT_MARK)) {
      return ERR;
    }
    offset++;
    if (MATCH_SPACE(results->rawbuf[offset], JVC_ONE_SPACE)) {
      data = (data << 1) | 1;
    } 
    else if (MATCH_SPACE(results->rawbuf[offset], JVC_ZERO_SPACE)) {
      data <<= 1;
    } 
    else {
      return ERR;
    }
    offset++;
  }
  // Stop bit
  if (!MATCH_MARK(results->rawbuf[offset], JVC_BIT_MARK)){
    return ERR;
  }
  // Success
  results->bits = JVC_BITS;
  results->value = data;
  results->decode_type = JVC;
  return DECODED;
}
开发者ID:Mpic,项目名称:avr,代码行数:54,代码来源:irrecv.c

示例11: decodeSAMSUNG

long IRrecv::decodeSAMSUNG(decode_results *results) {
 long data = 0;
 int offset = 1; // Skip first space
 
 float	kShrink = .9;// GRR - "shrink" recieved sequence
 decValue.value = 0;
 
 // Initial mark
 if (!MATCH_MARK(results->rawbuf[offset]*kShrink, SAMSUNG_HDR_MARK)) {
 decValue.value = 0;//2 //GRR for debugging
 return ERR;
 }
 offset++;

 // Check bits
 if (irparams.rawlen < 2 * SAMSUNG_BITS + 4) {
 decValue.value = 0;//3 //GRR for debugging
 return ERR;
 }

 // Initial space
 if (!MATCH_SPACE(results->rawbuf[offset]*kShrink, SAMSUNG_HDR_SPACE)) {
 decValue.value = 0;//4 //GRR for debugging
 return ERR;
 }
 offset++;
 //Serial.println("OFFSET");
 //Serial.println(offset);

 for (int i = 0; i < SAMSUNG_BITS; i++) {
 if (!MATCH_MARK(results->rawbuf[offset]*kShrink, SAMSUNG_BIT_MARK)) {
 decValue.value = 0;//5 //GRR for debugging
 return ERR;
 }
 offset++;
 if (MATCH_SPACE(results->rawbuf[offset]*kShrink, SAMSUNG_ONE_SPACE)) {
 data = (data << 1) | 1;
 }
 else if (MATCH_SPACE(results->rawbuf[offset]*kShrink, SAMSUNG_ZERO_SPACE)) {
 data <<= 1;
 }
 else {
 decValue.value = 0;//6 //GRR for debugging
 return ERR;
 }
 offset++;
 }
 // Success
 decValue.value = data;
 results->bits = SAMSUNG_BITS;
 results->value = data;
 results->decode_type = SAMSUNG;
 return DECODED;
}
开发者ID:rusgon,项目名称:IRremoteSendRecv,代码行数:54,代码来源:IRremoteSendRecv.cpp

示例12: while

long IRrecv::decodeAiwaRCT501(decode_results *results) {
  int data = 0;
  int offset = 1; // skip first garbage read

  // Check SIZE
  if(irparams.rawlen < 2 * (AIWA_RC_T501_SUM_BITS) + 4) {
    return ERR;
  }
  
  // Check HDR
  if(!MATCH_MARK(results->rawbuf[offset], AIWA_RC_T501_HDR_MARK)) {
    return ERR;
  }
  offset++;

  // Check HDR space
  if(!MATCH_SPACE(results->rawbuf[offset], AIWA_RC_T501_HDR_SPACE)) {
    return ERR;
  }
  offset++;

  offset += 26; // skip pre-data - optional
  while(offset < irparams.rawlen - 4) {
    if(MATCH_MARK(results->rawbuf[offset], AIWA_RC_T501_BIT_MARK)) {
      offset++;
    } 
    else {
      return ERR;
    }
    
    // ONE & ZERO
    if(MATCH_SPACE(results->rawbuf[offset], AIWA_RC_T501_ONE_SPACE)) {
      data = (data << 1) | 1;
    } 
    else if(MATCH_SPACE(results->rawbuf[offset], AIWA_RC_T501_ZERO_SPACE)) {
      data <<= 1;
    } 
    else {
      // End of one & zero detected
      break;
    }
    offset++;
  }
  
  results->bits = (offset - 1) / 2;
  if(results->bits < 42) {
    return ERR;
  }
  results->value = data;
  results->decode_type = AIWA_RC_T501;
  return DECODED;
}
开发者ID:AllAboutEE,项目名称:Arduino-IRremote,代码行数:52,代码来源:Shirriff_AiwaRCT501.cpp

示例13: while

long IRrecv::decodeRCMM(decode_results *results) {
  long data = 0;
  if (irparams.rawlen < RCMM_BITS + 4) {
    return ERR;
  }
  int offset = 1; // Skip first space
  // Initial mark
  if (!MATCH_MARK(results->rawbuf[offset], RCMM_HDR_MARK)) {
    return ERR;
  }
  offset++;
  if (!MATCH_SPACE(results->rawbuf[offset], RCMM_SPACE)) {
    return ERR;
  }
  offset++;

  while (offset + 1 < irparams.rawlen) {
    if (!MATCH_MARK(results->rawbuf[offset], RCMM_MARK)) {
      return ERR;
    }
    offset++;
    if (MATCH_SPACE(results->rawbuf[offset], RCMM_SPACE)) {
		data = (data << 2) | 0;
    } 
    else if (MATCH_SPACE(results->rawbuf[offset], RCMM_SPACE+RCMM_INCREMENT)) {
		data = (data << 2) | 1;
    } 
    else if (MATCH_SPACE(results->rawbuf[offset], RCMM_SPACE+2*RCMM_INCREMENT)) {
		data = (data << 2) | 2;
    } 
    else if (MATCH_SPACE(results->rawbuf[offset], RCMM_SPACE+3*RCMM_INCREMENT)) {
		data = (data << 2) | 3;
    } 
    else {
      return ERR;
    }
    offset++;
  }
  if (!MATCH_MARK(results->rawbuf[offset], RCMM_MARK)) {
    return ERR;
  }

  // Success
  results->bits = (offset - 3);
  if (results->bits < RCMM_BITS) {
    results->bits = 0;
    return ERR;
  }
  results->value = data;
  results->decode_type = RCMM;
  return DECODED;
}
开发者ID:microtherion,项目名称:Arduino-IRremote,代码行数:52,代码来源:IRremote.cpp

示例14: decodeSamsung

//Samsung TV codes imported from http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-1-getting-started/
long IRrecv::decodeSamsung(decode_results *results) {
 long data = 0;
 int offset = 1; // Skip first space

 // Check bits
if (irparams.rawlen < 2 * SAMSUNG_BITS + 4 && irparams.rawlen != 6) {
	return ERR;
 }
 
 // Initial mark
 if (!MATCH_MARK(results->rawbuf[offset], SAMSUNG_HDR_MARK)) {
	return ERR;
 }
 offset++;
  
 // Initial space
 if (!MATCH_SPACE(results->rawbuf[offset], SAMSUNG_HDR_SPACE)) {
	return ERR;
 }
 offset++;
 //Serial.println("OFFSET");
 //Serial.println(offset);
 
 for (int i = 0; i < SAMSUNG_BITS; i++) {
	 if (!MATCH_MARK(results->rawbuf[offset], SAMSUNG_BIT_MARK)) {
		return ERR;
	 }
	 offset++;	 
	 if (offset == irparams.rawlen)
	 {
		results->bits = SAMSUNG_BITS;
		results->value = REPEAT;
		results->decode_type = SAMSUNG;
		return DECODED;
	 }
	 if (MATCH_SPACE(results->rawbuf[offset], SAMSUNG_ONE_SPACE)) {
		data = (data << 1) | 1;
	 }
	 else if (MATCH_SPACE(results->rawbuf[offset], SAMSUNG_ZERO_SPACE)) {
		data <<= 1;		
	 }
	 else {
		return ERR;
	 }
	 offset++;
 }
 // Success
 results->bits = SAMSUNG_BITS;
 results->value = data;
 results->decode_type = SAMSUNG;
 return DECODED;
}
开发者ID:imclab,项目名称:moonlander-trails,代码行数:53,代码来源:IRremote2.cpp

示例15: IRrecv_decodeNEC

// NECs have a repeat only 4 items long
u32 IRrecv_decodeNEC(decode_results *results)
{
    u32 data = 0;
    u16 offset = 1; // Skip first space
    u16 i;
  // Initial mark
  if (!MATCH_MARK(results->rawbuf[offset], NEC_HDR_MARK)) {
    return ERR;
  }
  offset++;
  // Check for repeat
  if (irparams.rawlen == 4 &&
    MATCH_SPACE(results->rawbuf[offset], NEC_RPT_SPACE) &&
    MATCH_MARK(results->rawbuf[offset+1], NEC_BIT_MARK)) {
    results->bits = 0;
    results->value = REPEAT;
    results->decode_type = NEC;
    return DECODED;
  }
  if (irparams.rawlen < 2 * NEC_BITS + 4) {
    return ERR;
  }
  // Initial space  
  if (!MATCH_SPACE(results->rawbuf[offset], NEC_HDR_SPACE)) {
    return ERR;
  }
  offset++;
  
  for (i = 0; i < NEC_BITS; i++) {
    if (!MATCH_MARK(results->rawbuf[offset], NEC_BIT_MARK)) {
      return ERR;
    }
    offset++;
    if (MATCH_SPACE(results->rawbuf[offset], NEC_ONE_SPACE)) {
      data = (data << 1) | 1;
    } 
    else if (MATCH_SPACE(results->rawbuf[offset], NEC_ZERO_SPACE)) {
      data <<= 1;
    } 
    else {
      return ERR;
    }
    offset++;
  }
  // Success
  results->bits = NEC_BITS;
  results->value = data;
  results->decode_type = NEC;
  return DECODED;
}
开发者ID:jimgregory,项目名称:pinguino-libraries,代码行数:51,代码来源:IRremote.c


注:本文中的MATCH_MARK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。