How to combine cdc_acm (usb) and peripheral_uart (bluetooth) examples

Hello,

I am building an application (bt peripheral) that needs to send HID data to connected devices, and have a parallel connection for configuration.

The HID & configuration channels will both be sent over BT or USB, according to what is connected.

The HID portion is working, but I'm struggling with the configuration channel implementation.

I'm using NCS.

My original intuition was to combine the cdc_acm and peripheral_uart examples, but they both seem to use uart0, albeit in syntactically different ways.

//FROM CDC_ACM
&zephyr_udc0 {
    cdc_acm_uart0 {
        compatible = "zephyr,cdc-acm-uart";
    };
};
 
//FROM PERIPHERAL_UART
/ {
    chosen {
        nordic,nus-uart = &uart0;
    };
};
Can these examples be combined without peripheral conflict?

2. If they cannot be combined, my next intuition is to alternately enable and disable the BT/USB stacks according to the appropriate connected device.

Is there any easier way to do this?

Thank you!

Parents Reply Children
Related