Skip to content

Commit

Permalink
samples: sensortile_box: use generic CDC ACM shield
Browse files Browse the repository at this point in the history
Remove CDC ACM UART devicetree overlay, and explicit
USB support initialization in favor of generic CDC ACM shield.
For console support via USB CDC ACM, this example is to be built
as follows:

west build -b sensortile_box
  samples/boards/sensortile_box -- -DSHIELD=cdc_acm_console

Signed-off-by: Johann Fischer <[email protected]>
  • Loading branch information
jfischer-no committed Nov 15, 2021
1 parent 561c894 commit 461b174
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 26 deletions.
1 change: 1 addition & 0 deletions samples/boards/sensortile_box/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Build and flash the sample in the following way:
.. zephyr-app-commands::
:zephyr-app: samples/boards/sensortile_box
:board: sensortile_box
:shield: cdc_acm_console
:goals: build flash

Please note that flashing the board requires a few preliminary steps described
Expand Down
18 changes: 0 additions & 18 deletions samples/boards/sensortile_box/app.overlay

This file was deleted.

6 changes: 1 addition & 5 deletions samples/boards/sensortile_box/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ CONFIG_IIS3DHHC_TRIGGER_OWN_THREAD=y
CONFIG_LIS2MDL=y
CONFIG_LIS2MDL_TRIGGER_NONE=y

# config USB and USB console
# config USB device support
CONFIG_USB_DEVICE_VID=0x0483
CONFIG_USB_DEVICE_PID=0x1234
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC SensorTile.box"

CONFIG_USB_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
CONFIG_CBPRINTF_FP_SUPPORT=y
1 change: 1 addition & 0 deletions samples/boards/sensortile_box/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tests:
platform_allow: sensortile_box
tags: sensors
depends_on: i2c spi gpio
extra_args: SHIELD="cdc_acm_console"
4 changes: 1 addition & 3 deletions samples/boards/sensortile_box/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <drivers/i2c.h>
#include <drivers/spi.h>
#include <drivers/sensor.h>
#include <usb/usb_device.h>
#include <drivers/uart.h>

#include <stdio.h>
Expand Down Expand Up @@ -255,8 +254,7 @@ void main(void)
int cnt = 1;
uint32_t dtr = 0;

/* Application must enable USB by itself */
if (!device_is_ready(dev) || usb_enable(NULL)) {
if (!device_is_ready(dev)) {
return;
}

Expand Down

0 comments on commit 461b174

Please sign in to comment.