• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ enableIROut函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: enableIROut

void IRsend::sendRaw(const uint16_t *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:Robotonics,项目名称:Ir_Remote,代码行数:13,代码来源:IRremote.cpp


示例17: enableIROut

// Send a Pronto Code formatted message.
//
// Args:
//   data: An array of uint16_t containing the pronto codes.
//   len: Nr. of entries in the data[] array.
//   repeat: Nr. of times to repeat the message.
//
// Status: ALPHA / Not tested in the real world.
//
// Note:
//   Pronto codes are typically represented in hexadecimal.
//   You will need to convert the code to an array of integers, and calculate
//   it's length.
//   e.g.
//      A Sony 20 bit DVD remote command.
//      "0000 0067 0000 0015 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018
//       0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0030 0018
//       0030 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018
//       0030 0018 0018 03f6"
//
//   converts to:
//
//       uint16_t prontoCode[46] = {
//           0x0000, 0x0067, 0x0000, 0x0015,
//           0x0060, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0030, 0x0018,
//           0x0030, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018,
//           0x0018, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018,
//           0x0030, 0x0018, 0x0030, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
//           0x0030, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0030, 0x0018,
//           0x0018, 0x03f6};
//       // Send the Pronto(Sony) code. Repeat twice as Sony's require that.
//       sendPronto(prontoCode, 46, SONY_MIN_REPEAT);
//
// Ref:
//   http://www.etcwiki.org/wiki/Pronto_Infrared_Format
//   http://www.remotecentral.com/features/irdisp2.htm
void IRsend::sendPronto(uint16_t data[], uint16_t len, uint16_t repeat) {
  // Check we have enough data to work out what to send.
  if (len < PRONTO_MIN_LENGTH) return;

  // We only know how to deal with 'raw' pronto codes types. Reject all others.
  if (data[PRONTO_TYPE_OFFSET] != 0) return;

  // Pronto frequency is in Hz.
  uint16_t hz = (uint16_t) (1000000U / (data[PRONTO_FREQ_OFFSET] *
                                        PRONTO_FREQ_FACTOR));
  enableIROut(hz);

  // Grab the length of the two sequences.
  uint16_t seq_1_len = data[PRONTO_SEQ_1_LEN_OFFSET] * 2;
  uint16_t seq_2_len = data[PRONTO_SEQ_2_LEN_OFFSET] * 2;
  // Calculate where each sequence starts in the buffer.
  uint16_t seq_1_start = PRONTO_DATA_OFFSET;
  uint16_t seq_2_start = PRONTO_DATA_OFFSET + seq_1_len;

  uint32_t periodic_time = calcUSecPeriod(hz, false);

  // Normal (1st sequence) case.
  // Is there a first (normal) sequence to send?
  if (seq_1_len > 0) {
    // Check we have enough data to send the complete first sequence.
    if (seq_1_len + seq_1_start > len) return;
    // Send the contents of the 1st sequence.
    for (uint16_t i = seq_1_start; i < seq_1_start + seq_1_len; i += 2) {
      mark(data[i] * periodic_time);
      space(data[i + 1] * periodic_time);
    }
  } else {
    // There was no first sequence to send, it is implied that we have to send
    // the 2nd/repeat sequence an additional time. i.e. At least once.
    repeat++;
  }

  // Repeat (2nd sequence) case.
  // Is there a second (repeat) sequence to be sent?
  if (seq_2_len > 0) {
    // Check we have enough data to send the complete second sequence.
    if (seq_2_len + seq_2_start > len) return;

    // Send the contents of the 2nd sequence.
    for (uint16_t r = 0; r < repeat; r++)
      for (uint16_t i = seq_2_start; i < seq_2_start + seq_2_len; i += 2) {
        mark(data[i] * periodic_time);
        space(data[i + 1] * periodic_time);
      }
  }
}
开发者ID:gnkarn,项目名称:IRremoteESP8266,代码行数:87,代码来源:ir_Pronto.cpp


示例18: enableIROut

// Caller needs to take care of flipping the toggle bit
void IRsend::sendRCMM(unsigned long data, int nbits)
{
	enableIROut(36);
    data = data << (32 - nbits);
	mark(RCMM_HDR_MARK);
	space(RCMM_SPACE);
	for (int i = 0; i < nbits; i += 2) {
		mark(RCMM_MARK);
		space(RCMM_SPACE+(data >> 30)*RCMM_INCREMENT);
		data <<= 2;
	}
	mark(RCMM_MARK);
	space(0);
}
开发者ID:microtherion,项目名称:Arduino-IRremote,代码行数:15,代码来源:IRremote.cpp


示例19: sendRaw

////////////////////////
//IRsend::sendRaw
////////////////////////
void ICACHE_FLASH_ATTR sendRaw(unsigned int buf[], int len, int hz)
{
  int i;
  enableIROut(hz);
  for (i = 0; i < len; i++) {
    if (i & 1) {
      space(buf[i]);
    }
    else {
      mark(buf[i]);
    }
  }
  space(1); // Just to be sure
}
开发者ID:branux,项目名称:ESP8266-IR-Remote-Test-Code,代码行数:17,代码来源:EspIRremote.c


示例20: enableIROut

void SLifiSender::send(unsigned long data, int nbits)
{
#if 0
	enableIROut(38);
	mark(SAMSUNG_HDR_MARK);  // 5000microSec MARK
	space(SAMSUNG_HDR_SPACE); // 5000microSec SPACE
	for (int i = 0; i < nbits; i++) {
		if (data & TOPBIT) { // 10000000000000000000000000000000 bit
			mark(SAMSUNG_BIT_MARK); // 560microSec MARK
			space(SAMSUNG_ONE_SPACE); // 1600microSec SPACE
		}
		else {
			mark(SAMSUNG_BIT_MARK); // 560microSec MARK
			space(SAMSUNG_ZERO_SPACE); // 560microSec SPACE
		}
		data <<= 1;
	}
	mark(SAMSUNG_BIT_MARK);
	space(0);
#else
	enableIROut(40);
	mark(HEADER_MARK);
	space(SONY_HDR_SPACE);
	data = data << (32 - nbits);
	for (int i = 0; i < nbits; i++) {
		if (data & TOPBIT) {
			mark(SONY_ONE_MARK);
			space(SONY_HDR_SPACE);
		}
		else {
			mark(SONY_ZERO_MARK);
			space(SONY_HDR_SPACE);
		}
		data <<= 1;
	}
#endif
}
开发者ID:jinsu0000,项目名称:LIFI,代码行数:37,代码来源:SLifiSender.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ enableInterrupts函数代码示例发布时间:2022-05-30
下一篇:
C++ enableControls函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap