samples: usb: add shell sample for new USB support

The sample enables new experimental USB device support
and the shell function.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2022-01-05 13:45:41 +01:00 committed by Carles Cufí
commit f5ef4c4288
5 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,9 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(usb-shell)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -0,0 +1,38 @@
.. _usb_shell-app:
USB support shell sample
########################
Overview
********
The sample enables new experimental USB device support and the shell function.
It is primarily intended to aid in the development and testing of USB constoller
drivers and new USB support.
Building and flashing
*********************
Assuming the board has a supported USB device controller, the example can be
built like:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/usb/shell
:board: reel_board
:goals: flash
:compact:
Sample shell interaction
========================
.. code-block:: console
uart:~$ usbd defaults
dev: USB descriptors initialized
uart:~$ usbd config add 1
uart:~$ usbd class add foobaz 1
dev: added USB class foobaz to configuration 1
uart:~$ usbd init
dev: USB initialized
uart:~$ usbd enable
dev: USB enabled

View file

@ -0,0 +1,8 @@
CONFIG_SHELL=y
CONFIG_USB_DEVICE_STACK_NEXT=y
CONFIG_USBD_SHELL=y
CONFIG_USBD_LOOPBACK_CLASS=y
CONFIG_LOG=y
CONFIG_USBD_LOG_LEVEL_WRN=y
CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y

View file

@ -0,0 +1,7 @@
sample:
name: USB support shell sample
tests:
sample.usbd.shell:
platform_allow: nrf52840dk_nrf52840 frdm_k64f
depends_on: usb_device
tags: usb

View file

@ -0,0 +1,11 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
void main(void)
{
}