mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
examples/nxscope: add UDP interface
add UDP interface for examples/nxscope Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
parent
193fadfaa8
commit
7884410be2
2 changed files with 31 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue