@@ -35,22 +35,22 @@ void setup() {
35
35
// +=============================================================================
36
36
// Display IR code
37
37
//
38
- void ircode (decode_results *aResults ) {
38
+ void ircode () {
39
39
// Panasonic has an Address
40
- if (results-> decode_type == PANASONIC) {
41
- Serial.print (results-> address , HEX);
40
+ if (irrecv. results . decode_type == PANASONIC) {
41
+ Serial.print (irrecv. results . address , HEX);
42
42
Serial.print (" :" );
43
43
}
44
44
45
45
// Print Code
46
- Serial.print (results-> value , HEX);
46
+ Serial.print (irrecv. results . value , HEX);
47
47
}
48
48
49
49
// +=============================================================================
50
50
// Display encoding type
51
51
//
52
- void encoding (decode_results *aResults ) {
53
- switch (results-> decode_type ) {
52
+ void encoding () {
53
+ switch (irrecv. results . decode_type ) {
54
54
default :
55
55
case UNKNOWN:
56
56
Serial.print (" UNKNOWN" );
@@ -112,37 +112,37 @@ void encoding(decode_results *aResults) {
112
112
// +=============================================================================
113
113
// Dump out the decode_results structure.
114
114
//
115
- void dumpInfo (decode_results *aResults ) {
115
+ void dumpInfo () {
116
116
// Check if the buffer overflowed
117
- if (results-> overflow ) {
117
+ if (irrecv. results . overflow ) {
118
118
Serial.println (" IR code too long. Edit IRremoteInt.h and increase RAW_BUFFER_LENGTH" );
119
119
return ;
120
120
}
121
121
122
122
// Show Encoding standard
123
123
Serial.print (" Encoding : " );
124
- encoding (results );
124
+ encoding ();
125
125
Serial.println (" " );
126
126
127
127
// Show Code & length
128
128
Serial.print (" Code : 0x" );
129
- ircode (results );
129
+ ircode ();
130
130
Serial.print (" (" );
131
- Serial.print (results-> bits , DEC);
131
+ Serial.print (irrecv. results . bits , DEC);
132
132
Serial.println (" bits)" );
133
133
}
134
134
135
135
// +=============================================================================
136
136
// Dump out the decode_results structure.
137
137
//
138
- void dumpRaw (decode_results *aResults ) {
138
+ void dumpRaw () {
139
139
// Print Raw data
140
140
Serial.print (" Timing[" );
141
- Serial.print (results-> rawlen - 1 , DEC);
141
+ Serial.print (irrecv. results . rawlen - 1 , DEC);
142
142
Serial.println (" ]: " );
143
143
144
- for (unsigned int i = 1 ; i < results-> rawlen ; i++) {
145
- unsigned long x = results-> rawbuf [i] * MICROS_PER_TICK;
144
+ for (unsigned int i = 1 ; i < irrecv. results . rawlen ; i++) {
145
+ unsigned long x = irrecv. results . rawbuf [i] * MICROS_PER_TICK;
146
146
if (!(i & 1 )) { // even
147
147
Serial.print (" -" );
148
148
if (x < 1000 )
@@ -158,7 +158,7 @@ void dumpRaw(decode_results *aResults) {
158
158
if (x < 100 )
159
159
Serial.print (" " );
160
160
Serial.print (x, DEC);
161
- if (i < results-> rawlen - 1 )
161
+ if (i < irrecv. results . rawlen - 1 )
162
162
Serial.print (" , " ); // ',' not needed for last one
163
163
}
164
164
if (!(i % 8 ))
@@ -170,17 +170,17 @@ void dumpRaw(decode_results *aResults) {
170
170
// +=============================================================================
171
171
// Dump out the decode_results structure.
172
172
//
173
- void dumpCode (decode_results *aResults ) {
173
+ void dumpCode () {
174
174
// Start declaration
175
175
Serial.print (" unsigned int " ); // variable type
176
176
Serial.print (" rawData[" ); // array name
177
- Serial.print (results-> rawlen - 1 , DEC); // array size
177
+ Serial.print (irrecv. results . rawlen - 1 , DEC); // array size
178
178
Serial.print (" ] = {" ); // Start declaration
179
179
180
180
// Dump data
181
- for (unsigned int i = 1 ; i < results-> rawlen ; i++) {
182
- Serial.print (results-> rawbuf [i] * MICROS_PER_TICK, DEC);
183
- if (i < results-> rawlen - 1 )
181
+ for (unsigned int i = 1 ; i < irrecv. results . rawlen ; i++) {
182
+ Serial.print (irrecv. results . rawbuf [i] * MICROS_PER_TICK, DEC);
183
+ if (i < irrecv. results . rawlen - 1 )
184
184
Serial.print (" ," ); // ',' not needed on last one
185
185
if (!(i & 1 ))
186
186
Serial.print (" " );
@@ -191,50 +191,48 @@ void dumpCode(decode_results *aResults) {
191
191
192
192
// Comment
193
193
Serial.print (" // " );
194
- encoding (results );
194
+ encoding ();
195
195
Serial.print (" " );
196
- ircode (results );
196
+ ircode ();
197
197
198
198
// Newline
199
199
Serial.println (" " );
200
200
201
201
// Now dump "known" codes
202
- if (results-> decode_type != UNKNOWN) {
202
+ if (irrecv. results . decode_type != UNKNOWN) {
203
203
204
204
// Some protocols have an address
205
- if (results-> decode_type == PANASONIC) {
205
+ if (irrecv. results . decode_type == PANASONIC) {
206
206
Serial.print (" unsigned int addr = 0x" );
207
- Serial.print (results-> address , HEX);
207
+ Serial.print (irrecv. results . address , HEX);
208
208
Serial.println (" ;" );
209
209
}
210
210
211
211
// All protocols have data
212
212
Serial.print (" unsigned int data = 0x" );
213
- Serial.print (results-> value , HEX);
213
+ Serial.print (irrecv. results . value , HEX);
214
214
Serial.println (" ;" );
215
215
}
216
216
}
217
217
218
218
// +=============================================================================
219
219
// Dump out the raw data as Pronto Hex.
220
220
//
221
- void dumpPronto (decode_results *aResults ) {
221
+ void dumpPronto () {
222
222
Serial.print (" Pronto Hex: " );
223
- irrecv.dumpPronto (Serial, results );
223
+ irrecv.dumpPronto (Serial);
224
224
Serial.println ();
225
225
}
226
226
227
227
// +=============================================================================
228
228
// The repeating section of the code
229
229
//
230
230
void loop () {
231
- decode_results results; // Somewhere to store the results
232
-
233
- if (irrecv.decode (&results)) { // Grab an IR code
234
- dumpInfo (&results); // Output the results
235
- dumpRaw (&results); // Output the results in RAW format
236
- dumpPronto (&results);
237
- dumpCode (&results); // Output the results as source code
231
+ if (irrecv.decode ()) { // Grab an IR code
232
+ dumpInfo (); // Output the results
233
+ dumpRaw (); // Output the results in RAW format
234
+ dumpPronto ();
235
+ dumpCode (); // Output the results as source code
238
236
Serial.println (" " ); // Blank line between entries
239
237
irrecv.resume (); // Prepare for the next value
240
238
}
0 commit comments