Example #1
0
// Send a Gree Heat Pump message.
//
// Args:
//   data: An array of bytes containing the IR command.
//   nbytes: Nr. of bytes of data in the array. (>=GREE_STATE_LENGTH)
//   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(unsigned char data[], uint16_t nbytes, uint16_t repeat) {
  if (nbytes < GREE_STATE_LENGTH)
    return;  // Not enough bytes to send a proper message.

  for (uint16_t r = 0; r <= repeat; r++) {
    // Block #1
    sendGeneric(GREE_HDR_MARK, GREE_HDR_SPACE,
                GREE_BIT_MARK, GREE_ONE_SPACE,
                GREE_BIT_MARK, GREE_ZERO_SPACE,
                0, 0,  // No Footer.
                data, 4, 38, false, 0, 50);
    // Footer #1
    sendGeneric(0, 0,  // No Header
                GREE_BIT_MARK, GREE_ONE_SPACE,
                GREE_BIT_MARK, GREE_ZERO_SPACE,
                GREE_BIT_MARK, GREE_MSG_SPACE,
                0b010, 3, 38, true, 0, false);

    // Block #2
    sendGeneric(0, 0,  // No Header for Block #2
                GREE_BIT_MARK, GREE_ONE_SPACE,
                GREE_BIT_MARK, GREE_ZERO_SPACE,
                GREE_BIT_MARK, GREE_MSG_SPACE,
                data + 4, nbytes - 4, 38, false, 0, 50);
  }
}
Example #2
0
void IRsend::sendArgo(unsigned char data[], uint16_t nbytes, uint16_t repeat) {
  // Check if we have enough bytes to send a proper message.
  if (nbytes < kArgoStateLength) return;
  // TODO(kaschmo): validate
  sendGeneric(kArgoHdrMark, kArgoHdrSpace, kArgoBitMark, kArgoOneSpace,
              kArgoBitMark, kArgoZeroSpace, 0, 0,  // No Footer.
              data, nbytes, 38, false, repeat, kDutyDefault);
}
Example #3
0
void IRsendNEC::send(unsigned long data)
{
  ATTEMPT_MESSAGE(F("sending NEC"));
  if (data==REPEAT) {
    mark (564* 16); space (564*4); mark(564);space (96000); 
  }
  else {
    sendGeneric(data,32, 564*16, 564*8, 564, 564, 564*3, 564, 38, true);
  }
};
Example #4
0
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);
  }
};
Example #5
0
// Send a Whynter message.
//
// Args:
//   data: message to be sent.
//   nbits: Nr. of bits of the message to be sent.
//   repeat: Nr. of additional times the message is to be sent.
//
// Status: STABLE
//
// Ref:
//   https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Whynter.cpp
void IRsend::sendWhynter(uint64_t data, uint16_t nbits, uint16_t repeat) {
  // Set IR carrier frequency
  enableIROut(38);

  for (uint16_t i = 0; i <= repeat; i++) {
    // (Pre-)Header
    mark(kWhynterBitMark);
    space(kWhynterZeroSpace);
    sendGeneric(
        kWhynterHdrMark, kWhynterHdrSpace, kWhynterBitMark, kWhynterOneSpace,
        kWhynterBitMark, kWhynterZeroSpace, kWhynterBitMark, kWhynterMinGap,
        kWhynterMinCommandLength - (kWhynterBitMark + kWhynterZeroSpace), data,
        nbits, 38, true, 0,  // Repeats are already handled.
        50);
  }
}
Example #6
0
// Send a Whynter message.
//
// Args:
//   data: message to be sent.
//   nbits: Nr. of bits of the message to be sent.
//   repeat: Nr. of additional times the message is to be sent.
//
// Status: STABLE
//
// Ref:
//   https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Whynter.cpp
void IRsend::sendWhynter(uint64_t data, uint16_t nbits, uint16_t repeat) {
  // Set IR carrier frequency
  enableIROut(38);
  IRtimer usecTimer = IRtimer();

  for (uint16_t i = 0; i <= repeat; i++) {
    usecTimer.reset();
    // (Pre-)Header
    mark(WHYNTER_BIT_MARK);
    space(WHYNTER_ZERO_SPACE);
    sendGeneric(WHYNTER_HDR_MARK, WHYNTER_HDR_SPACE,
                WHYNTER_BIT_MARK, WHYNTER_ONE_SPACE,
                WHYNTER_BIT_MARK, WHYNTER_ZERO_SPACE,
                WHYNTER_BIT_MARK, WHYNTER_MIN_GAP,
                data, nbits, 38, true, 0,  // Repeats are already handled.
                50);
    space(std::max(WHYNTER_MIN_COMMAND_LENGTH - WHYNTER_MIN_GAP -
                   usecTimer.elapsed(), 0U));
  }
}
Example #7
0
/*
 * Sony is backwards from most protocols. It uses a variable length mark and a fixed length space rather than
 * a fixed mark and a variable space. Our generic send will still work. According to the protocol you must send
 * Sony commands at least three times so we automatically do it here.
 */
void IRsendSony::send(unsigned long data, int nbits) {
  for(int i=0; i<3;i++)
     sendGeneric(data,nbits, 600*4, 600, 600*2, 600, 600, 600, 40, false); 
};
Example #8
0
/*
 * JVC omits the Mark/space header on repeat sending. Therefore we multiply it by 0 if it's a repeat.
 * The only device I had to test this protocol was an old JVC VCR. It would only work if at least
 * 2 frames are sent separated by 45us of "space". Therefore you should call this routine once with
 * "First=true"and it will send a first frame followed by one repeat frame. If First== false,
 * it will only send a single repeat frame.
 */
void IRsendJVC::send(unsigned long data, bool First)
{
  sendGeneric(data, 16,525*16*First, 525*8*First, 525, 525,525*3, 525, 38, true);
  delayMicroseconds(45);
  if(First) sendGeneric(data, 16,0,0, 525, 525,525*3, 525, 38, true);
}
Example #9
0
void IRsendPanasonic_Old::send(unsigned long data)
{
  sendGeneric(data,22, 833*4, 833*4, 833, 833, 833*3, 833,57, true);
};
Example #10
0
/*
 * This next section of send routines were added by Chris Young. They all use the generic send.
 */
void IRsendNECx::send(unsigned long data)
{
  sendGeneric(data,32, 564*8, 564*8, 564, 564, 564*3, 564, 38, true);
};
Example #11
0
/*
 * JVC omits the mark/space header on repeat sending. Therefore we multiply it by 0 if it's a repeat.
 * The only device I had to test this protocol was an old JVC VCR. It would only work if at least
 * 2 frames are sent separated by 45us of "space". Therefore you should call this routine once with
 * "First=true" and it will send a first frame followed by one repeat frame. If First== false,
 * it will only send a single repeat frame.
 */
void IRsendJVC::send(unsigned long data, bool First)
{
  sendGeneric(data, 16,525*16*First, 525*8*First, 525, 525,525*3, 525, 38, true);
  space(525*45);
  if(First) sendGeneric(data, 16,0,0, 525, 525,525*3, 525, 38, true);
}
Example #12
0
/*
 * Sony is backwards from most protocols. It uses a variable length mark and a fixed length space rather than
 * a fixed mark and a variable space. Our generic send will still work. According to the protocol you must send
 * Sony commands at least three times so we automatically do it here.
 */
void IRsendSony::send(unsigned long data, int nbits) {
  for(int i=0; i<3;i++){
     sendGeneric(data,nbits, 600*4, 600, 600*2, 600, 600, 600, 40, false,((nbits==8)? 22000:45000)); 
  }
};