// 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)); } }
// Send a Mitsubishi message // // Args: // data: Contents of the message to be sent. // nbits: Nr. of bits of data to be sent. Typically MITSUBISHI_BITS. // repeat: Nr. of additional times the message is to be sent. // // Status: ALPHA / untested. // // Notes: // This protocol appears to have no header. // Ref: // https://github.com/marcosamarinho/IRremoteESP8266/blob/master/ir_Mitsubishi.cpp // GlobalCache's Control Tower's Mitsubishi TV data. void IRsend::sendMitsubishi(uint64_t data, uint16_t nbits, uint16_t repeat) { enableIROut(33); // Set IR carrier frequency IRtimer usecTimer = IRtimer(); for (uint16_t i = 0; i <= repeat; i++) { usecTimer.reset(); // No header // Data sendData(MITSUBISHI_BIT_MARK, MITSUBISHI_ONE_SPACE, MITSUBISHI_BIT_MARK, MITSUBISHI_ZERO_SPACE, data, nbits, true); // Footer mark(MITSUBISHI_BIT_MARK); space(std::max(MITSUBISHI_MIN_COMMAND_LENGTH - usecTimer.elapsed(), MITSUBISHI_MIN_GAP)); } }
// 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)); } }