IRremote
ir_Others.hpp
Go to the documentation of this file.
1 /*
2  * ir_Others.hpp
3  *
4  * Contains functions for miscellaneous protocols
5  *
6  * This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
7  *
8  ************************************************************************************
9  * MIT License
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a copy
12  * of this software and associated documentation files (the "Software"), to deal
13  * in the Software without restriction, including without limitation the rights
14  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15  * copies of the Software, and to permit persons to whom the Software is furnished
16  * to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in all
19  * copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
22  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
26  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  *
28  ************************************************************************************
29  */
30 
35 #ifndef _IR_OTHERS_HPP
36 #define _IR_OTHERS_HPP
37 //==============================================================================
38 // DDDD IIIII SSSS H H
39 // D D I S H H
40 // D D I SSS HHHHH
41 // D D I S H H
42 // DDDD IIIII SSSS H H
43 //==============================================================================
44 
45 // DISH support by Todd Treece
46 //
47 // The send function needs to be repeated 4 times
48 // Only send the last for characters of the hex.
49 // I.E. Use 0x1C10 instead of 0x0000000000001C10 as listed in the LIRC file.
50 // Here is the LIRC file I found that seems to match the remote codes from the
51 // oscilloscope: DISH NETWORK (echostar 301):
52 // http://lirc.sourceforge.net/remotes/echostar/301_501_3100_5100_58xx_59xx
53 #define DISH_BITS 16
54 #define DISH_HEADER_MARK 400
55 #define DISH_HEADER_SPACE 6100
56 #define DISH_BIT_MARK 400
57 #define DISH_ONE_SPACE 1700
58 #define DISH_ZERO_SPACE 2800
59 #define DISH_REPEAT_SPACE 6200 // really?
60 
63 
64 void IRsend::sendDish(uint16_t aData) {
65  sendPulseDistanceWidth_P(&DishProtocolConstants, aData, DISH_BITS, 4);
66 }
67 
68 //==============================================================================
69 // W W H H Y Y N N TTTTT EEEEE RRRRR
70 // W W H H Y Y NN N T E R R
71 // W W W HHHHH Y N N N T EEE RRRR
72 // W W W H H Y N NN T E R R
73 // WWW H H Y N N T EEEEE R R
74 //==============================================================================
75 // Whynter A/C ARC-110WD added by Francesco Meschia
76 // see https://docs.google.com/spreadsheets/d/1dsr4Jh-nzC6xvSKGpLlPBF0NRwvlpyw-ozg8eZU813w/edit#gid=0
77 // Looking at the code table the protocol is LSB first with start and stop bit.
78 // 4 bit checksum, constant address 0xAA00, 8 bit Command and 4 bit Command group
79 // but we use MSB first to be backwards compatible
80 #define WHYNTER_BITS 32
81 #define WHYNTER_HEADER_MARK 2850
82 #define WHYNTER_HEADER_SPACE 2850
83 #define WHYNTER_BIT_MARK 750
84 #define WHYNTER_ONE_SPACE 2150
85 #define WHYNTER_ZERO_SPACE 750
86 
89 
90 void IRsend::sendWhynter(uint32_t aData, int_fast8_t aNumberOfRepeats) {
91  sendPulseDistanceWidth_P(&WhynterProtocolConstants, aData, NEC_BITS, aNumberOfRepeats);
92 }
93 
95  // Check we have the right amount of data (68). The +4 is for initial gap, start bit mark and space + stop bit mark.
96  if (decodedIRData.rawlen != (2 * WHYNTER_BITS) + 4) {
97  return false;
98  }
99  if (!checkHeader_P(&WhynterProtocolConstants)) {
100  return false;
101  }
102  decodePulseDistanceWidthData_P(&WhynterProtocolConstants, WHYNTER_BITS);
103 
107  return true;
108 }
109 
140 // All timings are in microseconds
141 #define VELUX_BITS 24 // We have pulse width, so we have no stop bit
142 #define VELUX_HEADER_MARK 0
143 #define VELUX_HEADER_SPACE 0
144 #define VELUX_UNIT 425
145 #define VELUX_ONE_MARK (3*VELUX_UNIT) // 1275
146 #define VELUX_ONE_SPACE VELUX_UNIT
147 #define VELUX_ZERO_MARK VELUX_UNIT
148 #define VELUX_ZERO_SPACE (3*VELUX_UNIT)
149 #define VELUX_PERIOD ((23 * 4) + 1 ) * VELUX_UNIT) // 39525
150 #define VELUX_AUTOREPEAT_SPACE 27000 // 27ms
151 #define VELUX_REPEAT_SPACE 100000 // 100ms, which is just a guess
152 
153 struct PulseDistanceWidthProtocolConstants const VeluxProtocolConstants PROGMEM = {OTHER, 30, VELUX_HEADER_MARK, VELUX_HEADER_SPACE,
155 
156 void IRsend::sendVelux(uint8_t aCommand, uint8_t aMotorNumber, uint8_t aMotorSet, uint16_t aSecurityCode, uint8_t aCRC,
157  int_fast8_t aNumberOfRepeats) {
158 
159  sendVelux(((uint32_t)aCRC << 20) | ((uint32_t)aSecurityCode << 10) | (aMotorSet << 6) | (aMotorNumber << 3) | aCommand, aNumberOfRepeats);
160 }
161 
162 void IRsend::sendVelux(uint32_t aData, int_fast8_t aNumberOfRepeats) {
163  do {
164  sendPulseDistanceWidth_P(&VeluxProtocolConstants, aData, VELUX_BITS, 0);
166  sendPulseDistanceWidth_P(&VeluxProtocolConstants, aData, VELUX_BITS, 0);
169  } while (aNumberOfRepeats >= 0);
170 }
172 #endif // _IR_OTHERS_HPP
VELUX_BITS
#define VELUX_BITS
VELUX see https://github.com/XPModder/Velux-IR-protocol see https://github.com/Arduino-IRremote/Ardui...
Definition: ir_Others.hpp:141
NEC_BITS
#define NEC_BITS
Definition: ir_NEC.hpp:97
PROTOCOL_IS_MSB_FIRST
#define PROTOCOL_IS_MSB_FIRST
Definition: IRProtocol.h:178
IRsend::sendDish
void sendDish(uint16_t aData)
Definition: ir_Others.hpp:64
PROTOCOL_IS_PULSE_WIDTH
#define PROTOCOL_IS_PULSE_WIDTH
Definition: IRProtocol.h:175
WHYNTER_ONE_SPACE
#define WHYNTER_ONE_SPACE
Definition: ir_Others.hpp:84
IRData::numberOfBits
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
Definition: IRremoteInt.h:161
IRsend::aNumberOfRepeats
void int_fast8_t aNumberOfRepeats
Definition: IRremoteInt.h:538
WHYNTER_HEADER_SPACE
#define WHYNTER_HEADER_SPACE
Definition: ir_Others.hpp:82
IRrecv::decodePulseDistanceWidthData_P
void decodePulseDistanceWidthData_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
Definition: IRReceive.hpp:1117
MICROS_IN_ONE_MILLI
#define MICROS_IN_ONE_MILLI
Definition: IRremote.hpp:212
IRrecv::checkHeader_P
bool checkHeader_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM)
Definition: IRReceive.hpp:1309
VELUX_AUTOREPEAT_SPACE
#define VELUX_AUTOREPEAT_SPACE
Definition: ir_Others.hpp:150
VELUX_ZERO_MARK
#define VELUX_ZERO_MARK
Definition: ir_Others.hpp:147
PROTOCOL_IS_PULSE_DISTANCE
#define PROTOCOL_IS_PULSE_DISTANCE
Definition: IRProtocol.h:173
IRsend::sendPulseDistanceWidth_P
void sendPulseDistanceWidth_P(PulseDistanceWidthProtocolConstants const *aProtocolConstantsPGM, IRRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Definition: IRSend.hpp:1075
PROGMEM
struct PulseDistanceWidthProtocolConstants const DishProtocolConstants PROGMEM
Definition: ir_Others.hpp:61
VELUX_REPEAT_SPACE
#define VELUX_REPEAT_SPACE
Definition: ir_Others.hpp:151
DISH_ONE_SPACE
#define DISH_ONE_SPACE
Definition: ir_Others.hpp:57
VELUX_ONE_SPACE
#define VELUX_ONE_SPACE
Definition: ir_Others.hpp:146
DISH_BIT_MARK
#define DISH_BIT_MARK
Definition: ir_Others.hpp:56
WHYNTER_HEADER_MARK
#define WHYNTER_HEADER_MARK
Definition: ir_Others.hpp:81
DISH_ZERO_SPACE
#define DISH_ZERO_SPACE
Definition: ir_Others.hpp:58
WHYNTER_ZERO_SPACE
#define WHYNTER_ZERO_SPACE
Definition: ir_Others.hpp:85
VELUX_ONE_MARK
#define VELUX_ONE_MARK
Definition: ir_Others.hpp:145
PulseDistanceWidthProtocolConstants
Definition: IRProtocol.h:161
VELUX_HEADER_SPACE
#define VELUX_HEADER_SPACE
Definition: ir_Others.hpp:143
IRrecv::decodedIRData
IRData decodedIRData
Definition: IRremoteInt.h:409
IRData::flags
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
Definition: IRremoteInt.h:162
PROTOCOL_IS_LSB_FIRST
#define PROTOCOL_IS_LSB_FIRST
Definition: IRProtocol.h:179
WHYNTER_BIT_MARK
#define WHYNTER_BIT_MARK
Definition: ir_Others.hpp:83
DISH_BITS
#define DISH_BITS
Definition: ir_Others.hpp:53
IRsend::sendVelux
void sendVelux(uint8_t aCommand, uint8_t aMotorNumber, uint8_t aMotorSet, uint16_t aSecurityCode, uint8_t aCRC, int_fast8_t aNumberOfRepeats)
Definition: ir_Others.hpp:156
IRDATA_FLAGS_IS_MSB_FIRST
#define IRDATA_FLAGS_IS_MSB_FIRST
Value is mainly determined by the (known) protocol.
Definition: IRProtocol.h:155
VELUX_ZERO_SPACE
#define VELUX_ZERO_SPACE
Definition: ir_Others.hpp:148
IRData::rawlen
IRRawlenType rawlen
Counter of entries in rawbuf of last received frame.
Definition: IRremoteInt.h:170
DISH_HEADER_MARK
#define DISH_HEADER_MARK
Definition: ir_Others.hpp:54
DISH_HEADER_SPACE
#define DISH_HEADER_SPACE
Definition: ir_Others.hpp:55
IRsend::sendWhynter
void sendWhynter(uint32_t aData, int_fast8_t aNumberOfRepeats)
Definition: ir_Others.hpp:90
UNKNOWN
@ UNKNOWN
Definition: IRProtocol.h:94
WHYNTER
@ WHYNTER
Definition: IRProtocol.h:124
WHYNTER_BITS
#define WHYNTER_BITS
Definition: ir_Others.hpp:80
VELUX_HEADER_MARK
#define VELUX_HEADER_MARK
Definition: ir_Others.hpp:142
IRData::protocol
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
Definition: IRremoteInt.h:151
IRsend::aCommand
void aCommand
Definition: IRremoteInt.h:688
OTHER
@ OTHER
Definition: IRProtocol.h:126
IRrecv::decodeWhynter
bool decodeWhynter()
Definition: ir_Others.hpp:94