/*
 *  usb_user_cfg_init.c
 *
 * Change Logs:
 * Date          Author      Notes
 * 2024-01-13    weijiac     user usb funcion  implementation routine 
 *                           init usb cfg and 
 */
#include "usb_common.h"
#include "hal_usbd.h"
#include "hal_usbd_init.h"
#include "hal_usbd_reg.h"
#include "usb_device.h"
#include "debug.h"
#include "complexity_hid.h"
#include "uac_speaker.h"
#include "cdc_vcom.h"


uconfig_t cfg;


void usb_cfg_init(udevice_t _udevice)
{
#ifdef RT_USB_DEVICE_COMPOSITE
    cfg = rt_usbd_config_new();
    /* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓add function ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */
    rt_usbd_config_add_function(cfg, rt_usbd_function_hid_create(_udevice));                   //用了2个端点
    //rt_usbd_config_add_function(cfg, rt_usbd_function_uac_speaker_create(_udevice));        //用了1个端点
    //rt_usbd_config_add_function(cfg, rt_usbd_function_uac_recorder_create(_udevice));       //用了1个端点
#ifdef USING_BOARD_USB_CDC
    rt_usbd_config_add_function(cfg, rt_usbd_function_cdc_vcom_create(_udevice));           //用了3个端点   共计用了7个端点
#endif
    /* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑add function ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */

    
    rt_usbd_device_add_config(_udevice, cfg);
    rt_usbd_set_config(_udevice, 1);
#endif
}

