Skip to content

Commit 3ada448

Browse files
committed
V2.2
Release Notes – Codebase Refactor & Modularization * Major project restructuring * Reorganized libraries and source files into a clearer, more modular directory structure. * Moved, renamed, or removed numerous files to reduce duplication and improve maintainability. * Legacy code cleanup * Removed deprecated and unused code from lib-lightset, lib-network, lib-properties, and older display components. * Eliminated redundant parameter and platform-specific files no longer in use. * Centralized common functionality * Migrated shared network, properties, and parameter code into a unified common directory. * Added new utility headers and source files for reusable functionality. * JSON-based configuration support * Added new JSON configuration and parameter files. * Introduced JSON helper utilities and parameter classes to standardize configuration handling and prepare for future extensibility. * DMX, RDM, and pixel refactor * Refactored DMX, RDM device handling, and pixel-related libraries for clearer structure and better separation of responsibilities. * Unified RDM device information handling. * Build system updates * Updated Makefiles, build scripts, and compile_commands.json to reflect the new project structure. * Improved GD32 platform support and hardware abstraction organization. * Network stack reorganization * Flattened lib-network source layout by moving files from subdirectories into a simpler structure. * Improved clarity of EMAC and Linux network interface implementations (no functional changes). * Debug macro consistency * Replaced DEBUG_ENTRY / DEBUG_EXIT macros with function-style DEBUG_ENTRY() / DEBUG_EXIT() across the codebase for consistency and readability. * Overall impact * Significantly improved modularity, readability, and long-term maintainability. * Laid groundwork for future feature expansion and more robust JSON-based configuration across modules.
1 parent 34253f0 commit 3ada448

636 files changed

Lines changed: 38963 additions & 34743 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BasedOnStyle: Google
2+
IndentWidth: 4
3+
TabWidth: 4
4+
UseTab: Never
5+
ColumnLimit: 240
6+
7+
PointerAlignment: Left
8+
ReferenceAlignment: Left
9+
10+
AlignConsecutiveAssignments: false
11+
AlignConsecutiveDeclarations: false
12+
13+
AllowShortFunctionsOnASingleLine: Inline
14+
AllowShortIfStatementsOnASingleLine: true
15+
AllowShortLoopsOnASingleLine: true
16+
17+
BreakBeforeBraces: Allman
18+
19+
DerivePointerAlignment: false
20+
21+
SpacesBeforeTrailingComments: 1
22+
23+
SortIncludes: false
24+
IncludeBlocks: Preserve
25+
26+
Cpp11BracedListStyle: true
27+
28+
AlwaysBreakAfterReturnType: None
29+
AlwaysBreakTemplateDeclarations: MultiLine

.clang-tidy

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Checks: >
2+
google-*,
3+
readability-identifier-naming,
4+
modernize-redundant-void-arg,
5+
modernize-concat-nested-namespaces,
6+
modernize-use-nullptr,
7+
modernize-use-default-member-init,
8+
modernize-use-override,
9+
-google-runtime-references,
10+
-clang-analyzer-*,
11+
-misc-unused-include
12+
13+
CheckOptions:
14+
- key: readability-identifier-naming.ClassCase
15+
value: CamelCase
16+
17+
- key: readability-identifier-naming.StructCase
18+
value: CamelCase
19+
20+
- key: readability-identifier-naming.FunctionCase
21+
value: CamelCase
22+
23+
- key: readability-identifier-naming.IgnoreMainLikeFunctions
24+
value: 'true'
25+
26+
- key: readability-identifier-naming.IgnoreOverrideFunctions
27+
value: 'true'
28+
29+
- key: readability-identifier-naming.FunctionIgnoredRegexp
30+
value: '^([A-Za-z0-9_]+_(IRQHandler|Handler))$'
31+
32+
- key: readability-identifier-naming.VariableCase
33+
value: lower_case
34+
35+
- key: readability-identifier-naming.ParameterCase
36+
value: lower_case
37+
38+
- key: readability-identifier-naming.PrivateMemberCase
39+
value: lower_case
40+
- key: readability-identifier-naming.PrivateMemberSuffix
41+
value: _
42+
43+
- key: readability-identifier-naming.PublicMemberCase
44+
value: lower_case
45+
46+
- key: readability-identifier-naming.ConstantCase
47+
value: CamelCase
48+
- key: readability-identifier-naming.ConstantPrefix
49+
value: k
50+
51+
- key: readability-identifier-naming.GlobalConstantCase
52+
value: CamelCase
53+
- key: readability-identifier-naming.GlobalConstantPrefix
54+
value: k
55+
56+
- key: readability-identifier-naming.LocalConstantCase
57+
value: CamelCase
58+
- key: readability-identifier-naming.LocalConstantPrefix
59+
value: k
60+
61+
- key: readability-identifier-naming.EnumCase
62+
value: CamelCase
63+
64+
- key: readability-identifier-naming.EnumConstantCase
65+
value: CamelCase
66+
- key: readability-identifier-naming.EnumConstantPrefix
67+
value: k
68+
69+
- key: readability-identifier-naming.EnumConstantMemberCase
70+
value: CamelCase
71+
- key: readability-identifier-naming.EnumConstantMemberPrefix
72+
value: k
73+
74+
- key: readability-identifier-naming.MacroDefinitionCase
75+
value: UPPER_CASE
76+
77+
- key: readability-identifier-naming.TreatAsConstant
78+
value: 'constexpr'
79+
80+
WarningsAsErrors: ''
81+
HeaderFilterRegex: '.*'
82+
FormatStyle: none

.clangd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CompileFlags:
2+
CompilationDatabase: .
3+
4+
Diagnostics:
5+
ClangTidy:
6+
Add: []
7+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,6 @@ Artnet*.*
7777
do-tftp.sh
7878
udp_send
7979

80+
*._h
81+
/.cache
82+
compile_commands.json

common/.cproject

Lines changed: 149 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>lib-network</name>
3+
<name>common</name>
44
<comment></comment>
55
<projects>
66
</projects>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project>
3+
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.306944287" name="Default">
4+
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
5+
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
6+
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
7+
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
8+
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="234589836992184224" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
9+
<language-scope id="org.eclipse.cdt.core.gcc"/>
10+
<language-scope id="org.eclipse.cdt.core.g++"/>
11+
</provider>
12+
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
13+
</extension>
14+
</configuration>
15+
</project>
File renamed without changes.
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @file putchar.c
2+
* @file utils_array.h
33
*
44
*/
5-
/* Copyright (C) 2020-2021 by Arjan van Vught mailto:info@orangepi-dmx.nl
5+
/* Copyright (C) 2025 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
@@ -23,9 +23,17 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
extern int console_putc(int);
26+
#ifndef COMMON_UTILS_UTILS_ARRAY_H_
27+
#define COMMON_UTILS_UTILS_ARRAY_H_
2728

28-
int putchar(int c) {
29-
console_putc(c);
30-
return 1;
29+
#include <cstddef>
30+
31+
namespace common
32+
{
33+
template <typename T, size_t N> constexpr size_t ArraySize(const T (&)[N]) noexcept
34+
{
35+
return N;
3136
}
37+
} // namespace common
38+
39+
#endif // COMMON_UTILS_UTILS_ARRAY_H_
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @file uart0.cpp
2+
* @file utils_enum.h
33
*
44
*/
5-
/* Copyright (C) 2023-2024 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2025 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
@@ -23,32 +23,26 @@
2323
* THE SOFTWARE.
2424
*/
2525

26-
#include <cstdarg>
27-
#include <cstdio>
26+
#ifndef COMMON_UTILS_UTILS_ENUM_H_
27+
#define COMMON_UTILS_UTILS_ENUM_H_
2828

29-
static char s_buffer[128];
29+
#include <type_traits>
3030

31-
extern "C" {
32-
void uart0_putc(int);
31+
namespace common
32+
{
3333

34-
int uart0_printf(const char *fmt, ...) {
35-
va_list arp;
36-
37-
va_start(arp, fmt);
38-
39-
int i = vsnprintf(s_buffer, sizeof(s_buffer) - 1, fmt, arp);
40-
41-
va_end(arp);
34+
/// Converts an enum class value to its underlying integer type.
35+
template <typename Enum>
36+
inline auto ToValue(Enum e) noexcept {
37+
return static_cast<std::underlying_type_t<Enum>>(e);
38+
}
4239

43-
char *s = s_buffer;
40+
/// Converts an integer value to the corresponding enum class value.
41+
template <typename Enum>
42+
inline Enum FromValue(std::underlying_type_t<Enum> value) noexcept {
43+
return static_cast<Enum>(value);
44+
}
4445

45-
while (*s != '\0') {
46-
if (*s == '\n') {
47-
uart0_putc('\r');
48-
}
49-
uart0_putc(*s++);
50-
}
46+
} // namespace common
5147

52-
return i;
53-
}
54-
}
48+
#endif // COMMON_UTILS_UTILS_ENUM_H_

0 commit comments

Comments
 (0)