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


C++ enableIROut函数代码示例

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


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

示例1: enableIROut

void IRsend::sendVOLTAS(unsigned long address,unsigned long data)
{
    enableIROut(38);
    mark(VOLTAS_HDR_MARK);
    space(VOLTAS_HDR_SPACE); 

    address <<= 12;
    for (int i = 0; i < 20; i++) {
        if (address & TOPBIT) {
            mark(VOLTAS_BIT_MARK);
            space(VOLTAS_ONE_SPACE); 
        } 
        else {
            mark(VOLTAS_BIT_MARK);
            space(VOLTAS_ZERO_SPACE); 
        }
        address <<= 1;
    }

    for (int i = 0; i < 32; i++) {
        if (data & TOPBIT) {
            mark(VOLTAS_BIT_MARK);
            space(VOLTAS_ONE_SPACE); 
        } 
        else {
            mark(VOLTAS_BIT_MARK);
            space(VOLTAS_ZERO_SPACE); 
        }
        data <<= 1;
    }
    mark(VOLTAS_BIT_MARK);
    space(VOLTAS_HDR_SPACE); 
    mark(VOLTAS_BIT_MARK);
    space(0);
}
开发者ID:BIKRAM8891,项目名称:Smart-Energy-Hackathon,代码行数:35,代码来源:IRremote.cpp

示例2: enableIROut

/*
 * Most of the protocols have a header consisting of a mark/space of a particular length followed by 
 * a series of variable length mark/space signals.  Depending on the protocol they very the lengths of the 
 * mark or the space to indicate a data bit of "0" or "1". Most also end with a stop bit of "1".
 * The basic structure of the sending and decoding these protocols led to lots of redundant code. 
 * Therefore I have implemented generic sending and decoding routines. You just need to pass a bunch of customized 
 * parameters and it does the work. This reduces compiled code size with only minor speed degradation. 
 * You may be able to implement additional protocols by simply passing the proper values to these generic routines.
 * The decoding routines do not encode stop bits. So you have to tell this routine whether or not to send one.
 */
void IRsendBase::sendGeneric(unsigned long data, unsigned char Num_Bits, unsigned int Head_Mark, unsigned int Head_Space, 
                             unsigned int Mark_One, unsigned int Mark_Zero, unsigned int Space_One, unsigned int Space_Zero, 
							 unsigned char kHz, bool Use_Stop, unsigned long Max_Extent) {
  Extent=0;
  data = data << (32 - Num_Bits);
  enableIROut(kHz);
//Some protocols do not send a header when sending repeat codes. So we pass a zero value to indicate skipping this.
  if(Head_Mark) mark(Head_Mark); 
  if(Head_Space) space(Head_Space);
  for (int i = 0; i <Num_Bits; i++) {
    if (data & TOPBIT) {
      mark(Mark_One);  space(Space_One);
    } 
    else {
      mark(Mark_Zero);  space(Space_Zero);
    }
    data <<= 1;
  }
  if(Use_Stop) mark(Mark_One);   //stop bit of "1"
  if(Max_Extent) {
#ifdef IRLIB_TRACE
    Serial.print("Max_Extent="); Serial.println(Max_Extent);
	Serial.print("Extent="); Serial.println(Extent);
	Serial.print("Difference="); Serial.println(Max_Extent-Extent);
#endif
	space(Max_Extent-Extent); 
	}
	else space(Space_One);
};
开发者ID:AlfredSch,项目名称:Arduino,代码行数:39,代码来源:IRLib.cpp

示例3: enableIROut

void  IRsend::sendRC6 (unsigned long data,  int nbits)
{
	// Set IR carrier frequency
	enableIROut(36);

	// Header
	mark(RC6_HDR_MARK);
	space(RC6_HDR_SPACE);

	// Start bit
	mark(RC6_T1);
	space(RC6_T1);

	// Data
	for (unsigned long  i = 1, mask = 1UL << (nbits - 1);  mask;  i++, mask >>= 1) {
		// The fourth bit we send is a "double width trailer bit"
		int  t = (i == 4) ? (RC6_T1 * 2) : (RC6_T1) ;
		if (data & mask) {
			mark(t);
			space(t);
		} else {
			space(t);
			mark(t);
		}
	}

	space(0);  // Always end with the LED off
}
开发者ID:soif,项目名称:MySensors_HSV_RGB_IR,代码行数:28,代码来源:ir_RC5_RC6.cpp

示例4: setup

void setup() {

	DDRD  |= 0b01000000;	// ������� ��������� 
	PORTD &= 0b10111111;	// ������� ���������

	DDRD  |= 0b00100000;	// ����� �������
	PORTD &= 0b11011111;	// ����� �������

	DDRD  |= 0b00010000;	// ��������� ��
	PORTD &= 0b11101111;	// ��������� ��


	DDRD  &= 0b11111011;	// ������
	PORTD |= 0b00000100;	// ������
  
	enableIROut(56);	
	enableIRIn();

	//���������� ��� ���� ISCxx
	//����������� �� ������������ INT0 �� ������� ������
	MCUCR &= ~( (1<<ISC11)|(1<<ISC10)|(1<<ISC01)|(1<<ISC00) );

	//��������� ������� ���������� INT0
	GICR |= (1<<INT0);
	//���������� ���� ����������� ���������� ����������

	PT_INIT(&ptIRReceive);
	PT_INIT(&ptWaitForTrigger);
	PT_INIT(&ptExplode);
	PT_INIT(&ptFinder);
	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  
  
} 
开发者ID:schernushenko,项目名称:lt_grenade,代码行数:34,代码来源:Grenade_19_05_new.cpp

示例5: enableIROut

//Modified Samsung TV send code found in comments on http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
void IRsend::sendSamsung(unsigned long data, int nbits)
{
	enableIROut(38);
	mark(SAMSUNG_HDR_MARK);
	space(SAMSUNG_HDR_SPACE);
	if (data == REPEAT)
	{
		mark(SAMSUNG_BIT_MARK);
		space(SAMSUNG_ZERO_SPACE);
	}
	else
	{
		for (int i = 0; i < nbits; i++)
		{
			if (data & TOPBIT) {
				mark(SAMSUNG_BIT_MARK);
				space(SAMSUNG_ONE_SPACE);
			} 
			else {
				mark(SAMSUNG_BIT_MARK);
				space(SAMSUNG_ZERO_SPACE);
			}
				data <<= 1;
		}		
	}
	mark(SAMSUNG_BIT_MARK);
	space(0);
}
开发者ID:DragonShadesX,项目名称:Arduino-Laser-Tag,代码行数:29,代码来源:IRremote2.cpp

示例6: enableIROut

void  IRsend::sendPanasonic (unsigned int address,  unsigned long data)
{
	// Set IR carrier frequency
	enableIROut(35);

	// Header
	mark(PANASONIC_HDR_MARK);
	space(PANASONIC_HDR_SPACE);

	// Address
	for (unsigned long  mask = 1UL << (16 - 1);  mask;  mask >>= 1) {
		mark(PANASONIC_BIT_MARK);
		if (address & mask)  space(PANASONIC_ONE_SPACE) ;
		else                 space(PANASONIC_ZERO_SPACE) ;
    }

	// Data
	for (unsigned long  mask = 1UL << (32 - 1);  mask;  mask >>= 1) {
        mark(PANASONIC_BIT_MARK);
        if (data & mask)  space(PANASONIC_ONE_SPACE) ;
        else              space(PANASONIC_ZERO_SPACE) ;
    }

	// Footer
    mark(PANASONIC_BIT_MARK);
    space(0);  // Always end with the LED off
}
开发者ID:DrDiettrich,项目名称:Arduino-IRremote,代码行数:27,代码来源:ir_Panasonic.cpp

示例7: enableIROut

// Send a Gree Heat Pump message.
//
// Args:
//   data: The raw message to be sent.
//   nbits: Nr. of bits of data in the message. (Default is GREE_BITS)
//   repeat: Nr. of times the message is to be repeated. (Default = 0).
//
// Status: ALPHA / Untested.
//
// Ref:
//   https://github.com/ToniA/arduino-heatpumpir/blob/master/GreeHeatpumpIR.cpp
void IRsend::sendGree(uint64_t data, uint16_t nbits, uint16_t repeat) {
  if (nbits != GREE_BITS)
    return;  // Wrong nr. of bits to send a proper message.
  // Set IR carrier frequency
  enableIROut(38);

  for (uint16_t r = 0; r <= repeat; r++) {
    // Header
    mark(GREE_HDR_MARK);
    space(GREE_HDR_SPACE);

    // Data
    for (int16_t i = 8; i <= nbits; i += 8) {
      sendData(GREE_BIT_MARK, GREE_ONE_SPACE, GREE_BIT_MARK, GREE_ZERO_SPACE,
               (data >> (nbits - i)) & 0xFF, 8, false);
      if (i == nbits / 2) {
        // Send the mid-message Footer.
        sendData(GREE_BIT_MARK, GREE_ONE_SPACE, GREE_BIT_MARK, GREE_ZERO_SPACE,
                 0b010, 3);
        mark(GREE_BIT_MARK);
        space(GREE_MSG_SPACE);
      }
    }
    // Footer
    mark(GREE_BIT_MARK);
    space(GREE_MSG_SPACE);
  }
}
开发者ID:gnkarn,项目名称:IRremoteESP8266,代码行数:39,代码来源:ir_Gree.cpp

示例8: enableIROut

// Calculate & set any offsets to account for execution times.
//
// Args:
//   hz: The frequency to calibrate at >= 1000Hz. Default is 38000Hz.
//
// Status:  ALPHA / Untested.
//
// NOTE:
//   This will generate an 65535us mark() IR LED signal.
//   This only needs to be called once, if at all.
void IRsend::calibrate(uint16_t hz) {
  if (hz < 1000)  // Were we given kHz? Supports the old call usage.
    hz *= 1000;
  periodOffset = 0;  // Turn off any existing offset while we calibrate.
  enableIROut(hz);
  IRtimer usecTimer = IRtimer();  // Start a timer *just* before we do the call.
  uint16_t pulses = mark(UINT16_MAX);  // Generate a PWM of 65,535 us. (Max.)
  uint32_t timeTaken = usecTimer.elapsed();  // Record the time it took.
  // While it shouldn't be neccesary, assume at least 1 pulse, to avoid a
  // divide by 0 situation.
  pulses = std::max(pulses, (uint16_t) 1U);
  uint32_t calcPeriod = calcUSecPeriod(hz);  // e.g. @38kHz it should be 26us.
  // Assuming 38kHz for the example calculations:
  // In a 65535us pulse, we should have 2520.5769 pulses @ 26us periods.
  // e.g. 65535.0us / 26us = 2520.5769
  // This should have caused approx 2520 loops through the main loop in mark().
  // The average over that many interations should give us a reasonable
  // approximation at what offset we need to use to account for instruction
  // execution times.
  //
  // Calculate the actual period from the actual time & the actual pulses
  // generated.
  double_t actualPeriod = (double_t) timeTaken / (double_t) pulses;
  // Store the difference between the actual time per period vs. calculated.
  periodOffset = (int8_t) ((double_t) calcPeriod - actualPeriod);
}
开发者ID:Eroc33,项目名称:fishy-wifi,代码行数:36,代码来源:IRsend.cpp

示例9: enableIROut

void IRsend::sendSharp(unsigned long data, int nbits) {
  unsigned long invertdata = data ^ SHARP_TOGGLE_MASK;
  enableIROut(38);
  for (int i = 0; i < nbits; i++) {
    if (data & 0x4000) {
      mark(SHARP_BIT_MARK);
      space(SHARP_ONE_SPACE);
    }
    else {
      mark(SHARP_BIT_MARK);
      space(SHARP_ZERO_SPACE);
    }
    data <<= 1;
  }
  
  mark(SHARP_BIT_MARK);
  space(SHARP_ZERO_SPACE);
  delay(46);
  for (int i = 0; i < nbits; i++) {
    if (invertdata & 0x4000) {
      mark(SHARP_BIT_MARK);
      space(SHARP_ONE_SPACE);
    }
    else {
      mark(SHARP_BIT_MARK);
      space(SHARP_ZERO_SPACE);
    }
    invertdata <<= 1;
  }
  mark(SHARP_BIT_MARK);
  space(SHARP_ZERO_SPACE);
  delay(46);
}
开发者ID:Kumpjrk,项目名称:Arduino-IRremote,代码行数:33,代码来源:IRremote.cpp

示例10: enableIROut

// Send a Philips RC-MM packet.
//
// Args:
//   data: The data we want to send. MSB first.
//   nbits: The number of bits of data to send. (Typically 12, 24, or 32[Nokia])
//   repeat: The nr. of times the message should be sent.
//
// Status:  BETA / Should be working.
//
// Ref:
//   http://www.sbprojects.com/knowledge/ir/rcmm.php
void IRsend::sendRCMM(uint64_t data, uint16_t nbits, uint16_t repeat) {
  // Set 36kHz IR carrier frequency & a 1/3 (33%) duty cycle.
  enableIROut(36, 33);
  IRtimer usecs = IRtimer();

  for (uint16_t r = 0; r <= repeat; r++) {
    usecs.reset();
    // Header
    mark(RCMM_HDR_MARK);
    space(RCMM_HDR_SPACE);
    // Data
    uint64_t mask = 0b11ULL << (nbits - 2);
    // RC-MM sends data 2 bits at a time.
    for (int32_t i = nbits; i > 0; i -= 2) {
      mark(RCMM_BIT_MARK);
      // Grab the next Most Significant Bits to send.
      switch ((data & mask) >> (i - 2)) {
        case 0b00: space(RCMM_BIT_SPACE_0); break;
        case 0b01: space(RCMM_BIT_SPACE_1); break;
        case 0b10: space(RCMM_BIT_SPACE_2); break;
        case 0b11: space(RCMM_BIT_SPACE_3); break;
      }
      mask >>= 2;
    }
    // Footer
    mark(RCMM_BIT_MARK);
    // Protocol requires us to wait at least RCMM_RPT_LENGTH usecs from the
    // start or RCMM_MIN_GAP usecs.
    space(std::max(RCMM_RPT_LENGTH - usecs.elapsed(), RCMM_MIN_GAP));
  }
}
开发者ID:Eroc33,项目名称:fishy-wifi,代码行数:42,代码来源:ir_RCMM.cpp

示例11: enableIROut

// Caller needs to take care of flipping the toggle bit
void IRsend::sendRC6(unsigned long data, int nbits)
{
  enableIROut(36);
  data = data << (32 - nbits);
  mark(RC6_HDR_MARK);
  space(RC6_HDR_SPACE);
  mark(RC6_T1); // start bit
  space(RC6_T1);
  int t;
  for (int i = 0; i < nbits; i++) {
    if (i == 3) {
      // double-wide trailer bit
      t = 2 * RC6_T1;
    } 
    else {
      t = RC6_T1;
    }
    if (data & TOPBIT) {
      mark(t);
      space(t);
    } 
    else {
      space(t);
      mark(t);
    }

    data <<= 1;
  }
  space(0); // Turn off at end
}
开发者ID:DanGomez21,项目名称:ArduBot,代码行数:31,代码来源:IRremote.cpp

示例12: enableIROut

void IRsend::sendApple(unsigned long data, int nbits,int repeat){
  enableIROut(38);

  if (repeat == 0) {
    mark(APPLE_HDR_MARK);
    space(APPLE_HDR_SPACE);
  }  else {
    mark(APPLE_REPEAT_MARK);
    space(APPLE_REPEAT_SPACE);  
  }
  
  //PRE DATA
  unsigned long pre_data = 0x77E1;
  pre_data <<= 16;
  for (int i = 0; i < 16; i++) {
    if (pre_data & TOPBIT) {
      mark(APPLE_ONE_MARK);
      space(APPLE_ONE_SPACE);
    } 
    else {
      mark(APPLE_ONE_MARK);
      space(APPLE_ZERO_SPACE);
    }
    pre_data <<= 1;
  }
  
  //BODY
  data <<= nbits;
  for (int i = 0; i < nbits; i++) {
    if (data & TOPBIT) {
      mark(APPLE_ONE_MARK);
      space(APPLE_ONE_SPACE);
    } 
    else {
      mark(APPLE_ONE_MARK);
      space(APPLE_ZERO_SPACE);
    }
    data <<= 1;
  }

  //POST DATA
  unsigned long post_data = 0x49;
  post_data <<= 8;
  for (int i = 0; i < 8; i++) {
    if (post_data & TOPBIT) {
      mark(APPLE_ONE_MARK);
      space(APPLE_ONE_SPACE);
    } 
    else {
      mark(APPLE_ONE_MARK);
      space(APPLE_ZERO_SPACE);
    }
    post_data <<= 1;
  }

  mark(APPLE_PTRAIL);
  space(APPLE_GAP);  //gap
}
开发者ID:partriv,项目名称:Arduino-IRremote,代码行数:58,代码来源:IRremote.cpp

示例13: enableIROut

void IRsendNEC::send(unsigned long data)
{
  if (data==REPEAT) {
    enableIROut(38);
    mark (564* 16); space(564*4); mark(564);space(56*173);
  }
  else {
    sendGeneric(data,32, 564*16, 564*8, 564, 564, 564*3, 564, 38, true);
  }
};
开发者ID:KeyJay86,项目名称:woerdclock-software,代码行数:10,代码来源:IRLib.cpp

示例14: enableIROut

void IRsend::sendRaw(unsigned int buf[], int len, int hz){
  enableIROut(hz);
  for (int i = 0; i < len; i++) {
    if (i & 1) {
      space(buf[i]);
    } 
    else {
      mark(buf[i]);
    }
  }
  space(0); // Just to be sure
}
开发者ID:kwonsin,项目名称:arduino,代码行数:12,代码来源:IRremote.cpp

示例15: enableIROut

//+=============================================================================
void  IRsend::sendRaw (unsigned int buf[],  int len,  int hz)
{
	// Set IR carrier frequency
	enableIROut(hz);

	for (int i = 0;  i < len;  i++) {
		if (i & 1)  space(buf[i]) ;
		else        mark (buf[i]) ;
	}

	space(0);  // Always end with the LED off
}
开发者ID:canrobot,项目名称:Eduino,代码行数:13,代码来源:irSend.cpp


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