Skip to content

Commit

Permalink
samples: usb: audio application uses static dev declaration
Browse files Browse the repository at this point in the history
This change the applications to get device from the
compatible of the zephyr_udc0 node.
It is defined by the DTC_OVERLAY_FILE="app.overlay"

Signed-off-by: Francois Ramu <francois.ramu@st.com>
  • Loading branch information
FRASTM authored and galak committed Jul 21, 2022
1 parent efb0313 commit 31b9a6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions samples/subsys/usb/audio/headphones_microphone/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ static const struct usb_audio_ops mic_ops = {

void main(void)
{
const struct device *hp_dev = device_get_binding("HEADPHONES");
const struct device *hp_dev = DEVICE_DT_GET_ONE(usb_audio_hp);
int ret;

LOG_INF("Entered %s", __func__);
mic_dev = device_get_binding("MICROPHONE");
mic_dev = DEVICE_DT_GET_ONE(usb_audio_mic);

if (!hp_dev) {
LOG_ERR("Can not get USB Headphones Device");
if (!device_is_ready(hp_dev)) {
LOG_ERR("Device USB Headphones is not ready");
return;
}

LOG_INF("Found USB Headphones Device");

if (!mic_dev) {
LOG_ERR("Can not get USB Microphone Device");
if (!device_is_ready(mic_dev)) {
LOG_ERR("Device USB Microphone is not ready");
return;
}

Expand Down
6 changes: 3 additions & 3 deletions samples/subsys/usb/audio/headset/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ void main(void)
int ret;

LOG_INF("Entered %s", __func__);
hs_dev = device_get_binding("HEADSET");
hs_dev = DEVICE_DT_GET_ONE(usb_audio_hs);

if (!hs_dev) {
LOG_ERR("Can not get USB Headset Device");
if (!device_is_ready(hs_dev)) {
LOG_ERR("Device USB Headset is not ready");
return;
}

Expand Down

0 comments on commit 31b9a6a

Please sign in to comment.