Skip to content

Commit 660dfd6

Browse files
committed
Refactor status LED modes and panel LEDs
Rename status LED enum values to k-style identifiers and update all call sites (e.g. OFF_OFF -> kOffOff). Modernize panel LED definitions to hal::panelled with inline constexpr k-prefixed names, add <cstdint> includes where needed and switch to nested namespace hal::panelled. Replace dmx::config::max::PORTS with dmx::config::max::kPorts and adjust RDM transaction array sizes. Apply various style and API cleanups: brace/formatting adjustments, add IWYU pragmas to some includes, convert some macros/identifiers to clearer names (kPortARx/kPortATx), and update copyright years to 2026. Miscellaneous small fixes across headers and sources to reflect these changes.
1 parent bd254d1 commit 660dfd6

25 files changed

Lines changed: 228 additions & 584 deletions

File tree

lib-display/include/displayhandler.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ void DisplayStatusled(hal::statusled::Mode status_led_mode)
3838
char c;
3939
switch (status_led_mode)
4040
{
41-
case hal::statusled::Mode::OFF_OFF:
41+
case hal::statusled::Mode::kOffOff:
4242
c = 'O';
4343
break;
44-
case hal::statusled::Mode::OFF_ON:
44+
case hal::statusled::Mode::kOffOn:
4545
c = 'O';
4646
break;
47-
case hal::statusled::Mode::NORMAL:
47+
case hal::statusled::Mode::kNormal:
4848
c = 'N';
4949
break;
50-
case hal::statusled::Mode::DATA:
50+
case hal::statusled::Mode::kData:
5151
c = 'D';
5252
break;
53-
case hal::statusled::Mode::FAST:
53+
case hal::statusled::Mode::kFast:
5454
c = 'F';
5555
break;
56-
case hal::statusled::Mode::REBOOT:
56+
case hal::statusled::Mode::kReboot:
5757
c = 'R';
5858
break;
5959
default:

lib-gd32/include/board/16x4u-pixel.h

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,28 +109,25 @@
109109
* U(S)ART
110110
*/
111111

112-
/**
113-
* Panel LEDs
114-
*/
112+
// Panel LEDs
115113
#ifdef __cplusplus
116-
namespace hal {
117-
namespace panelled {
118-
static constexpr uint32_t ACTIVITY = 0;
119-
static constexpr uint32_t ARTNET = 0;
120-
static constexpr uint32_t DDP = 0;
121-
static constexpr uint32_t SACN = 0;
122-
static constexpr uint32_t LTC_IN = 0;
123-
static constexpr uint32_t LTC_OUT = 0;
124-
static constexpr uint32_t MIDI_IN = 0;
125-
static constexpr uint32_t MIDI_OUT = 0;
126-
static constexpr uint32_t OSC_IN = 0;
127-
static constexpr uint32_t OSC_OUT = 0;
128-
static constexpr uint32_t TCNET = 0;
114+
#include <cstdint>
115+
namespace hal::panelled {
116+
inline constexpr uint32_t kActivity = 0;
117+
inline constexpr uint32_t kArtnet = 0;
118+
inline constexpr uint32_t kDdp = 0;
119+
inline constexpr uint32_t kSacn = 0;
120+
inline constexpr uint32_t kLtcIn = 0;
121+
inline constexpr uint32_t kLtcOut = 0;
122+
inline constexpr uint32_t kMidiIn = 0;
123+
inline constexpr uint32_t kMidiOut = 0;
124+
inline constexpr uint32_t kOscIn = 0;
125+
inline constexpr uint32_t kOscOut = 0;
126+
inline constexpr uint32_t kTcnet = 0;
129127
// DMX
130-
static constexpr uint32_t PORT_A_RX = 0;
131-
static constexpr uint32_t PORT_A_TX = 0;
132-
} // namespace panelled
133-
} // namespace hal
128+
static constexpr uint32_t kPortARx = 0;
129+
static constexpr uint32_t kPortATx = 0;
130+
} // namespace hal::panelled
134131
#endif
135132

136133
/**

lib-gd32/include/board/bw_opidmx4.h

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,29 +114,25 @@
114114
#define USART0_REMAP
115115
#define USART2_PARTIAL_REMAP
116116

117-
/**
118-
* Panel LEDs
119-
*/
120-
117+
// Panel LEDs
121118
#ifdef __cplusplus
122-
namespace hal {
123-
namespace panelled {
124-
static constexpr uint32_t ACTIVITY = 0;
125-
static constexpr uint32_t ARTNET = 0;
126-
static constexpr uint32_t DDP = 0;
127-
static constexpr uint32_t SACN = 0;
128-
static constexpr uint32_t LTC_IN = 0;
129-
static constexpr uint32_t LTC_OUT = 0;
130-
static constexpr uint32_t MIDI_IN = 0;
131-
static constexpr uint32_t MIDI_OUT = 0;
132-
static constexpr uint32_t OSC_IN = 0;
133-
static constexpr uint32_t OSC_OUT = 0;
134-
static constexpr uint32_t TCNET = 0;
119+
#include <cstdint>
120+
namespace hal::panelled {
121+
inline constexpr uint32_t kActivity = 0;
122+
inline constexpr uint32_t kArtnet = 0;
123+
inline constexpr uint32_t kDdp = 0;
124+
inline constexpr uint32_t kSacn = 0;
125+
inline constexpr uint32_t kLtcIn = 0;
126+
inline constexpr uint32_t kLtcOut = 0;
127+
inline constexpr uint32_t kMidiIn = 0;
128+
inline constexpr uint32_t kMidiOut = 0;
129+
inline constexpr uint32_t kOscIn = 0;
130+
inline constexpr uint32_t kOscOut = 0;
131+
inline constexpr uint32_t kTcnet = 0;
135132
// DMX
136-
static constexpr uint32_t PORT_A_RX = 0;
137-
static constexpr uint32_t PORT_A_TX = 0;
138-
} // namespace panelled
139-
} // namespace hal
133+
static constexpr uint32_t kPortARx = 0;
134+
static constexpr uint32_t kPortATx = 0;
135+
} // namespace hal::panelled
140136
#endif
141137

142138
/**

lib-gd32/include/board/dmx3.h

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -110,31 +110,26 @@
110110
#define USART0_REMAP
111111
#define USART2_PARTIAL_REMAP
112112

113-
/**
114-
* Panel LEDs
115-
*/
116-
113+
// Panel LEDs
117114
#ifdef __cplusplus
118-
namespace hal {
119-
namespace panelled {
120-
static constexpr uint32_t ACTIVITY = 0;
121-
static constexpr uint32_t ARTNET = 0;
122-
static constexpr uint32_t DDP = 0;
123-
static constexpr uint32_t SACN = 0;
124-
static constexpr uint32_t LTC_IN = 0;
125-
static constexpr uint32_t LTC_OUT = 0;
126-
static constexpr uint32_t MIDI_IN = 0;
127-
static constexpr uint32_t MIDI_OUT = 0;
128-
static constexpr uint32_t OSC_IN = 0;
129-
static constexpr uint32_t OSC_OUT = 0;
130-
static constexpr uint32_t TCNET = 0;
115+
namespace hal::panelled {
116+
inline constexpr uint32_t kActivity = 0;
117+
inline constexpr uint32_t kArtnet = 0;
118+
inline constexpr uint32_t kDdp = 0;
119+
inline constexpr uint32_t kSacn = 0;
120+
inline constexpr uint32_t kLtcIn = 0;
121+
inline constexpr uint32_t kLtcOut = 0;
122+
inline constexpr uint32_t kMidiIn = 0;
123+
inline constexpr uint32_t kMidiOut = 0;
124+
inline constexpr uint32_t kOscIn = 0;
125+
inline constexpr uint32_t kOscOut = 0;
126+
inline constexpr uint32_t kTcnet = 0;
131127
// DMX
132-
static constexpr uint32_t PORT_A_TX = (1U << 0);
133-
static constexpr uint32_t PORT_A_RX = (1U << 8);
128+
inline constexpr uint32_t kPortATx = (1U << 0);
129+
inline constexpr uint32_t kPortARx = (1U << 8);
134130
#define CONFIG_PANELLED_RDM_PORT
135-
static constexpr uint32_t PORT_A_RDM = (1U << 16);
136-
} // namespace panelled
137-
} // namespace hal
131+
inline constexpr uint32_t kPortARdm = (1U << 16);
132+
} // namespace hal::panelled
138133
#endif
139134

140135
#define PANELLED_595_COUNT 2

lib-gd32/include/board/dmx4.h

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,31 +114,26 @@
114114
#define USART0_REMAP
115115
#define USART2_PARTIAL_REMAP
116116

117-
/**
118-
* Panel LEDs
119-
*/
120-
117+
// Panel LEDs
121118
#ifdef __cplusplus
122-
namespace hal {
123-
namespace panelled {
124-
static constexpr uint32_t ACTIVITY = 0;
125-
static constexpr uint32_t ARTNET = 0;
126-
static constexpr uint32_t DDP = 0;
127-
static constexpr uint32_t SACN = 0;
128-
static constexpr uint32_t LTC_IN = 0;
129-
static constexpr uint32_t LTC_OUT = 0;
130-
static constexpr uint32_t MIDI_IN = 0;
131-
static constexpr uint32_t MIDI_OUT = 0;
132-
static constexpr uint32_t OSC_IN = 0;
133-
static constexpr uint32_t OSC_OUT = 0;
134-
static constexpr uint32_t TCNET = 0;
119+
namespace hal::panelled {
120+
inline constexpr uint32_t kActivity = 0;
121+
inline constexpr uint32_t kArtnet = 0;
122+
inline constexpr uint32_t kDdp = 0;
123+
inline constexpr uint32_t kSacn = 0;
124+
inline constexpr uint32_t kLtcIn = 0;
125+
inline constexpr uint32_t kLtcOut = 0;
126+
inline constexpr uint32_t kMidiIn = 0;
127+
inline constexpr uint32_t kMidiOut = 0;
128+
inline constexpr uint32_t kOscIn = 0;
129+
inline constexpr uint32_t kOscOut = 0;
130+
inline constexpr uint32_t kTcnet = 0;
135131
// DMX
136-
static constexpr uint32_t PORT_A_TX = (1U << 0);
137-
static constexpr uint32_t PORT_A_RX = (1U << 8);
132+
inline constexpr uint32_t kPortATx = (1U << 0);
133+
inline constexpr uint32_t kPortARx = (1U << 8);
138134
#define CONFIG_PANELLED_RDM_PORT
139-
static constexpr uint32_t PORT_A_RDM = (1U << 16);
140-
} // namespace panelled
141-
} // namespace hal
135+
inline constexpr uint32_t kPortARdm = (1U << 16);
136+
} // namespace hal::panelled
142137
#endif
143138

144139
#define PANELLED_595_COUNT 2

0 commit comments

Comments
 (0)