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


C++ PIRInfraredLED::addPair方法代码示例

本文整理汇总了C++中PIRInfraredLED::addPair方法的典型用法代码示例。如果您正苦于以下问题:C++ PIRInfraredLED::addPair方法的具体用法?C++ PIRInfraredLED::addPair怎么用?C++ PIRInfraredLED::addPair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PIRInfraredLED的用法示例。


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

示例1: generateStandardCommand

int ProtonProtocol::generateStandardCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // The Proton protocol contains an 8 bit address and an 8 bit command,
  // in LSB order.  Between these two is a gap made up of a 500 usec pulse
  // and a 4000 usec space.
  // - "preData" should contain the address.
  // - "firstCode" should contain the command.

  duration += pushReverseBits(preData, led);

  led.addPair(500, 4000);
  duration += 4500;

  duration += pushReverseBits(pkb.firstCode, led);

  // Finally add the "trail":
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:29,代码来源:protonprotocol.cpp

示例2: generateStandardCommand

int DaewooProtocol::generateStandardCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // The address data:
  duration += pushReverseBits(preData, led);

  // The Daewoo mid-train marker:
  led.addPair(midPulse, midSpace);
  duration += (midPulse + midSpace);

  // The command data:
  duration += pushReverseBits(pkb.firstCode, led);

  // Finally add the "trail":
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:26,代码来源:daewooprotocol.cpp

示例3: generateRepeatCommand

int DenonProtocol::generateRepeatCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // The address should be 5 bits long, and the control data 8 bits.
  // For the repeat, the control data is inverted.
  // Both are sent in LSB order.
  duration += pushReverseBits(pkb.firstCode, led);
  duration += pushInvertedReverseBits(pkb.secondCode, led);

  // Next, two One bits are sent (the inverse of the normal command):
  led.addPair(onePulse, oneSpace);
  duration += onePulse + oneSpace;

  led.addPair(onePulse, oneSpace);
  duration += onePulse + oneSpace;

  // Finally add the "trail":
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:25,代码来源:denonprotocol.cpp

示例4: generateStandardCommand

int PaceProtocol::generateStandardCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // Next, the toggle bit:
  if (keypressCount % 2)
  {
    led.addPair(onePulse, oneSpace);
    duration += (onePulse + oneSpace);
  }
  else
  {
    led.addPair(zeroPulse, zeroSpace);
    duration += (zeroPulse + zeroSpace);
  }

  // Next, three bits of pre-data:
  duration += pushBits(preData, led);

  // Next, six bits of data:
  duration += pushBits(pkb.firstCode, led);

  // Finally add the "trail":
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:34,代码来源:paceprotocol.cpp

示例5: pushBits

int RECS80Protocol::generateCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // Next, a toggle bit:
  if (keypressCount % 2)
  {
    led.addPair(zeroPulse, zeroSpace);
    duration += (zeroPulse + zeroSpace);
  }
  else
  {
    led.addPair(onePulse, oneSpace);
    duration += (onePulse + oneSpace);
  }

  // Next, the device code and command code.  The device code is three
  // bits long; the command code is six bits long.  Both are sent in MSB order.
  duration += pushBits(preData, led);
  duration += pushBits(pkb.firstCode, led);

  // Finally, add the trailing pulse:
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:33,代码来源:recs80protocol.cpp

示例6: generateFinalCommand

int XMPProtocol::generateFinalCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // an XMP final frame is basically a pair of repeat frames, but the
  // gap between them is only 13800 usec, and the "toggle" value of the
  // second frame is 9.

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(calculateChecksumOne(), led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushHalfByte(0xF, led);
  duration += pushFullByte(oemCode, led);
  duration += pushFullByte(deviceCode, led);

  led.addPair(210, 13800);
  duration += 14010;

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(
    calculateChecksumTwo(0x8, pkb.firstCode, pkb.secondCode),
    led);
  duration += pushHalfByte(0x8, led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushBits(pkb.firstCode, led);
  duration += pushBits(pkb.secondCode, led);

  led.addPair(210, 13800);
  duration += 14010;

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(calculateChecksumOne(), led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushHalfByte(0xF, led);
  duration += pushFullByte(oemCode, led);
  duration += pushFullByte(deviceCode, led);

  led.addPair(210, 13800);
  duration += 14010;

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(
    calculateChecksumTwo(0x9, pkb.firstCode, pkb.secondCode),
    led);
  duration += pushHalfByte(0x9, led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushBits(pkb.firstCode, led);
  duration += pushBits(pkb.secondCode, led);

  // Finally add the "trail":
  led.addSingle(210);
  duration += 210;

  return duration;
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:57,代码来源:xmpprotocol.cpp

示例7: pushFullByte

int XMPProtocol::pushFullByte(
  unsigned int fullByte,
  PIRInfraredLED &led)
{
  unsigned int firstSpace = 760 + (136 * (fullByte >> 4));
  unsigned int secondSpace = 760 + (136 * (fullByte & 0xF));

  led.addPair(210, firstSpace);
  led.addPair(210, secondSpace);

  return (420 + firstSpace + secondSpace);
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:12,代码来源:xmpprotocol.cpp

示例8: generateRepeatCommand

int XMPProtocol::generateRepeatCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // an XMP repeat frame is identical to the start frame, except that
  // the "toggle" value is now 8.

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(calculateChecksumOne(), led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushHalfByte(0xF, led);
  duration += pushFullByte(oemCode, led);
  duration += pushFullByte(deviceCode, led);

  led.addPair(210, 13800);
  duration += 14010;

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(
    calculateChecksumTwo(0x8, pkb.firstCode, pkb.secondCode),
    led);
  duration += pushHalfByte(0x8, led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushBits(pkb.firstCode, led);
  duration += pushBits(pkb.secondCode, led);

  // Finally add the "trail":
  led.addSingle(210);
  duration += 210;

  return duration;
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:34,代码来源:xmpprotocol.cpp

示例9: generateStandardCommand

int AiwaProtocol::generateStandardCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // From the information I've got, the "address" portion of the Aiwa protocol
  // might be split into 8-bit device and 5-bit subdevice subsections, but
  // for now, I'm just lumping both into a single 13-bit address value.
  // The command is an 8-bit value.
  // As with NEC, the address is sent LSB first, then inverted LSB first,
  // then the command is sent LSB first, then inverted LSB first.
  duration += pushReverseBits(preData, led);
  duration += pushInvertedReverseBits(preData, led);
  duration += pushReverseBits(pkb.firstCode, led);
  duration += pushInvertedReverseBits(pkb.firstCode, led);

  // Finally add the "trail":
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:27,代码来源:aiwaprotocol.cpp

示例10: generateStandardCommand

int KathreinProtocol::generateStandardCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // Kathrein protocol has four bits of address and eight bits of command.
  // As in NEC protocol, the address and command are complemented.
  // - "preData" should contain the 4-bit address
  // - "firstCode" should contain the 8-bit command
  duration += pushReverseBits(preData, led);
  duration += pushInvertedReverseBits(preData, led);
  duration += pushReverseBits(pkb.firstCode, led);
  duration += pushInvertedReverseBits(pkb.firstCode, led);

  // Finally add the "trail":
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:25,代码来源:kathreinprotocol.cpp

示例11: pushHalfByte

int XMPProtocol::pushHalfByte(
  unsigned int halfByte,
  PIRInfraredLED &led)
{
  unsigned int space = 760 + (136 * halfByte);
  led.addPair(210, space);

  return (210 + space);
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:9,代码来源:xmpprotocol.cpp

示例12: generateRepeatCommand

int NECXProtocol::generateRepeatCommand(
  PIRInfraredLED &led)
{
  int duration = 0;

  // Start with the header:
  led.addPair(headerPulse, headerSpace);
  duration += (headerPulse + headerSpace);

  // Add a "1":
  led.addPair(onePulse, oneSpace);
  duration += (onePulse + oneSpace);

  // Add the trailer:
  led.addSingle(trailerPulse);
  duration += trailerPulse;

  return duration;
}
开发者ID:lyapova,项目名称:Pierogi,代码行数:19,代码来源:necxprotocol.cpp

示例13: pushBits

int XMPProtocol::pushBits(
  const CommandSequence &bits,
  PIRInfraredLED &led)
{
  unsigned int duration = 0;

  // We can only sent 4-bit values in XMP, so need to collect bits up into
  // bundles of 4:

  unsigned int bitsValue = 0;
  int count = 0;
  CommandSequence::const_iterator i = bits.begin();

  while (i != bits.end())
  {
    if (count < 4)
    {
      bitsValue = bitsValue << 1;
      bitsValue += *i;
      ++count;
    }
    else
    {
      led.addPair(210, 760 + (136 * bitsValue));
      duration += 970 + (136 * bitsValue);

      count = 1;
      bitsValue = *i;
    }

    ++i;
  }

  if (count == 4)
  {
    led.addPair(210, 760 + (136 * bitsValue));
    duration += 970 + (136 * bitsValue);
  }

  return duration;
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:41,代码来源:xmpprotocol.cpp

示例14: generateTimerCommand

void SamsungACProtocol::generateTimerCommand(
  PIRInfraredLED &led)
{
  // First, the "header" pulse:
  led.addPair(headerPulse, headerSpace);

  // Next, the "address" information (12 bits):
  pushReverseBits(preData, led);

  // The checksum (4 bits):
  CommandSequence checksum;
  calculateTimerChecksum(checksum);
  pushReverseBits(checksum, led);

  // Push an 0xF to indicate this is a timer command.
  pushBits(timerHeader, led);

  // if this is an off timer, push the time, otherwise 0:
  if (timerCommandType == 0x4)
  {
    pushReverseBits(timerMinutes, led);
    pushReverseBits(timerHours, led);
  }
  else
  {
    pushBits(emptyTimer, led);
  }

  // if this is an on timer, push the time, otherwise 0:
  if (timerCommandType == 0x2)
  {
    pushReverseBits(timerMinutes, led);
    pushReverseBits(timerHours, led);
  }
  else
  {
    pushBits(emptyTimer, led);
  }

  // This is a hack to add in 4 bits of 0:
  pushBits(fourBitZero, led);

  // Push the timer command type:
  pushReverseBits(timerOption, led);

  // Finish off the command:
  pushBits(timerFooter, led);

  // Add the "trail":
  led.addSingle(trailerPulse);
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:51,代码来源:samsungacprotocol.cpp

示例15: generateStandardCommand

int XMPProtocol::generateStandardCommand(
  const PIRKeyBits &pkb,
  PIRInfraredLED &led)
{
  int duration = 0;

  // XMP frames have the following structure:
  // 1) The first 4 bits of the "sub-device" code
  // 2) A four-bit checksum value
  // 3) The second 4 bits of the "sub-device" code
  // 4) The four-bit value 0xF
  // 5) An eight-bit OEM code (normally 0x44)
  // 6) An eight-bit device code
  // 7) a 210 usec pulse, 13800 usec space divider
  // 8) The first 4 bits of the "sub-device" code (again)
  // 9) Another four-bit checksum value
  // 10) The four-bit toggle value
  // 11) The second 4 bits of the "sub-device" code (again)
  // 12) A pair of 8-bit command codes (often one of them will be 0)
  // All of this is sent in MSB order.
  // The checksums are constructed by adding up all the half-bytes in
  // their side of the frame to 15, taking the complement, and modding the
  // result with 16.

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(calculateChecksumOne(), led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushHalfByte(0xF, led);
  duration += pushFullByte(oemCode, led);
  duration += pushFullByte(deviceCode, led);

  led.addPair(210, 13800);
  duration += 14010;

  duration += pushHalfByte(subDeviceOne, led);
  duration += pushHalfByte(
    calculateChecksumTwo(0x0, pkb.firstCode, pkb.secondCode),
    led);
  duration += pushHalfByte(0x0, led);
  duration += pushHalfByte(subDeviceTwo, led);
  duration += pushBits(pkb.firstCode, led);
  duration += pushBits(pkb.secondCode, led);

  // Finally add the "trail":
  led.addSingle(210);
  duration += 210;

  return duration;
}
开发者ID:jpietrzak8,项目名称:Pierogi,代码行数:49,代码来源:xmpprotocol.cpp


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