source: trunk/Arduino/libraries/Adafruit_Circuit_Playground/utility/IRLibCombo.h @ 15

Last change on this file since 15 was 3, checked in by markus, 7 years ago

Setup project structure

File size: 7.1 KB
Line 
1/* IRLibCombo.h
2 * Part of IRLib Library for Arduino receiving, decoding, and sending
3 * infrared signals. See COPYRIGHT.txt and LICENSE.txt for more information.
4 */
5/*
6 * This file is for creating a customer decode or send class which contains only
7 * the protocols that you will actually use. At the top of your sketch you should
8 * include the Send and/or Decode base modules followed by at least one or more
9 * protocol module. Then conclude with this module.
10 * WARNING: The lowest numbered protocol which you are using MUST be included first.
11 *              The remaining protocol modules technically could be in any order however we
12 *              recommend that you maintain numerical order because you might at some point
13 *              comment out the top one and then the lowest would not be first causing an error.
14 *   
15 * Here is an example...
16 *
17 * #include <IRLibSendBase.h>   //Only include if you are sending
18 * #include <IRLibDecodeBase.h> //Only include if you are decoding
19 * #include <IRLib_Pxx_protocol_name.h> //Include at least one protocol
20 * #include <IRLib_Pxx_another_name.h>  //Include as many as you want
21 * #include <IRLibCombo.h>              //Include this file
22 * IRdecode My_Decoder; //declare an instance of the decoder if needed
23 * IRsend My_Sender;    //declarative sense of the sending routine if needed
24 * //The rest of your code goes here
25 */
26 
27#ifndef IRLIB_COMBO_H
28#define IRLIB_COMBO_H
29
30#ifndef IRLIB_HASHRAW_H
31        #define IR_SEND_RAW
32        #define IR_DECODE_HASH
33        #define PV_IR_DECODE_HASH
34        #define PV_IR_SEND_RAW
35#endif
36#ifndef IRLIB_PROTOCOL_01_H
37        #define IR_SEND_PROTOCOL_01
38        #define IR_DECODE_PROTOCOL_01
39        #define PV_IR_DECODE_PROTOCOL_01
40        #define PV_IR_SEND_PROTOCOL_01
41#endif
42#ifndef IRLIB_PROTOCOL_02_H
43        #define IR_SEND_PROTOCOL_02
44        #define IR_DECODE_PROTOCOL_02
45        #define PV_IR_DECODE_PROTOCOL_02
46        #define PV_IR_SEND_PROTOCOL_02
47#endif
48#ifndef IRLIB_PROTOCOL_03_H
49        #define IR_SEND_PROTOCOL_03
50        #define IR_DECODE_PROTOCOL_03
51        #define PV_IR_DECODE_PROTOCOL_03
52        #define PV_IR_SEND_PROTOCOL_03
53#endif
54#ifndef IRLIB_PROTOCOL_04_H
55        #define IR_SEND_PROTOCOL_04
56        #define IR_DECODE_PROTOCOL_04
57        #define PV_IR_DECODE_PROTOCOL_04
58        #define PV_IR_SEND_PROTOCOL_04
59#endif
60#ifndef IRLIB_PROTOCOL_05_H
61        #define IR_SEND_PROTOCOL_05
62        #define IR_DECODE_PROTOCOL_05
63        #define PV_IR_DECODE_PROTOCOL_05
64        #define PV_IR_SEND_PROTOCOL_05
65#endif
66#ifndef IRLIB_PROTOCOL_06_H
67        #define IR_SEND_PROTOCOL_06
68        #define IR_DECODE_PROTOCOL_06
69        #define PV_IR_DECODE_PROTOCOL_06
70        #define PV_IR_SEND_PROTOCOL_06
71#endif
72#ifndef IRLIB_PROTOCOL_07_H
73        #define IR_SEND_PROTOCOL_07
74        #define IR_DECODE_PROTOCOL_07
75        #define PV_IR_DECODE_PROTOCOL_07
76        #define PV_IR_SEND_PROTOCOL_07
77#endif
78#ifndef IRLIB_PROTOCOL_08_H
79        #define IR_SEND_PROTOCOL_08
80        #define IR_DECODE_PROTOCOL_08
81        #define PV_IR_DECODE_PROTOCOL_08
82        #define PV_IR_SEND_PROTOCOL_08
83#endif
84#ifndef IRLIB_PROTOCOL_09_H
85        #define IR_SEND_PROTOCOL_09
86        #define IR_DECODE_PROTOCOL_09
87        #define PV_IR_DECODE_PROTOCOL_09
88        #define PV_IR_SEND_PROTOCOL_09
89#endif
90#ifndef IRLIB_PROTOCOL_10_H
91        #define IR_SEND_PROTOCOL_10
92        #define IR_DECODE_PROTOCOL_10
93        #define PV_IR_DECODE_PROTOCOL_10
94        #define PV_IR_SEND_PROTOCOL_10
95#endif
96#ifndef IRLIB_PROTOCOL_11_H
97        #define IR_SEND_PROTOCOL_11
98        #define IR_DECODE_PROTOCOL_11
99        #define PV_IR_DECODE_PROTOCOL_11
100        #define PV_IR_SEND_PROTOCOL_11
101#endif
102#ifndef IRLIB_PROTOCOL_12_H
103        #define IR_SEND_PROTOCOL_12
104        #define IR_DECODE_PROTOCOL_12
105        #define PV_IR_DECODE_PROTOCOL_12
106        #define PV_IR_SEND_PROTOCOL_12
107#endif
108#ifndef IRLIB_PROTOCOL_13_H
109        #define IR_SEND_PROTOCOL_13
110        #define IR_DECODE_PROTOCOL_13
111        #define PV_IR_DECODE_PROTOCOL_13
112        #define PV_IR_SEND_PROTOCOL_13
113#endif
114#ifndef IRLIB_PROTOCOL_14_H
115        #define IR_SEND_PROTOCOL_14
116        #define IR_DECODE_PROTOCOL_14
117        #define PV_IR_DECODE_PROTOCOL_14
118        #define PV_IR_SEND_PROTOCOL_14
119#endif
120//Add additional protocols 15, 16, etc. above.
121
122//Note protocol 90- 99 for sample code that will be unsupported in the final version.
123//See IRLibProtocols/unsupported/IRLib_P90_Unsupported.h for details
124#ifndef IRLIB_PROTOCOL_90_H
125        #define IR_SEND_PROTOCOL_90
126        #define IR_DECODE_PROTOCOL_90
127        #define PV_IR_DECODE_PROTOCOL_90
128        #define PV_IR_SEND_PROTOCOL_90
129#endif
130#ifndef IRLIB_PROTOCOL_91_H
131        #define IR_SEND_PROTOCOL_91
132        #define IR_DECODE_PROTOCOL_91
133        #define PV_IR_DECODE_PROTOCOL_91
134        #define PV_IR_SEND_PROTOCOL_91
135#endif
136#ifndef IRLIB_PROTOCOL_92_H
137        #define IR_SEND_PROTOCOL_92
138        #define IR_DECODE_PROTOCOL_92
139        #define PV_IR_DECODE_PROTOCOL_92
140        #define PV_IR_SEND_PROTOCOL_92
141#endif
142/*
143 * You may add additional protocols by copying and modifying the previous six lines.
144 * You must also add appropriate macros in each segment below. Be sure to maintain
145 * numerical order. Also the final entry in each list MUST BE the Hash_Raw version.
146 */
147#ifdef IRLIBDECODEBASE_H
148class IRdecode: 
149        PV_IR_DECODE_PROTOCOL_01
150        PV_IR_DECODE_PROTOCOL_02
151        PV_IR_DECODE_PROTOCOL_03
152        PV_IR_DECODE_PROTOCOL_04
153        PV_IR_DECODE_PROTOCOL_05
154        PV_IR_DECODE_PROTOCOL_06
155        PV_IR_DECODE_PROTOCOL_07
156        PV_IR_DECODE_PROTOCOL_08
157        PV_IR_DECODE_PROTOCOL_09
158        PV_IR_DECODE_PROTOCOL_10
159        PV_IR_DECODE_PROTOCOL_11
160        PV_IR_DECODE_PROTOCOL_12
161        PV_IR_DECODE_PROTOCOL_13
162        PV_IR_DECODE_PROTOCOL_14
163        PV_IR_DECODE_PROTOCOL_90 //Add additional 15, 16 etc. above this
164        PV_IR_DECODE_PROTOCOL_91
165        PV_IR_DECODE_PROTOCOL_92
166        PV_IR_DECODE_HASH       //Must be last one.
167{
168public:
169        bool decode(void) {
170                IR_DECODE_PROTOCOL_01
171                IR_DECODE_PROTOCOL_02
172                IR_DECODE_PROTOCOL_03
173                IR_DECODE_PROTOCOL_04
174                IR_DECODE_PROTOCOL_05
175                IR_DECODE_PROTOCOL_06
176                IR_DECODE_PROTOCOL_07
177                IR_DECODE_PROTOCOL_08
178                IR_DECODE_PROTOCOL_09
179                IR_DECODE_PROTOCOL_10
180                IR_DECODE_PROTOCOL_11
181                IR_DECODE_PROTOCOL_12
182                IR_DECODE_PROTOCOL_13
183                IR_DECODE_PROTOCOL_14
184    IR_DECODE_PROTOCOL_90 //Add additional 15, 16 etc. above this
185                IR_DECODE_PROTOCOL_91
186                IR_DECODE_PROTOCOL_92
187          IR_DECODE_HASH        //Must be last one.
188                return false;
189        };
190#ifdef IRLIB_PROTOCOL_12_H
191  void dumpResults(bool verbose=true) {
192    if(protocolNum==12) {
193      IRdecodeCYKM::dumpResults();
194      if(verbose)IRdecodeBase::dumpResults(true);
195    } else {
196      IRdecodeBase::dumpResults(verbose);
197    }
198  }
199#endif
200};
201#endif //IRLIBDECODEBASE_H
202
203#ifdef IRLIBSENDBASE_H
204class IRsend: 
205        PV_IR_SEND_PROTOCOL_01
206        PV_IR_SEND_PROTOCOL_02
207        PV_IR_SEND_PROTOCOL_03
208        PV_IR_SEND_PROTOCOL_04
209        PV_IR_SEND_PROTOCOL_05
210        PV_IR_SEND_PROTOCOL_06
211        PV_IR_SEND_PROTOCOL_07
212        PV_IR_SEND_PROTOCOL_08
213        PV_IR_SEND_PROTOCOL_09
214        PV_IR_SEND_PROTOCOL_10
215        PV_IR_SEND_PROTOCOL_11
216        PV_IR_SEND_PROTOCOL_12
217        PV_IR_SEND_PROTOCOL_13
218        PV_IR_SEND_PROTOCOL_14
219  PV_IR_SEND_PROTOCOL_90 //Add additional 15, 16 etc. above this
220        PV_IR_SEND_PROTOCOL_91
221        PV_IR_SEND_PROTOCOL_92
222        PV_IR_SEND_RAW  //Must be last one.
223{
224public:
225        void send(uint8_t protocolNum, uint32_t data, uint16_t data2=0, uint8_t khz=38) {
226    if(khz==0)khz=38;
227                switch(protocolNum) {
228                        IR_SEND_PROTOCOL_01
229                        IR_SEND_PROTOCOL_02
230                        IR_SEND_PROTOCOL_03
231                        IR_SEND_PROTOCOL_04
232                        IR_SEND_PROTOCOL_05
233                        IR_SEND_PROTOCOL_06
234                        IR_SEND_PROTOCOL_07
235                        IR_SEND_PROTOCOL_08
236                        IR_SEND_PROTOCOL_09
237                        IR_SEND_PROTOCOL_10
238                        IR_SEND_PROTOCOL_11
239                        IR_SEND_PROTOCOL_12
240                        IR_SEND_PROTOCOL_13
241                        IR_SEND_PROTOCOL_14
242                        IR_SEND_PROTOCOL_90 //Add additional 15, 16 etc. above this
243                        IR_SEND_PROTOCOL_91
244                        IR_SEND_PROTOCOL_92
245                        IR_SEND_RAW     //Must be last one.
246                }
247        }
248};
249#endif  //IRLIBSENDBASE_H
250
251#endif //IRLIB_COMBO_H
Note: See TracBrowser for help on using the repository browser.