Skip to content

Commit 11c8908

Browse files
committed
Prefix include guards for h3/linux headers
Replace generic include guards (e.g. TIMING_H_, PANELLED_H_, WATCHDOG_H_, SERIALNUMBER_H_) with more specific names prefixed by H3_ or LINUX_ to avoid macro collisions when both lib-h3 and lib-linux headers are included. A minor formatting tweak was also applied to the Millis() inline signature (added space after attribute). No functional changes intended.
1 parent 5f469a6 commit 11c8908

7 files changed

Lines changed: 23 additions & 22 deletions

File tree

‎lib-h3/include/panelled.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef PANELLED_H_
27-
#define PANELLED_H_
26+
#ifndef H3_PANELLED_H_
27+
#define H3_PANELLED_H_
2828

2929
#include <cstdint>
3030

@@ -52,4 +52,4 @@ inline void Off([[maybe_unused]] uint32_t off) {}
5252
inline void Run() {}
5353
} // namespace panelled
5454

55-
#endif // PANELLED_H_
55+
#endif // H3_PANELLED_H_

‎lib-h3/include/timing.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef TIMING_H_
27-
#define TIMING_H_
26+
#ifndef H3_TIMING_H_
27+
#define H3_TIMING_H_
2828

2929
#include "h3.h"
3030

@@ -34,7 +34,7 @@ namespace timing {
3434
return H3_TIMER->AVS_CNT1;
3535
}
3636

37-
[[nodiscard]]inline uint32_t Millis() {
37+
[[nodiscard]] inline uint32_t Millis() {
3838
return H3_TIMER->AVS_CNT0;
3939
}
4040

@@ -43,4 +43,4 @@ void DelayUs(uint32_t us, uint32_t offset = 0);
4343
[[nodiscard]] uint32_t UpTime();
4444
} // namespace timing
4545

46-
#endif // TIMING_H_
46+
#endif // H3_TIMING_H_

‎lib-h3/include/watchdog.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef WATCHDOG_H_
27-
#define WATCHDOG_H_
26+
#ifndef H3_WATCHDOG_H_
27+
#define H3_WATCHDOG_H_
2828

2929
void H3WatchdogEnable();
3030
void H3WatchdogRestart();
@@ -51,4 +51,4 @@ inline bool Watchdog() {
5151
}
5252
} // namespace watchdog
5353

54-
#endif // WATCHDOG_H_
54+
#endif // H3_WATCHDOG_H_

‎lib-linux/include/panelled.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef PANELLED_H_
27-
#define PANELLED_H_
26+
#ifndef LINUX_PANELLED_H_
27+
#define LINUX_PANELLED_H_
2828

2929
#include <cstdint>
3030

@@ -50,4 +50,4 @@ inline void Off([[maybe_unused]] uint32_t off) {}
5050
inline void Run() {}
5151
} // namespace panelled
5252

53-
#endif // PANELLED_H_
53+
#endif // LINUX_PANELLED_H_

‎lib-linux/include/serialnumber.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
* THE SOFTWARE.
2424
*/
25-
#ifndef SERIALNUMBER_H_
26-
#define SERIALNUMBER_H_
25+
26+
#ifndef LINUX_SERIALNUMBER_H_
27+
#define LINUX_SERIALNUMBER_H_
2728

2829
#include <cstdint>
2930

3031
inline constexpr uint32_t kSnSize = 4;
3132
void SerialNumber(uint8_t sn[kSnSize]);
3233

33-
#endif // SERIALNUMBER_H_
34+
#endif // LINUX_SERIALNUMBER_H_

‎lib-linux/include/timing.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef TIMING_H_
27-
#define TIMING_H_
26+
#ifndef LINUX_TIMING_H_
27+
#define LINUX_TIMING_H_
2828

2929
#include <cstdint>
3030

@@ -38,4 +38,4 @@ namespace timing {
3838
void DelayUs(uint32_t us, uint32_t offset = 0);
3939
} // namespace timing
4040

41-
#endif // TIMING_H_
41+
#endif // LINUX_TIMING_H_

‎lib-linux/include/watchdog.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef WATCHDOG_H_
27-
#define WATCHDOG_H_
26+
#ifndef LINUX_WATCHDOG_H_
27+
#define LINUX_WATCHDOG_H_
2828

2929
namespace watchdog {
3030
inline bool Watchdog() { return false;
@@ -34,4 +34,4 @@ inline void Feed() {} // Not implemented
3434
inline void Stop() {} // Not implemented
3535
} // namespace watchdog
3636

37-
#endif // WATCHDOG_H_
37+
#endif // LINUX_WATCHDOG_H_

0 commit comments

Comments
 (0)