Skip to content

Commit bd786b5

Browse files
committed
Restructure serialnumber, remove console, add RTC
Move and rename serial number API into lib-gd32 (hal_serialnumber.h/cpp -> serialnumber.h/cpp), remove the hal:: namespace and make kSnSize a constexpr. Update callers (rdm_device_base) to include the new header and call SerialNumber(). Remove the console subsystem implementation and headers (console/i2c, console/null, console/uart0 and console include files) from lib-hal. Add a new GD32 RTC driver implementation (lib-hal/rtc/gd32/hwclockrtc.cpp) with RTC configuration, get/set/alarm functions and platform-specific handling for GD32F4/H7. Apply style/formatting and small API cleanups in pixel headers (pixel.h, pixeltype.h) and minor include cleanup in lib-hal/include/gd32/hal.h. Update copyright years where applicable.
1 parent 246aa5b commit bd786b5

14 files changed

Lines changed: 349 additions & 769 deletions

File tree

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @file hal_serialnumber.h
2+
* @file serialnumber.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
@@ -22,16 +22,12 @@
2222
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
* THE SOFTWARE.
2424
*/
25-
26-
#ifndef HAL_SERIALNUMBER_H_
27-
#define HAL_SERIALNUMBER_H_
25+
#ifndef SERIALNUMBER_H_
26+
#define SERIALNUMBER_H_
2827

2928
#include <cstdint>
3029

31-
namespace hal
32-
{
33-
inline static constexpr uint32_t kSnSize = 4;
30+
inline constexpr uint32_t kSnSize = 4;
3431
void SerialNumber(uint8_t sn[kSnSize]);
35-
} // namespace hal
3632

37-
#endif // HAL_SERIALNUMBER_H_
33+
#endif // SERIALNUMBER_H_
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @file hal_serialnumber.cpp
2+
* @file serialnumber.cpp
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2025-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
@@ -25,9 +25,8 @@
2525

2626
#include <cstdint>
2727

28-
#include "hal_serialnumber.h"
28+
#include "serialnumber.h"
2929

30-
namespace hal {
3130
void SerialNumber(uint8_t sn[kSnSize]) {
3231
#if defined(GD32H7XX)
3332
const auto kMacaddressHigh = *reinterpret_cast<volatile uint32_t*>(0x1FF0F7E8);
@@ -42,4 +41,3 @@ void SerialNumber(uint8_t sn[kSnSize]) {
4241
sn[2] = static_cast<uint8_t>((kMacaddressHigh >> 16) & 0xFF);
4342
sn[3] = static_cast<uint8_t>((kMacaddressHigh >> 24) & 0xFF);
4443
}
45-
} // namespace hal

0 commit comments

Comments
 (0)