Skip to content

Commit 7119cbc

Browse files
committed
Refactor watchdog, console and PixelPusher
Update multiple GD32 targets and lib-pp to use new APIs and build defines. Makefile changes add CONFIG_CLIB_USE_UART0 / CONFIG_CLIB_USE_NULL where appropriate and add a Makefile symlink for gd32_emac_artnet_dmx_multi. Replace gd32 hal watchdog includes/calls (gd32/hal_watchdog.h, hal::Watchdog*) with unified watchdog.h and watchdog::Init()/Feed(). Replace console colour usage with ansi::Colours::Colour::kYellow / kGreen and fix RDMNet device type name (RDMNetDevice -> RdmNetDevice). In lib-pp: bump copyright year to 2026, migrate networking/timing includes and APIs (use network_iface/network_udp/timing/timing::Millis), switch to UINT32_MAX for broadcast, and apply small style/formatting and logic cleanups in PixelPusher (brace style, union formatting, loop/condition formatting, minor refactors).
1 parent 52239ab commit 7119cbc

22 files changed

Lines changed: 86 additions & 113 deletions

File tree

firmware-template/libs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ ifeq ($(findstring DISPLAY_UDF,$(DEFINES)),DISPLAY_UDF)
118118
LIBS+=displayudf
119119
endif
120120

121-
LIBS+=flash display device hal
121+
LIBS+=flash display device hal hwclock
122122

123123
$(info $$LIBS [${LIBS}])

gd32_emac_artnet_dmx_multi/Makefile-bw-softuart0.GD32

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ DEFINES=DMXNODE_PORTS=4
44

55
DEFINES+=ENET_RXBUF_NUM=16 ENET_TXBUF_NUM=4
66

7-
#
8-
97
DEFINES+=CONFIG_USE_SOFTUART0
8+
DEFINES+=CONFIG_CLIB_USE_UART0
109

1110
DEFINES+=DEBUG_STACK
1211
DEFINES+=NDEBUG

gd32_emac_artnet_dmx_multi/Makefile-bw.GD32

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ DEFINES=DMXNODE_PORTS=4
44

55
DEFINES+=ENET_RXBUF_NUM=16 ENET_TXBUF_NUM=4
66

7-
#
8-
9-
DEFINES+=CONSOLE_NULL
7+
DEFINES+=CONFIG_CLIB_USE_NULL
108

119
DEFINES+=DEBUG_STACK
1210
DEFINES+=NDEBUG

gd32_emac_artnet_dmx_multi/Makefile-dmx3.GD32

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ DEFINES=DMXNODE_PORTS=3
55
DEFINES+=ENET_RXBUF_NUM=16 ENET_TXBUF_NUM=4
66

77
#
8-
9-
#
8+
DEFINES+=CONFIG_CLIB_USE_UART0
109

1110
DEFINES+=DEBUG_STACK
12-
DEFINES+=DEBUG_EMAC
13-
DEFINES+=DEBUG_NET_PHY
14-
#DEFINES+=NDEBUG
11+
DEFINES+=NDEBUG
1512

1613
LIBS=
1714

gd32_emac_artnet_dmx_multi/Makefile-dmx4-softuart0.GD32

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ DEFINES=DMXNODE_PORTS=4
44

55
DEFINES+=ENET_RXBUF_NUM=16 ENET_TXBUF_NUM=4
66

7-
DEFINES+=LEDPANEL_595_COUNT=2
8-
97
DEFINES+=CONFIG_USE_SOFTUART0
8+
DEFINES+=CONFIG_CLIB_USE_UART0
109

1110
DEFINES+=DEBUG_STACK
1211
DEFINES+=NDEBUG

gd32_emac_artnet_dmx_multi/Makefile-dmx4.GD32

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ DEFINES=DMXNODE_PORTS=4
44

55
DEFINES+=ENET_RXBUF_NUM=16 ENET_TXBUF_NUM=4
66

7-
DEFINES+=LEDPANEL_595_COUNT=2
8-
9-
DEFINES+=CONSOLE_NULL
7+
#
8+
DEFINES+=CONFIG_CLIB_USE_NULL
109

1110
DEFINES+=DEBUG_STACK
1211
DEFINES+=NDEBUG

gd32_emac_artnet_dmx_multi/Makefile.GD32

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ DEFINES=DMXNODE_PORTS=2
55
DEFINES+=ENET_RXBUF_NUM=8 ENET_TXBUF_NUM=4
66

77
#
8-
9-
#
8+
DEFINES+=CONFIG_CLIB_USE_UART0
109

1110
DEFINES+=DEBUG_STACK
1211
DEFINES+=NDEBUG

gd32_emac_artnet_dmx_multi/firmware/main.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
#include "gd32/hal.h"
27-
#include "gd32/hal_watchdog.h"
27+
#include "watchdog.h"
2828
#include "network.h"
2929
#include "displayudf.h"
3030
#include "json/displayudfparams.h"
@@ -69,11 +69,6 @@ int main() // NOLINT
6969
DmxNodeNode dmxnode_node;
7070
dmxnode_node.SetOutput(&dmx_send);
7171

72-
for (uint32_t port_index = 0; port_index < dmxnode::kMaxPorts; port_index++) {
73-
const auto kPortDirection = (dmxnode_node.GetPortDirection(port_index) == dmxnode::PortDirection::kOutput ? dmx::PortDirection::kOutput : dmx::PortDirection::kInput);
74-
dmx.SetPortDirection(port_index, kPortDirection, false);
75-
}
76-
7772
const auto kIsRdmEnabled = dmxnode_node.GetRdm();
7873

7974
#if defined(NODE_SHOWFILE)
@@ -97,16 +92,16 @@ int main() // NOLINT
9792

9893
RemoteConfig remote_config(kIsRdmEnabled ? remoteconfig::Output::RDM : remoteconfig::Output::DMX, kActivePorts);
9994

100-
display.TextStatus(DmxNodeMsgConst::START, console::Colours::kConsoleYellow);
95+
display.TextStatus(DmxNodeMsgConst::START, ansi::Colours::Colour::kYellow);
10196

10297
dmxnode_node.Start();
10398

104-
display.TextStatus(DmxNodeMsgConst::STARTED, console::Colours::kConsoleGreen);
99+
display.TextStatus(DmxNodeMsgConst::STARTED, ansi::Colours::Colour::kGreen);
105100

106-
hal::WatchdogInit();
101+
watchdog::Init();
107102

108103
for (;;) {
109-
hal::WatchdogFeed();
104+
watchdog::Feed();
110105
network::Run();
111106
dmxnode_node.Run();
112107
#if defined(NODE_SHOWFILE)

gd32_emac_artnet_pixel_multi/Makefile-softuart0.GD32

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ DEFINES+=ENABLE_HTTPD
2020

2121
DEFINES+=CONFIG_STORE_USE_SPI
2222
DEFINES+=CONFIG_MDNS_DOMAIN_REVERSE
23+
2324
DEFINES+=CONFIG_USE_SOFTUART0
25+
DEFINES+=CONFIG_CLIB_USE_UART0
2426

2527
DEFINES+=DISABLE_RTC
2628
DEFINES+=DISABLE_FS

gd32_emac_artnet_pixel_multi/Makefile.GD32

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ DEFINES+=ENABLE_HTTPD
2020

2121
DEFINES+=CONFIG_STORE_USE_SPI
2222
DEFINES+=CONFIG_MDNS_DOMAIN_REVERSE
23+
2324
#
25+
DEFINES+=CONFIG_CLIB_USE_UART0
2426

2527
DEFINES+=DISABLE_RTC
2628
DEFINES+=DISABLE_FS

0 commit comments

Comments
 (0)