samples/subsys/usb/webusb/src/webusb_serial.c
/**
 * @brief Initialize UART channel
 *
 * This routine is called to reset the chip in a quiescent state.
 * It is assumed that this function is called only once per UART.
 *
 * @param dev WebUSB Serial device struct.
 *
 * @return 0 on success, negative errno code on fail
 */
@brief Initialize UART channel
This routine is called to reset the chip in a quiescent state.
It is assumed that this function is called only once per UART.

@param dev WebUSB Serial device struct.

@return 0 on success, negative errno code on fail
@brief Initialize UART channel This routine is called to reset the chip in a quiescent state . It is assumed that this function is called only once per UART . @param dev WebUSB Serial device struct . @return 0 on success negative errno code on fail
static int webusb_serial_init(struct device *dev)
{
	struct webusb_serial_dev_data_t * const dev_data = DEV_DATA(dev);
	int ret;
	webusb_serial_config.interface.payload_data = dev_data->interface_data;
	webusb_serial_dev = dev;
	ret = usb_set_config(&webusb_serial_config);
	if (ret < 0) {
		SYS_LOG_ERR("Failed to config USB");
		return ret;
	}
	ret = usb_enable(&webusb_serial_config);
	if (ret < 0) {
		SYS_LOG_ERR("Failed to enable USB");
		return ret;
	}
	dev->driver_api = &webusb_serial_driver_api;
	return 0;
}
static int webusb_serial_init ( struct device * dev ) { struct webusb_serial_dev_data_t * const dev_data = DEV_DATA ( dev ) ; int ret ; webusb_serial_config . interface . payload_data = dev_data -> interface_data ; webusb_serial_dev = dev ; ret = usb_set_config ( & webusb_serial_config ) ; if ( ret < 0 ) { SYS_LOG_ERR ( " " ) ; return ret ; } ret = usb_enable ( & webusb_serial_config ) ; if ( ret < 0 ) { SYS_LOG_ERR ( " " ) ; return ret ; } dev -> driver_api = & webusb_serial_driver_api ; return 0 ; }
@brief Initialize UART channel
 This routine is called to reset the chip in a quiescent state.
@brief Initialize UART channel This routine is called to reset the chip in a quiescent state .
/* Initialize the WebUSB driver with the right configuration */ /* Enable WebUSB driver */