MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / sendMagiQuest

Method sendMagiQuest

src/ir_MagiQuest.hpp:124–146  ·  view source on GitHub ↗

+============================================================================= * @param aWandId 31 bit ID * @param aMagnitude 9 bit Magnitude */

Source from the content-addressed store, hash-verified

122 * @param aMagnitude 9 bit Magnitude
123 */
124void IRsend::sendMagiQuest(uint32_t aWandId, uint16_t aMagnitude) {
125
126 // Set IR carrier frequency
127 enableIROut(38);
128
129 aMagnitude &= 0x1FF; // we have 9 bit
130 LongUnion tWandId;
131 tWandId.ULong = aWandId << 1;
132 uint8_t tChecksum = (tWandId.Bytes[0]) + tWandId.Bytes[1] + tWandId.Bytes[2] + tWandId.Bytes[3];
133 tChecksum += aMagnitude + (aMagnitude >> 8);
134 tChecksum = ~tChecksum + 1;
135
136 // 8 start bits
137 sendPulseDistanceWidthData_P(&MagiQuestProtocolConstants, 0, 8);
138 // 48 bit data
139 sendPulseDistanceWidthData_P(&MagiQuestProtocolConstants, aWandId, MAGIQUEST_WAND_ID_BITS); // send only 31 bit, do not send MSB here
140 sendPulseDistanceWidthData_P(&MagiQuestProtocolConstants, aMagnitude, MAGIQUEST_MAGNITUDE_BITS);
141 sendPulseDistanceWidthData_P(&MagiQuestProtocolConstants, tChecksum, MAGIQUEST_CHECKSUM_BITS);
142
143 // must be after sending, in order not to destroy the send timing
144 DEBUG_PRINT(F("MagiQuest checksum=0x"));
145 DEBUG_PRINTLN(tChecksum, HEX);
146}
147
148//+=============================================================================
149//

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected