Skip to content

Commit 67df3bf

Browse files
Tryton77nordicjm
authored andcommitted
samples: esb_monitor: Implemented shell commands
Implemented shell commands for runtime configuration updates JIRA: NCSDK-35071 Signed-off-by: Michał Strządała <[email protected]>
1 parent 12e186d commit 67df3bf

File tree

6 files changed

+613
-3
lines changed

6 files changed

+613
-3
lines changed

samples/esb/esb_monitor/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ project(NONE)
1010

1111
# NORDIC SDK APP START
1212
target_sources(app PRIVATE src/main.c)
13-
target_sources_ifdef(CONFIG_ESB_SNIFFER app PRIVATE src/sniffer.c)
13+
target_sources_ifdef(CONFIG_ESB_SNIFFER app PRIVATE src/sniffer.c src/sniffer_shell.c)
1414
# NORDIC SDK APP END

samples/esb/esb_monitor/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ config LED_ENABLE
1717
config ESB_SNIFFER
1818
bool "Turn sample into a functional ESB sniffer"
1919
select USE_SEGGER_RTT
20+
select SHELL
2021
help
2122
Enable sniffer functionality with RTT backend and runtime configuration updates through UART shell.
2223
Disable logging received packets through UART.

samples/esb/esb_monitor/README.rst

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,49 @@ All LEDs:
3838

3939
The next four packets turn them off again in the same order.
4040

41-
To disable LEDs, unset the :kconfig:option:`CONFIG_LED_ENABLE` Kconfig option.
41+
To disable LEDs, unset the :ref:`CONFIG_LED_ENABLE <CONFIG_LED_ENABLE>` Kconfig option.
42+
43+
The following ``sniffer`` shell subcommands are available when the :ref:`CONFIG_ESB_SNIFFER <CONFIG_ESB_SNIFFER>` Kconfig option is set:
44+
45+
.. list-table:: Sniffer shell commands
46+
:header-rows: 1
47+
48+
* - Subcommand
49+
- Arguments
50+
- Description
51+
* - ``show``
52+
-
53+
- Print actual sniffer configuration
54+
* - ``start``
55+
-
56+
- Start listening
57+
* - ``stop``
58+
-
59+
- Stop listening
60+
* - ``set addr0``
61+
- <xx.xx.xx.xx>
62+
- Set base address 0
63+
* - ``set addr1``
64+
- <xx.xx.xx.xx>
65+
- Set base address 1
66+
* - ``set bitrate``
67+
- <bitrate>
68+
- Set bitrate
69+
* - ``set channel``
70+
- <channel number>
71+
- Set ESB channel
72+
* - ``set prefix``
73+
- <xx.xx.xx.xx> <xx.xx.xx.xx>
74+
- Set prefix0 and prefix1
75+
* - ``pipe enable``
76+
- <pipe number> <pipe number> ... or ``all``
77+
- Enable selected pipes, or all pipes when argument is ``all``
78+
* - ``pipe disable``
79+
- <pipe number> <pipe number> ... or ``all``
80+
- Disable selected pipes, or all pipes when argument is ``all``
81+
* - ``pipe prefix``
82+
- <pipe number> <prefix>
83+
- Set <prefix> on <pipe number>
4284

4385
Configuration
4486
*************
@@ -50,10 +92,17 @@ Configuration options
5092

5193
Check and configure the following options:
5294

95+
.. _CONFIG_LED_ENABLE:
96+
97+
CONFIG_LED_ENABLE
98+
Enable led changes while receiving packets.
99+
It is intended to use together with the :ref:`Transmitter <esb_ptx>` sample.
100+
This option is enabled by default.
101+
53102
.. _CONFIG_ESB_SNIFFER:
54103

55104
CONFIG_ESB_SNIFFER
56-
Disable logging received packets through UART, and set RTT as transport layer for the packets.
105+
Disable logging received packets through UART, set RTT as transport layer for the packets, and enable the shell.
57106
It is intended for use together with :file:`scripts/esb_sniffer/main.py` or :file:`scripts/esb_sniffer/capture_to_pcap.py` scripts.
58107
This option is disabled by default.
59108

samples/esb/esb_monitor/src/sniffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,7 @@ int sniffer_init(void)
183183
NULL, NULL, NULL,
184184
CONFIG_ESB_SNIFFER_THREAD_PRIORITY, 0, K_NO_WAIT);
185185

186+
sniffer_shell_init(&sniffer_cfg);
187+
186188
return 0;
187189
}

samples/esb/esb_monitor/src/sniffer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct rtt_frame {
2828
} __packed;
2929

3030
int sniffer_init(void);
31+
void sniffer_shell_init(struct esb_sniffer_cfg *sniffer_cfg);
3132

3233
#ifdef __cplusplus
3334
}

0 commit comments

Comments
 (0)