本文整理汇总了C++中PIRInfraredLED::addSingle方法的典型用法代码示例。如果您正苦于以下问题:C++ PIRInfraredLED::addSingle方法的具体用法?C++ PIRInfraredLED::addSingle怎么用?C++ PIRInfraredLED::addSingle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PIRInfraredLED
的用法示例。
在下文中一共展示了PIRInfraredLED::addSingle方法的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;
}
示例2: 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;
}
示例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;
}
示例4: 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;
}
示例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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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);
}
示例11: 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;
}
示例12: generateRepeatCommand
int GIProtocol::generateRepeatCommand(
PIRInfraredLED &led)
{
int duration = 0;
// Add the repeat pulse:
led.addPair(repeatPulse, repeatSpace);
duration += (repeatPulse + repeatSpace);
// Add the trailer:
led.addSingle(trailerPulse);
duration += trailerPulse;
return duration;
}
示例13: generateCommand
int MitsubishiProtocol::generateCommand(
const PIRKeyBits &pkb,
PIRInfraredLED &led)
{
int duration = 0;
// For this protocol, the device code and command code are both 8 bits,
// and sent in LSB order:
duration += pushReverseBits(preData, led);
duration += pushReverseBits(pkb.firstCode, led);
// Finally add the "trail" bit:
led.addSingle(trailerPulse);
duration += trailerPulse;
return duration;
}
示例14: 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;
}
示例15: generateRepeatCommand
int KathreinProtocol::generateRepeatCommand(
const PIRKeyBits &pkb,
PIRInfraredLED &led)
{
int duration = 0;
// First, the "header" pulse:
led.addPair(headerPulse, headerSpace);
duration += (headerPulse + headerSpace);
// The Kathrein repeat block contains the 8-bit command and nothing else:
duration += pushReverseBits(pkb.firstCode, led);
// Finally add the "trail":
led.addSingle(trailerPulse);
duration += trailerPulse;
return duration;
}