shell: create instances automatically basing on enabled backend

If user will enable shell than for each backend shell instance
will be created automatically.

Update all shell examples according to the new initialization
procedure.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2018-10-11 08:45:08 +02:00 committed by Carles Cufí
commit f6197c4f3c
4 changed files with 17 additions and 20 deletions

View file

@ -6,6 +6,11 @@
#include <shell/shell_uart.h>
#include <uart.h>
#include <init.h>
SHELL_UART_DEFINE(shell_transport_uart);
SHELL_DEFINE(uart_shell, "uart:~$ ", &shell_transport_uart, 10,
SHELL_FLAG_OLF_CRLF);
static void timer_handler(struct k_timer *timer)
{
@ -87,3 +92,11 @@ const struct shell_transport_api shell_uart_transport_api = {
.write = write,
.read = read
};
static int enable_shell_uart(struct device *arg)
{
ARG_UNUSED(arg);
shell_init(&uart_shell, NULL, true, true, LOG_LEVEL_INF);
return 0;
}
SYS_INIT(enable_shell_uart, POST_KERNEL, 0);