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:
parent
9fb62f6f0d
commit
f5ef4c4288
5 changed files with 73 additions and 0 deletions
9
samples/subsys/usb/shell/CMakeLists.txt
Normal file
9
samples/subsys/usb/shell/CMakeLists.txt
Normal 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})
|
38
samples/subsys/usb/shell/README.rst
Normal file
38
samples/subsys/usb/shell/README.rst
Normal 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
|
8
samples/subsys/usb/shell/prj.conf
Normal file
8
samples/subsys/usb/shell/prj.conf
Normal 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
|
7
samples/subsys/usb/shell/sample.yaml
Normal file
7
samples/subsys/usb/shell/sample.yaml
Normal 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
|
11
samples/subsys/usb/shell/src/main.c
Normal file
11
samples/subsys/usb/shell/src/main.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/kernel.h>
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue