diff --git a/examples/nxscope/Kconfig b/examples/nxscope/Kconfig index b29f97f26..49d36f270 100644 --- a/examples/nxscope/Kconfig +++ b/examples/nxscope/Kconfig @@ -43,6 +43,15 @@ config EXAMPLES_NXSCOPE_CDCACM endif # LOGGING_NXSCOPE_INTF_SERIAL +if LOGGING_NXSCOPE_INTF_UDP + +config EXAMPLES_NXSCOPE_UDP_PORT + int "nxscope UDP local port" + default 50000 + range 1 65535 + +endif # LOGGING_NXSCOPE_INTF_UDP + config EXAMPLES_NXSCOPE_FORCE_ENABLE bool "nxscope force enable" default n diff --git a/examples/nxscope/nxscope_main.c b/examples/nxscope/nxscope_main.c index b2311a74a..5d5102e99 100644 --- a/examples/nxscope/nxscope_main.c +++ b/examples/nxscope/nxscope_main.c @@ -431,6 +431,9 @@ int main(int argc, FAR char *argv[]) #ifdef CONFIG_LOGGING_NXSCOPE_INTF_SERIAL struct nxscope_ser_cfg_s nxs_ser_cfg; #endif +#ifdef CONFIG_LOGGING_NXSCOPE_INTF_UDP + struct nxscope_udp_cfg_s nxs_udp_cfg; +#endif #ifdef CONFIG_LOGGING_NXSCOPE_INTF_DUMMY struct nxscope_dummy_cfg_s nxs_dummy_cfg; #endif @@ -484,6 +487,22 @@ int main(int argc, FAR char *argv[]) } #endif +#ifdef CONFIG_LOGGING_NXSCOPE_INTF_UDP + /* Configuration */ + + nxs_udp_cfg.port = CONFIG_EXAMPLES_NXSCOPE_UDP_PORT; + nxs_udp_cfg.nonblock = true; + + /* Initialize UDP interface */ + + ret = nxscope_udp_init(&intf, &nxs_udp_cfg); + if (ret < 0) + { + printf("ERROR: nxscope_udp_init failed %d\n", ret); + goto errout_nointf; + } +#endif + #ifdef CONFIG_LOGGING_NXSCOPE_INTF_DUMMY /* Configuration */ @@ -733,6 +752,9 @@ errout_nonxscope: #if defined(CONFIG_LOGGING_NXSCOPE_INTF_SERIAL) nxscope_ser_deinit(&intf); #endif +#if defined(CONFIG_LOGGING_NXSCOPE_INTF_UDP) + nxscope_udp_deinit(&intf); +#endif #if defined(CONFIG_LOGGING_NXSCOPE_INTF_DUMMY) nxscope_dummy_deinit(&intf); #endif