|
26 | 26 | #include <cstdio> |
27 | 27 | #include <cstdint> |
28 | 28 |
|
| 29 | +#include "hal.h" |
29 | 30 | #include "gd32/hal_watchdog.h" |
30 | 31 | #include "hal_boardinfo.h" |
31 | | -#include "network.h" |
32 | | -#include "display.h" |
33 | | - |
| 32 | +#include "noemac/network.h" |
34 | 33 | #include "widget.h" |
35 | 34 | #include "widgetparams.h" |
36 | 35 | #include "rdmdeviceparams.h" |
37 | | - |
38 | 36 | #include "configstore.h" |
39 | | - |
40 | 37 | #include "software_version.h" |
41 | 38 |
|
42 | 39 | #ifndef ALIGNED |
43 | 40 | #define ALIGNED __attribute__((aligned(4))) |
44 | 41 | #endif |
45 | 42 |
|
46 | | -static constexpr char widget_mode_names[4][12] ALIGNED = {"DMX_RDM", "DMX", "RDM", "RDM_SNIFFER"}; |
47 | | -static constexpr TRDMDeviceInfoData deviceLabel ALIGNED = {const_cast<char*>("GD32F103RC DMX USB Pro"), 22}; |
| 43 | +static constexpr char kWidgetModeNames[4][12] ALIGNED = {"DMX_RDM", "DMX", "RDM", "RDM_SNIFFER"}; |
| 44 | +static constexpr TRDMDeviceInfoData kDeviceLabel ALIGNED = {const_cast<char*>("GD32F103RC DMX USB Pro"), 22}; |
48 | 45 |
|
49 | 46 | int main() |
50 | 47 | { |
51 | 48 | hal::Init(); |
52 | | - Display display; // Not supported, yet. |
53 | | - ConfigStore configStore; |
| 49 | + ConfigStore config_store; |
54 | 50 | Network nw; |
55 | 51 |
|
56 | 52 | Widget widget; |
57 | 53 | widget.SetPortDirection(0, dmx::PortDirection::kInput, false); |
58 | 54 |
|
59 | | - WidgetParams widgetParams; |
| 55 | + WidgetParams widget_params; |
60 | 56 |
|
61 | | - widgetParams.Load(); |
62 | | - widgetParams.Set(); |
| 57 | + widget_params.Load(); |
| 58 | + widget_params.Set(); |
63 | 59 |
|
64 | | - widget.SetLabel(&deviceLabel); |
| 60 | + widget.SetLabel(&kDeviceLabel); |
65 | 61 |
|
66 | | - RDMDeviceParams rdmDeviceParams; |
| 62 | + RDMDeviceParams rdm_device_params; |
67 | 63 |
|
68 | | - rdmDeviceParams.Load(); |
69 | | - rdmDeviceParams.Set(&widget); |
| 64 | + rdm_device_params.Load(); |
| 65 | + rdm_device_params.Set(&widget); |
70 | 66 |
|
71 | 67 | widget.Init(); |
72 | 68 |
|
73 | | - const auto* pRdmDeviceUid = widget.GetUID(); |
74 | | - TRDMDeviceInfoData tRdmDeviceLabel; |
75 | | - widget.GetLabel(&tRdmDeviceLabel); |
76 | | - const auto widgetMode = widgetParams.GetMode(); |
| 69 | + const auto* rdm_device_uid = widget.GetUID(); |
| 70 | + TRDMDeviceInfoData rdm_device_label; |
| 71 | + widget.GetLabel(&rdm_device_label); |
| 72 | + const auto kWidgetMode = widget_params.GetMode(); |
77 | 73 |
|
78 | | - uint8_t nHwTextLength; |
79 | | - printf("[V%s] %s Compiled on %s at %s\n", SOFTWARE_VERSION, hal::BoardName(nHwTextLength), __DATE__, __TIME__); |
80 | | - printf("RDM Controller with USB [Compatible with Enttec USB Pro protocol], Widget mode : %d (%s)\n", widgetMode, widget_mode_names[static_cast<uint32_t>(widgetMode)]); |
81 | | - printf("Device UUID : %.2x%.2x:%.2x%.2x%.2x%.2x, ", pRdmDeviceUid[0], pRdmDeviceUid[1], pRdmDeviceUid[2], pRdmDeviceUid[3], pRdmDeviceUid[4], pRdmDeviceUid[5]); |
82 | | - printf("Label : %.*s\n", static_cast<int>(tRdmDeviceLabel.length), reinterpret_cast<const char*>(tRdmDeviceLabel.data)); |
| 74 | + uint8_t hw_text_length; |
| 75 | + printf("[V%s] %s Compiled on %s at %s\n", SOFTWARE_VERSION, hal::BoardName(hw_text_length), __DATE__, __TIME__); |
| 76 | + printf("RDM Controller with USB [Compatible with Enttec USB Pro protocol], Widget mode : %d (%s)\n", kWidgetMode, kWidgetModeNames[static_cast<uint32_t>(kWidgetMode)]); |
| 77 | + printf("Device UUID : %.2x%.2x:%.2x%.2x%.2x%.2x, ", rdm_device_uid[0], rdm_device_uid[1], rdm_device_uid[2], rdm_device_uid[3], rdm_device_uid[4], rdm_device_uid[5]); |
| 78 | + printf("Label : %.*s\n", static_cast<int>(rdm_device_label.length), reinterpret_cast<const char*>(rdm_device_label.data)); |
83 | 79 |
|
84 | 80 | hal::WatchdogInit(); |
85 | 81 |
|
86 | | - if (widgetMode == widget::Mode::RDM_SNIFFER) |
| 82 | + if (kWidgetMode == widget::Mode::kRdmSniffer) |
87 | 83 | { |
88 | 84 | widget.SetPortDirection(0, dmx::PortDirection::kInput, true); |
89 | 85 | widget.SnifferFillTransmitBuffer(); // Prevent missing first frame |
|
0 commit comments