Skip to content

Commit 9dcf45d

Browse files
committed
LongUnion
1 parent 9e1303b commit 9dcf45d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Available as [Arduino library "IRremote"](https://www.arduinolibraries.info/libr
2020
+ [Example](https://github.com/Arduino-IRremote/Arduino-IRremote#example)
2121
* [Do not want to convert your 2.x program and use the 3.x library version?](https://github.com/Arduino-IRremote/Arduino-IRremote#do-not-want-to-convert-your-2x-program-and-use-the-3x-library-version)
2222
* [How to convert old MSB first 32 bit IR data codes to new LSB first 32 bit IR data codes](https://github.com/Arduino-IRremote/Arduino-IRremote#how-to-convert-old-msb-first-32-bit-ir-data-codes-to-new-lsb-first-32-bit-ir-data-codes)
23+
- [Errors with old tutorials and the 3.x versions](https://github.com/Arduino-IRremote/Arduino-IRremote#errors-with-old-tutorials-and-the-3x-versions)
2324
- [Using the new *.hpp files / how to avoid `multiple definitions` linker errors](https://github.com/Arduino-IRremote/Arduino-IRremote#using-the-new-hpp-files--how-to-avoid-multiple-definitions-linker-errors)
2425
- [Receiving IR codes](https://github.com/Arduino-IRremote/Arduino-IRremote#receiving-ir-codes)
2526
* [Minimal NEC receiver](https://github.com/Arduino-IRremote/Arduino-IRremote#minimal-nec-receiver)
@@ -148,7 +149,6 @@ void loop() {
148149
...
149150
}
150151
```
151-
152152
## Do not want to convert your 2.x program and use the 3.x library version?
153153
First consider to just use the [original 2.4 release form 2017](https://github.com/Arduino-IRremote/Arduino-IRremote/releases/tag/v2.4.0)
154154
or the last backwards compatible [2.8 version](https://github.com/Arduino-IRremote/Arduino-IRremote/releases/tag/2.8.0) for you project.
@@ -173,6 +173,9 @@ Example:
173173
0x40802CD3 is binary 01000000100000000010110011010011.<br/>
174174
If you read the first binary sequence backwards (right to left), you get the second sequence.
175175

176+
# Errors with old tutorials and the 3.x versions
177+
If you suffer from errors with old tutorial code including `IRremote.h` instead of `IRremote.hpp`, just try to rollback to [version 2.4.0](https://github.com/Arduino-IRremote/Arduino-IRremote/releases/tag/v2.4.0). Most likely your code will run and you will not miss the new features...
178+
176179
# Using the new *.hpp files / how to avoid `multiple definitions` linker errors
177180
In order to support [compile options](#compile-options--macros-for-this-library) more easily,
178181
the line `#include <IRremote.h>` must be changed to `#include <IRremote.hpp>`,

src/LongUnion.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
*
2222
*/
2323

24-
#ifndef _LONG_UNION_H
25-
#define _LONG_UNION_H
24+
#if !defined(_WORD_UNION_H) || !defined(_LONG_UNION_H)
2625

2726
#include <Arduino.h>
2827
#include <stdint.h>
2928

29+
#ifndef _WORD_UNION_H
30+
#define _WORD_UNION_H
3031
/**
3132
* Union to specify parts / manifestations of a 16 bit Word without casts and shifts.
3233
* It also supports the compiler generating small code.
@@ -46,7 +47,10 @@ union WordUnion {
4647
int16_t Word;
4748
uint8_t *BytePointer;
4849
};
50+
#endif // _WORD_UNION_H
4951

52+
#ifndef _LONG_UNION_H
53+
#define _LONG_UNION_H
5054
/**
5155
* Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
5256
* It also supports the compiler generating small code.
@@ -88,6 +92,7 @@ union LongUnion {
8892
uint32_t ULong;
8993
int32_t Long;
9094
};
91-
9295
#endif // _LONG_UNION_H
96+
97+
#endif // !defined(_WORD_UNION_H) || !defined(_LONG_UNION_H)
9398
#pragma once

0 commit comments

Comments
 (0)