Skip to content

Commit ba9bd2e

Browse files
committed
Prefix include guards with GD32; rename UUID files
Standardize header include guards to GD32_<NAME>_H_ across multiple headers (panelled.h, serialnumber.h, timing.h, uart0.h, watchdog.h) to avoid macro collisions. Move/rename hal_uuid.h to lib-gd32/include/uuid.h and relocate uuid.cpp to lib-gd32/src/uuid.cpp; bump copyright years and remove the hal namespace wrapping. Minor style/formatting tweaks (IWYU pragma for gd32.h, small function/brace formatting). These changes unify guard naming and consolidate the UUID implementation under lib-gd32.
1 parent 5e1ebe2 commit ba9bd2e

7 files changed

Lines changed: 26 additions & 33 deletions

File tree

lib-gd32/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 GD32_PANELLED_H_
27+
#define GD32_PANELLED_H_
2828

2929
#include <cstdint>
3030

@@ -119,4 +119,4 @@ inline void Run() {
119119
}
120120
} // namespace panelled
121121

122-
#endif // PANELLED_H_
122+
#endif // GD32_PANELLED_H_

lib-gd32/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 GD32_SERIALNUMBER_H_
27+
#define GD32_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 // GD32_SERIALNUMBER_H_

lib-gd32/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 GD32_TIMING_H_
27+
#define GD32_TIMING_H_
2828

2929
#include <cstdint>
3030

@@ -59,4 +59,4 @@ void DelayUs(uint32_t us, uint32_t offset = 0);
5959
[[nodiscard]] uint32_t UpTime();
6060
} // namespace timing
6161

62-
#endif // TIMING_H_
62+
#endif // GD32_TIMING_H_

lib-gd32/include/uart0.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 UART0_H_
27-
#define UART0_H_
26+
#ifndef GD32_UART0_H_
27+
#define GD32_UART0_H_
2828

2929
namespace uart0 {
3030
void Init();
@@ -34,4 +34,4 @@ int Printf(const char* fmt, ...);
3434
int GetChar();
3535
} // namespace uart0
3636

37-
#endif // UART0_H_
37+
#endif // GD32_UART0_H_
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
2-
* @file hal_uuid.h
2+
* @file uuid.h
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
99
* in the Software without restriction, including without limitation the rights
1010
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11-
* copies of the Software, and to permit persons to whom the Software is
11+
* copies of thnDmxDataDirecte Software, and to permit persons to whom the Software is
1212
* furnished to do so, subject to the following conditions:
1313
1414
* The above copyright notice and this permission notice shall be included in
@@ -23,14 +23,11 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#ifndef HAL_UUID_H_
27-
#define HAL_UUID_H_
26+
#ifndef GD32_UUID_H_
27+
#define GD32_UUID_H_
2828

2929
#include <uuid/uuid.h>
3030

31-
namespace hal
32-
{
3331
void UuidCopy(uuid_t out);
34-
} // namespace hal
3532

36-
#endif // HAL_UUID_H_
33+
#endif // GD32_UUID_H_

lib-gd32/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 GD32_HAL_WATCHDOG_H_
27-
#define GD32_HAL_WATCHDOG_H_
26+
#ifndef GD32_WATCHDOG_H_
27+
#define GD32_WATCHDOG_H_
2828

2929
#include "gd32.h" // IWYU pragma: keep
3030

@@ -54,4 +54,4 @@ inline bool Watchdog() {
5454
}
5555
} // namespace watchdog
5656

57-
#endif // GD32_HAL_WATCHDOG_H_
57+
#endif // GD32_WATCHDOG_H_
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file uuid.cpp
33
*
44
*/
5-
/* Copyright (C) 2024-2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2024-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -34,18 +34,14 @@
3434
#include <cstring>
3535
#include <uuid/uuid.h>
3636

37-
#include "gd32.h"
37+
#include "gd32.h" // IWYU pragma: keep
3838

39-
namespace hal
40-
{
41-
typedef union pcast32
42-
{
39+
typedef union pcast32 {
4340
uuid_t uuid;
4441
uint32_t u32[4];
4542
} _pcast32;
4643

47-
void UuidCopy(uuid_t out)
48-
{
44+
void UuidCopy(uuid_t out) {
4945
_pcast32 cast;
5046

5147
#if defined(GD32H7XX)
@@ -65,4 +61,3 @@ void UuidCopy(uuid_t out)
6561

6662
memcpy(out, cast.uuid, sizeof(uuid_t));
6763
}
68-
} // namespace hal

0 commit comments

Comments
 (0)