Go to the documentation of this file.
38 #ifndef _IR_MAGIQUEST_HPP
39 #define _IR_MAGIQUEST_HPP
87 #define MAGIQUEST_CHECKSUM_BITS 8 // magiquest_t.cmd.checksum
88 #define MAGIQUEST_MAGNITUDE_BITS 9 // magiquest_t.cmd.magnitude
89 #define MAGIQUEST_WAND_ID_BITS 31 // magiquest_t.cmd.wand_id -> wand-id is handled as 32 bit and always even
90 #define MAGIQUEST_START_BITS 8 // magiquest_t.cmd.StartBits
92 #define MAGIQUEST_PERIOD 1150 // Time for a full MagiQuest "bit" (1100 - 1200 usec)
94 #define MAGIQUEST_DATA_BITS (MAGIQUEST_CHECKSUM_BITS + MAGIQUEST_MAGNITUDE_BITS + MAGIQUEST_WAND_ID_BITS) // 48 Size of the command without the start bits
95 #define MAGIQUEST_BITS (MAGIQUEST_CHECKSUM_BITS + MAGIQUEST_MAGNITUDE_BITS + MAGIQUEST_WAND_ID_BITS + MAGIQUEST_START_BITS) // 56 Size of the command with the start bits
107 #define MAGIQUEST_UNIT (MAGIQUEST_PERIOD / 4) // 287.5
109 #define MAGIQUEST_ONE_MARK (2 * MAGIQUEST_UNIT) // 576
110 #define MAGIQUEST_ONE_SPACE (2 * MAGIQUEST_UNIT) // 576
111 #define MAGIQUEST_ZERO_MARK MAGIQUEST_UNIT // 287.5
112 #define MAGIQUEST_ZERO_SPACE (3 * MAGIQUEST_UNIT) // 864
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;
170 #if defined(USE_THRESHOLD_DECODER)
176 DEBUG_PRINT(F(
"MagiQuest: Not 8 leading zero start bits received, RawData=0x"));
185 #if defined(USE_THRESHOLD_DECODER)
192 uint8_t tChecksum = tDecodedRawData.
Bytes[0] + tDecodedRawData.
Bytes[1] + tDecodedRawData.
Bytes[2] + tDecodedRawData.
Bytes[3];
205 #if defined(USE_THRESHOLD_DECODER)
216 tChecksum += tDecodedRawData.
UBytes[2] + tDecodedRawData.
UBytes[1] + tDecodedRawData.
UBytes[0];
217 if (tChecksum != 0) {
239 #endif // _IR_MAGIQUEST_HPP
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
#define SUPPRESS_STOP_BIT
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
#define PROTOCOL_IS_MSB_FIRST
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
#define MAGIQUEST_MAGNITUDE_BITS
void decodePulseDistanceWidthData_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
#define MAGIQUEST_ZERO_MARK
void sendMagiQuest(uint32_t aWandId, uint16_t aMagnitude)
#define MAGIQUEST_ONE_MARK
#define IRDATA_FLAGS_PARITY_FAILED
The current (autorepeat) frame violated parity check.
#define MAGIQUEST_ZERO_SPACE
#define MAGIQUEST_WAND_ID_BITS
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
IRDecodedRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send<protocol>Raw functions.
#define MAGIQUEST_ONE_SPACE
void sendPulseDistanceWidthData_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRDecodedRawDataType aData, uint_fast8_t aNumberOfBits)
#define DEBUG_PRINTLN(...)
#define IRDATA_FLAGS_IS_MSB_FIRST
Value is mainly determined by the (known) protocol.
uint16_t extra
Contains upper 16 bit of Magiquest WandID, Kaseikyo unknown vendor ID and Distance protocol (HeaderMa...
struct PulseDistanceWidthProtocolConstants const MagiQuestProtocolConstants PROGMEM
#define PROTOCOL_IS_PULSE_DISTANCE_WIDTH
IRRawlenType rawlen
Counter of entries in rawbuf of last received frame.
#define MAGIQUEST_CHECKSUM_BITS
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.
#define MAGIQUEST_START_BITS