Go to the documentation of this file.
32 #ifndef _IR_KASEIKYO_HPP
33 #define _IR_KASEIKYO_HPP
35 #if defined(DEBUG) && !defined(LOCAL_DEBUG)
95 #define KASEIKYO_VENDOR_ID_BITS 16
96 #define KASEIKYO_VENDOR_ID_PARITY_BITS 4
97 #define KASEIKYO_ADDRESS_BITS 12
98 #define KASEIKYO_COMMAND_BITS 8
99 #define KASEIKYO_PARITY_BITS 8
100 #define KASEIKYO_BITS (KASEIKYO_VENDOR_ID_BITS + KASEIKYO_VENDOR_ID_PARITY_BITS + KASEIKYO_ADDRESS_BITS + KASEIKYO_COMMAND_BITS + KASEIKYO_PARITY_BITS) // 48
101 #define KASEIKYO_UNIT 432 // 16 pulses of 37 kHz (432,432432) - Pronto 0x70 | 0x10
103 #define KASEIKYO_HEADER_MARK (8 * KASEIKYO_UNIT) // 3456
104 #define KASEIKYO_HEADER_SPACE (4 * KASEIKYO_UNIT) // 1728
106 #define KASEIKYO_BIT_MARK KASEIKYO_UNIT
107 #define KASEIKYO_ONE_SPACE (3 * KASEIKYO_UNIT) // 1296
108 #define KASEIKYO_ZERO_SPACE KASEIKYO_UNIT
110 #define KASEIKYO_AVERAGE_DURATION 56000
111 #define KASEIKYO_REPEAT_PERIOD 130000
112 #define KASEIKYO_REPEAT_DISTANCE (KASEIKYO_REPEAT_PERIOD - KASEIKYO_AVERAGE_DURATION) // 74 ms
113 #define KASEIKYO_MAXIMUM_REPEAT_DISTANCE (KASEIKYO_REPEAT_DISTANCE + (KASEIKYO_REPEAT_DISTANCE / 4)) // Just a guess
115 #define PANASONIC_VENDOR_ID_CODE 0x2002
116 #define DENON_VENDOR_ID_CODE 0x3254
117 #define MITSUBISHI_VENDOR_ID_CODE 0xCB23
118 #define SHARP_VENDOR_ID_CODE 0x5AAA
119 #define JVC_VENDOR_ID_CODE 0x0103
132 void IRsend::sendKaseikyo(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint16_t aVendorCode) {
137 uint8_t tVendorParity = aVendorCode ^ (aVendorCode >> 8);
138 tVendorParity = (tVendorParity ^ (tVendorParity >> 4)) & 0xF;
140 #if __INT_WIDTH__ < 32
147 tRawKaseikyoData[0] = (uint32_t) tSendValue.
UWord.
LowWord << 16 | aVendorCode;
152 tSendValue.
UWords[0] = aVendorCode;
217 #if defined(LOCAL_DEBUG)
218 Serial.print(F(
"Kaseikyo: "));
219 Serial.println(F(
"Vendor ID decode failed"));
240 uint8_t tVendorParity = tVendorId ^ (tVendorId >> 8);
241 tVendorParity = (tVendorParity ^ (tVendorParity >> 4)) & 0xF;
249 #if defined(LOCAL_DEBUG)
250 Serial.print(F(
"Kaseikyo: "));
251 Serial.println(F(
"VendorID parity, address, command + parity decode failed"));
260 #if __INT_WIDTH__ >= 32
271 #if defined(LOCAL_DEBUG)
272 Serial.print(F(
"Kaseikyo: "));
273 Serial.print(F(
"4 bit VendorID parity is not correct. Expected=0x"));
274 Serial.print(tVendorParity, HEX);
275 Serial.print(F(
" received=0x"));
277 Serial.print(F(
" VendorID=0x"));
278 Serial.println(tVendorId, HEX);
290 #if defined(LOCAL_DEBUG)
291 Serial.print(F(
"Kaseikyo: "));
292 Serial.print(F(
"8 bit parity is not correct. Expected=0x"));
293 Serial.print(tParity, HEX);
294 Serial.print(F(
" received=0x"));
296 Serial.print(F(
" address=0x"));
298 Serial.print(F(
" command=0x"));
319 #if defined(LOCAL_DEBUG)
322 #endif // _IR_KASEIKYO_HPP
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
#define MICROS_PER_TICK
microseconds per clock interrupt tick
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
#define KASEIKYO_PARITY_BITS
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
void int_fast8_t aNumberOfRepeats
#define MITSUBISHI_VENDOR_ID_CODE
void sendKaseikyo_Sharp(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with SHARP_VENDOR_ID_CODE.
#define KASEIKYO_ADDRESS_BITS
#define MICROS_IN_ONE_MILLI
struct LongUnion::@4 UByte
decode_type_t
An enum consisting of all supported formats.
#define KASEIKYO_BIT_MARK
#define KASEIKYO_REPEAT_PERIOD
void sendPulseDistanceWidth(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Sends PulseDistance frames and repeats.
IRRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send functions.
void checkForRepeatSpaceTicksAndSetFlag(uint16_t aMaximumRepeatSpaceTicks)
#define IR_DEBUG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
#define KASEIKYO_VENDOR_ID_BITS
Union to specify parts / manifestations of a 64 bit LongLong without casts and shifts.
#define PANASONIC_VENDOR_ID_CODE
#define IRDATA_FLAGS_PARITY_FAILED
The current (autorepeat) frame violated parity check.
#define IRDATA_FLAGS_EXTRA_INFO
There is extra info not contained in address and data (e.g. Kaseikyo unknown vendor ID,...
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
#define JVC_VENDOR_ID_CODE
#define PROTOCOL_IS_LSB_FIRST
bool checkHeader(PulseDistanceWidthProtocolConstants *aProtocolConstants)
bool decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
void sendKaseikyo(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats, uint16_t aVendorCode)
Address can be interpreted as sub-device << 4 + 4 bit device.
void sendKaseikyo_JVC(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with JVC_VENDOR_ID_CODE.
#define SHARP_VENDOR_ID_CODE
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
#define KASEIKYO_HEADER_SPACE
#define KASEIKYO_COMMAND_BITS
void sendPanasonic(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with PANASONIC_VENDOR_ID_CODE.
#define KASEIKYO_VENDOR_ID_PARITY_BITS
#define KASEIKYO_MAXIMUM_REPEAT_DISTANCE
#define IRDATA_FLAGS_IS_LSB_FIRST
uint16_t extra
Contains upper 16 bit of Magiquest WandID, Kaseikyo unknown vendor ID and Distance protocol (HeaderMa...
struct PulseDistanceWidthProtocolConstants KaseikyoProtocolConstants
#define KASEIKYO_ONE_SPACE
void sendKaseikyo_Mitsubishi(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with MITSUBISHI_VENDOR_ID_CODE.
IRRawlenType rawlen
counter of entries in rawbuf of last received frame.
#define KASEIKYO_HEADER_MARK
struct LongUnion::@6 UWord
void sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros, uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
#define IR_DEBUG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
#define KASEIKYO_ZERO_SPACE
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.
void sendKaseikyo_Denon(uint16_t aAddress, uint8_t aData, int_fast8_t aNumberOfRepeats)
Stub using Kaseikyo with DENON_VENDOR_ID_CODE.
#define DENON_VENDOR_ID_CODE