mirror of
https://github.com/ArteryTek/AT32F413_Firmware_Library.git
synced 2026-05-21 09:22:02 +00:00
update version to v2.0.4
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb audio config
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __AUDIO_CONF_H
|
||||
#define __AUDIO_CONF_H
|
||||
@@ -31,17 +31,17 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup USB_audio_hid_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_device_audio_hid_config_definition
|
||||
|
||||
/** @defgroup USB_device_audio_hid_config_definition
|
||||
* @{
|
||||
*/
|
||||
#define AUDIO_SUPPORT_SPK 1
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
#define AUDIO_SUPPORT_FREQ (AUDIO_SUPPORT_FREQ_16K + \
|
||||
AUDIO_SUPPORT_FREQ_48K \
|
||||
)
|
||||
|
||||
|
||||
#define AUDIO_FREQ_16K 16000
|
||||
#define AUDIO_FREQ_48K 48000
|
||||
#define AUDIO_BITW_16 16
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_class.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb audio class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
@@ -31,11 +31,11 @@
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USB_audio_hid_class
|
||||
* @brief usb device class audio hid demo
|
||||
* @{
|
||||
*/
|
||||
*/
|
||||
|
||||
/** @defgroup USB_audio_hid_class_private_functions
|
||||
* @{
|
||||
@@ -61,7 +61,7 @@ static void audio_set_interface(void *udev, usb_setup_type *setup);
|
||||
static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len);
|
||||
usb_audio_hid_type audio_hid_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0};
|
||||
|
||||
usbd_class_handler audio_hid_class_handler =
|
||||
usbd_class_handler audio_hid_class_handler =
|
||||
{
|
||||
class_init_handler,
|
||||
class_clear_handler,
|
||||
@@ -78,7 +78,7 @@ usbd_class_handler audio_hid_class_handler =
|
||||
/**
|
||||
* @brief initialize usb custom hid endpoint
|
||||
* @param udev: usb device core handler type
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
static usb_sts_type class_init_handler(void *udev)
|
||||
{
|
||||
@@ -87,66 +87,66 @@ static usb_sts_type class_init_handler(void *udev)
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
/* enable microphone in endpoint double buffer mode */
|
||||
usbd_ept_dbuffer_enable(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT);
|
||||
|
||||
|
||||
/* open microphone in endpoint */
|
||||
usbd_ept_open(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT, EPT_ISO_TYPE, AUDIO_MIC_IN_MAXPACKET_SIZE);
|
||||
|
||||
|
||||
/* enable speaker out endpoint double buffer mode */
|
||||
usbd_ept_dbuffer_enable(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT);
|
||||
|
||||
|
||||
/* open speaker out endpoint */
|
||||
usbd_ept_open(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, EPT_ISO_TYPE, AUDIO_SPK_OUT_MAXPACKET_SIZE);
|
||||
#if AUDIO_SUPPORT_FEEDBACK
|
||||
#if AUDIO_SUPPORT_FEEDBACK
|
||||
/* enable speaker feedback endpoint double buffer mode */
|
||||
usbd_ept_dbuffer_enable(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT);
|
||||
|
||||
|
||||
/* open speaker feedback endpoint */
|
||||
usbd_ept_open(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT, EPT_ISO_TYPE, AUDIO_FEEDBACK_MAXPACKET_SIZE);
|
||||
#endif
|
||||
#endif
|
||||
/* start receive speaker out data */
|
||||
usbd_ept_recv(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, paudio_hid->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
|
||||
|
||||
|
||||
/*open hid endpoint */
|
||||
|
||||
|
||||
/* open custom hid in endpoint */
|
||||
usbd_ept_open(pudev, USBD_AUHID_HID_IN_EPT, EPT_INT_TYPE, USBD_AUHID_IN_MAXPACKET_SIZE);
|
||||
|
||||
|
||||
/* open custom hid out endpoint */
|
||||
usbd_ept_open(pudev, USBD_AUHID_HID_OUT_EPT, EPT_INT_TYPE, USBD_AUHID_OUT_MAXPACKET_SIZE);
|
||||
|
||||
|
||||
/* set out endpoint to receive status */
|
||||
usbd_ept_recv(pudev, USBD_AUHID_HID_OUT_EPT, paudio_hid->g_rxhid_buff, USBD_AUHID_OUT_MAXPACKET_SIZE);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief clear endpoint or other state
|
||||
* @param udev: usb device core handler type
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
static usb_sts_type class_clear_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
|
||||
|
||||
/* close in endpoint */
|
||||
usbd_ept_close(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT);
|
||||
|
||||
#if AUDIO_SUPPORT_FEEDBACK
|
||||
|
||||
#if AUDIO_SUPPORT_FEEDBACK
|
||||
/* close in endpoint */
|
||||
usbd_ept_close(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT);
|
||||
#endif
|
||||
|
||||
|
||||
/* close out endpoint */
|
||||
usbd_ept_close(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT);
|
||||
|
||||
|
||||
/* close custom hid in endpoint */
|
||||
usbd_ept_close(pudev, USBD_AUHID_HID_IN_EPT);
|
||||
|
||||
|
||||
/* close custom hid out endpoint */
|
||||
usbd_ept_close(pudev, USBD_AUHID_HID_OUT_EPT);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ static usb_sts_type class_clear_handler(void *udev)
|
||||
* @brief usb device class setup request handler
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup packet
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_audio_setup_handler(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -171,23 +171,23 @@ usb_sts_type class_audio_setup_handler(void *udev, usb_setup_type *setup)
|
||||
case AUDIO_REQ_GET_CUR:
|
||||
audio_req_get_cur(pudev, setup);
|
||||
break;
|
||||
|
||||
|
||||
case AUDIO_REQ_SET_CUR:
|
||||
audio_req_set_cur(pudev, setup);
|
||||
break;
|
||||
|
||||
|
||||
case AUDIO_REQ_GET_MIN:
|
||||
audio_req_get_min(pudev, setup);
|
||||
break;
|
||||
|
||||
|
||||
case AUDIO_REQ_GET_MAX:
|
||||
audio_req_get_max(pudev, setup);
|
||||
break;
|
||||
|
||||
|
||||
case AUDIO_REQ_GET_RES:
|
||||
audio_req_get_res(pudev, setup);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
@@ -212,30 +212,30 @@ usb_sts_type class_audio_setup_handler(void *udev, usb_setup_type *setup)
|
||||
case USB_STD_REQ_GET_INTERFACE:
|
||||
audio_get_interface(udev, setup);
|
||||
break;
|
||||
|
||||
|
||||
case USB_STD_REQ_SET_INTERFACE:
|
||||
audio_set_interface(udev, setup);
|
||||
usbd_ctrl_send_status(pudev);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class setup request handler
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup packet
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_hid_setup_handler(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -309,7 +309,7 @@ usb_sts_type class_hid_setup_handler(void *udev, usb_setup_type *setup)
|
||||
* @brief usb device class setup request handler
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup packet
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -330,31 +330,31 @@ usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
|
||||
case USB_REQ_RECIPIENT_ENDPOINT:
|
||||
class_audio_setup_handler(pudev, setup);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return status;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device endpoint 0 in status stage complete
|
||||
* @param udev: usb device core handler type
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_ept0_tx_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
|
||||
/* ...user code... */
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device endpoint 0 out status stage complete
|
||||
* @param udev: usb device core handler type
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
{
|
||||
@@ -363,7 +363,7 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
usb_setup_type *setup = &pudev->setup;
|
||||
uint32_t recv_len = usbd_get_recv_len(pudev, 0);
|
||||
|
||||
|
||||
/* ...user code... */
|
||||
if(setup->wIndex == HID_INTERFACE_NUMBER)
|
||||
{
|
||||
@@ -385,16 +385,16 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
case AUDIO_VOLUME_CONTROL:
|
||||
if(paudio_hid->interface == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
paudio_hid->spk_volume = (uint16_t)(paudio_hid->g_audio_cur[0] |
|
||||
paudio_hid->spk_volume = (uint16_t)(paudio_hid->g_audio_cur[0] |
|
||||
(paudio_hid->g_audio_cur[1] << 8));
|
||||
/* set volume */
|
||||
audio_codec_set_spk_volume(paudio_hid->spk_volume*100/paudio_hid->spk_volume_limits[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
paudio_hid->mic_volume = (uint16_t)(paudio_hid->g_audio_cur[0] |
|
||||
paudio_hid->mic_volume = (uint16_t)(paudio_hid->g_audio_cur[0] |
|
||||
(paudio_hid->g_audio_cur[1] << 8));
|
||||
|
||||
|
||||
audio_codec_set_mic_volume(paudio_hid->mic_volume*256/paudio_hid->mic_volume_limits[1]);
|
||||
}
|
||||
break;
|
||||
@@ -409,19 +409,19 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
paudio_hid->mic_mute = paudio_hid->g_audio_cur[0];
|
||||
audio_codec_set_mic_mute(paudio_hid->mic_mute);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case AUDIO_FREQ_SET_CONTROL:
|
||||
if(paudio_hid->enpd == USBD_AUHID_AUDIO_MIC_IN_EPT)
|
||||
{
|
||||
paudio_hid->mic_freq = (paudio_hid->g_audio_cur[0] |
|
||||
paudio_hid->mic_freq = (paudio_hid->g_audio_cur[0] |
|
||||
(paudio_hid->g_audio_cur[1] << 8) |
|
||||
(paudio_hid->g_audio_cur[2] << 16));
|
||||
audio_codec_set_mic_freq(paudio_hid->mic_freq);
|
||||
}
|
||||
else
|
||||
{
|
||||
paudio_hid->spk_freq = (paudio_hid->g_audio_cur[0] |
|
||||
paudio_hid->spk_freq = (paudio_hid->g_audio_cur[0] |
|
||||
(paudio_hid->g_audio_cur[1] << 8) |
|
||||
(paudio_hid->g_audio_cur[2] << 16));
|
||||
audio_codec_set_spk_freq(paudio_hid->spk_freq);
|
||||
@@ -432,7 +432,7 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
* @brief usb device transmision complete handler
|
||||
* @param udev: usb device core handler type
|
||||
* @param ept_num: endpoint number
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
@@ -448,7 +448,7 @@ usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
uint32_t len = 0;
|
||||
|
||||
|
||||
/* ...user code...
|
||||
trans next packet data
|
||||
*/
|
||||
@@ -457,18 +457,18 @@ usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
len = audio_codec_mic_get_data(paudio_hid->audio_mic_data);
|
||||
usbd_ept_send(udev, USBD_AUHID_AUDIO_MIC_IN_EPT, paudio_hid->audio_mic_data, len);
|
||||
}
|
||||
#if AUDIO_SUPPORT_FEEDBACK
|
||||
#if AUDIO_SUPPORT_FEEDBACK
|
||||
else if((ept_num & 0x7F) == (USBD_AUHID_AUDIO_FEEDBACK_EPT & 0x7F))
|
||||
{
|
||||
len = audio_codec_spk_feedback(paudio_hid->audio_feed_back);
|
||||
usbd_ept_send(udev, USBD_AUHID_AUDIO_FEEDBACK_EPT, paudio_hid->audio_feed_back, len);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else if((ept_num & 0x7F) == (USBD_AUHID_HID_IN_EPT & 0x7F))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
* @brief usb device endpoint receive data
|
||||
* @param udev: usb device core handler type
|
||||
* @param ept_num: endpoint number
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
@@ -484,15 +484,15 @@ static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
uint16_t g_rxlen;
|
||||
|
||||
|
||||
/* get endpoint receive data length */
|
||||
g_rxlen = usbd_get_recv_len(pudev, ept_num);
|
||||
|
||||
|
||||
if((ept_num & 0x7F) == (USBD_AUHID_AUDIO_SPK_OUT_EPT & 0x7F))
|
||||
{
|
||||
/* speaker data*/
|
||||
audio_codec_spk_fifo_write(paudio_hid->audio_spk_data, g_rxlen);
|
||||
|
||||
|
||||
/* get next data */
|
||||
usbd_ept_recv(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, paudio_hid->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
|
||||
}
|
||||
@@ -500,7 +500,7 @@ static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
/* hid buffer process */
|
||||
usb_hid_buf_process(udev, paudio_hid->g_rxhid_buff, g_rxlen);
|
||||
|
||||
|
||||
/* start receive next packet */
|
||||
usbd_ept_recv(pudev, USBD_AUHID_HID_OUT_EPT, paudio_hid->g_rxhid_buff, USBD_AUHID_OUT_MAXPACKET_SIZE);
|
||||
}
|
||||
@@ -510,14 +510,14 @@ static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
|
||||
/**
|
||||
* @brief usb device sof handler
|
||||
* @param udev: usb device core handler type
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
static usb_sts_type class_sof_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
|
||||
/* ...user code... */
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ static usb_sts_type class_sof_handler(void *udev)
|
||||
* @brief usb device event handler
|
||||
* @param udev: usb device core handler type
|
||||
* @param event: usb device event
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
{
|
||||
@@ -535,9 +535,9 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
switch(event)
|
||||
{
|
||||
case USBD_RESET_EVENT:
|
||||
|
||||
|
||||
/* ...user code... */
|
||||
|
||||
|
||||
break;
|
||||
case USBD_SUSPEND_EVENT:
|
||||
paudio_hid->spk_alt_setting = 0;
|
||||
@@ -545,11 +545,11 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
paudio_hid->mic_alt_setting = 0;
|
||||
audio_codec_mic_alt_setting(paudio_hid->spk_alt_setting);
|
||||
/* ...user code... */
|
||||
|
||||
|
||||
break;
|
||||
case USBD_WAKEUP_EVENT:
|
||||
/* ...user code... */
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -561,7 +561,7 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
* @brief usb audio request get cur
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_req_get_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ static void audio_req_get_cur(void *udev, usb_setup_type *setup)
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ static void audio_req_get_cur(void *udev, usb_setup_type *setup)
|
||||
* @brief usb audio request set cur
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_req_set_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -609,10 +609,10 @@ static void audio_req_set_cur(void *udev, usb_setup_type *setup)
|
||||
if(setup->wLength > 0)
|
||||
{
|
||||
usbd_ctrl_recv(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
|
||||
|
||||
paudio_hid->audio_cmd = AUDIO_REQ_SET_CUR;
|
||||
paudio_hid->audio_cmd_len = setup->wLength;
|
||||
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
@@ -640,7 +640,7 @@ static void audio_req_set_cur(void *udev, usb_setup_type *setup)
|
||||
* @brief usb audio request get min
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_req_get_min(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -662,7 +662,7 @@ static void audio_req_get_min(void *udev, usb_setup_type *setup)
|
||||
* @brief usb audio request get max
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_req_get_max(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -684,7 +684,7 @@ static void audio_req_get_max(void *udev, usb_setup_type *setup)
|
||||
* @brief usb audio request get res
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_req_get_res(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -706,7 +706,7 @@ static void audio_req_get_res(void *udev, usb_setup_type *setup)
|
||||
* @brief usb audio set interface
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_set_interface(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -721,9 +721,9 @@ static void audio_set_interface(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
int len = audio_codec_spk_feedback(paudio_hid->audio_feed_back);
|
||||
usbd_ept_recv(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, paudio_hid->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
|
||||
usbd_ept_send(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT, paudio_hid->audio_feed_back, len);
|
||||
usbd_ept_send(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT, paudio_hid->audio_feed_back, len);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(LBYTE(setup->wIndex) == AUDIO_MIC_INTERFACE_NUMBER)
|
||||
{
|
||||
@@ -735,7 +735,7 @@ static void audio_set_interface(void *udev, usb_setup_type *setup)
|
||||
usbd_ept_send(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT, paudio_hid->audio_mic_data, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -743,7 +743,7 @@ static void audio_set_interface(void *udev, usb_setup_type *setup)
|
||||
* @brief usb audio get interface
|
||||
* @param udev: usb device core handler type
|
||||
* @param setup: setup class
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void audio_get_interface(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
@@ -757,7 +757,7 @@ static void audio_get_interface(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->mic_alt_setting, 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -765,7 +765,7 @@ static void audio_get_interface(void *udev, usb_setup_type *setup)
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param report: report buffer
|
||||
* @param len: report length
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
@@ -774,7 +774,7 @@ usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t l
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
|
||||
usbd_ept_send(pudev, USBD_AUHID_HID_IN_EPT, report, len);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -784,14 +784,14 @@ usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t l
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param report: report buffer
|
||||
* @param len: report length
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
uint32_t i_index;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
|
||||
|
||||
switch(report[0])
|
||||
{
|
||||
case HID_REPORT_ID_2:
|
||||
@@ -831,15 +831,15 @@ static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
|
||||
}
|
||||
usbd_ept_send(pudev, USBD_AUHID_HID_IN_EPT, paudio_hid->g_txhid_buff, len);
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_class.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb audio class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __AUDIO_HID_CLASS_H
|
||||
#define __AUDIO_HID_CLASS_H
|
||||
@@ -31,7 +31,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include "usb_std.h"
|
||||
#include "usbd_core.h"
|
||||
#include "audio_conf.h"
|
||||
@@ -39,12 +39,12 @@ extern "C" {
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup USB_audio_hid_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_audio_hid_class_definition
|
||||
/** @defgroup USB_audio_hid_class_definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
@@ -122,7 +122,7 @@ typedef struct
|
||||
uint32_t mic_freq;
|
||||
uint16_t spk_volume_limits[3]; /*[0] is mininum value, [1] is maxnum value, [2] is volume resolution */
|
||||
uint16_t mic_volume_limits[3]; /*[0] is mininum value, [1] is maxnum value, [2] is volume resolution */
|
||||
|
||||
|
||||
uint8_t audio_cmd;
|
||||
uint32_t audio_cmd_len;
|
||||
uint32_t spk_alt_setting;
|
||||
@@ -131,8 +131,8 @@ typedef struct
|
||||
uint8_t audio_spk_data[AUDIO_SPK_OUT_MAXPACKET_SIZE];
|
||||
uint8_t audio_mic_data[AUDIO_MIC_IN_MAXPACKET_SIZE];
|
||||
uint8_t audio_feed_back[AUDIO_FEEDBACK_MAXPACKET_SIZE+1];
|
||||
|
||||
|
||||
|
||||
|
||||
/* hid */
|
||||
uint32_t hid_protocol;
|
||||
uint32_t hid_set_idle;
|
||||
@@ -154,7 +154,7 @@ usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t l
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_desc.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb audio device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
@@ -31,11 +31,11 @@
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USB_audio_hid_desc
|
||||
* @brief usb device audio hid descriptor
|
||||
* @{
|
||||
*/
|
||||
*/
|
||||
|
||||
/** @defgroup USB_audio_hid_desc_private_functions
|
||||
* @{
|
||||
@@ -121,7 +121,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
the configuration */
|
||||
0xC0, /* bmAttributes: self powered */
|
||||
0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
|
||||
|
||||
|
||||
USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
|
||||
USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
0x00, /* bInterfaceNumber: number of interface */
|
||||
@@ -131,7 +131,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass: audio control */
|
||||
AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol: undefined */
|
||||
0x00, /* iInterface: index of string descriptor */
|
||||
|
||||
|
||||
0x08+AUDIO_INTERFACE_NUM, /* bLength: size of this descriptor, in bytes 8+n */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: cs interface descriptor type */
|
||||
AUDIO_AC_HEADER, /* bDescriptorSubtype: Header function Descriptor*/
|
||||
@@ -166,7 +166,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x00, /* wChannelConfig */
|
||||
0x00, /* iChannelNames: unused */
|
||||
0x00, /* iTerminal: unused */
|
||||
|
||||
|
||||
AUDIO_FEATURE_UNIT_SIZE, /* bLength: descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
|
||||
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
|
||||
@@ -176,7 +176,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x01, /* bmaControls0: mute */
|
||||
0x02, /* bmaControls1: volume */
|
||||
0x00, /* iFeature: unused */
|
||||
|
||||
|
||||
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
|
||||
AUDIO_AC_OUTPUT_TERMINAL, /* bDescriptorSubtype: output_terminal type*/
|
||||
@@ -186,8 +186,8 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
AUDIO_MIC_INPUT_TERMINAL_ID, /* bAssocTerminal: unused */
|
||||
AUDIO_MIC_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
|
||||
0x00, /* iTerminal: unused */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (AUDIO_SUPPORT_SPK == 1)
|
||||
/* speaker config */
|
||||
AUDIO_INPUT_TERMINAL_SIZE, /* bLength: descriptor size */
|
||||
@@ -207,7 +207,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x00, /* wChannelConfig */
|
||||
0x00, /* iChannelNames: unused */
|
||||
0x00, /* iTerminal: unused */
|
||||
|
||||
|
||||
AUDIO_FEATURE_UNIT_SIZE, /* bLength: descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
|
||||
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
|
||||
@@ -217,7 +217,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x01, /* bmaControls0: mute*/
|
||||
0x02, /* bmaControls1: volume */
|
||||
0x00, /* iFeature: unused */
|
||||
|
||||
|
||||
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
|
||||
AUDIO_AC_OUTPUT_TERMINAL, /* bDescriptorSubtype: output_terminal type*/
|
||||
@@ -239,8 +239,8 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
|
||||
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
|
||||
0x00, /* bInterfaceProtocol: unused */
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
0x09, /* bLength: descriptor size */
|
||||
USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
AUDIO_MIC_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
|
||||
@@ -249,8 +249,8 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
|
||||
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
|
||||
0x00, /* bInterfaceProtocol: unused */
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
0x07, /* bLength: configuration descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
AUDIO_AS_GENERAL, /* bDescriptorSubtype: general sub type*/
|
||||
@@ -258,7 +258,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x01, /* bDelay: interface delay */
|
||||
0x01, /* wFormatTag: pcm format*/
|
||||
0x00, /* wFormatTag: pcm format*/
|
||||
|
||||
|
||||
0x08 + AUDIO_MIC_FREQ_SIZE * 3, /* bLength: descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
AUDIO_AS_FORMAT_TYPE, /* bDescriptorSubtype: format subtype */
|
||||
@@ -267,10 +267,10 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
AUDIO_MIC_BITW / 8, /* bSubFrameSize: per audio subframe */
|
||||
AUDIO_MIC_BITW, /* bBitResolution: n bits per sample */
|
||||
AUDIO_MIC_FREQ_SIZE, /* bSamFreqType: n frequency supported */
|
||||
#if (AUDIO_SUPPORT_FREQ_16K == 1)
|
||||
#if (AUDIO_SUPPORT_FREQ_16K == 1)
|
||||
SAMPLE_FREQ(AT32_AUDIO_FREQ_16K), /* tSamFreq: 16000hz */
|
||||
#endif
|
||||
#if (AUDIO_SUPPORT_FREQ_48K == 1)
|
||||
#if (AUDIO_SUPPORT_FREQ_48K == 1)
|
||||
SAMPLE_FREQ(AT32_AUDIO_FREQ_48K), /* tSamFreq: 48000hz */
|
||||
#endif
|
||||
|
||||
@@ -283,7 +283,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
|
||||
0x00, /* bRefresh: unused */
|
||||
0x00, /* bSynchAddress: unused */
|
||||
|
||||
|
||||
0x07, /* bLength: size of endpoint descriptor in bytes */
|
||||
AUDIO_CS_ENDPOINT, /* bDescriptorType: cs endpoint descriptor type */
|
||||
0x01, /* bDescriptorSubtype: general subtype */
|
||||
@@ -304,7 +304,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
|
||||
0x00, /* bInterfaceProtocol: unused */
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
|
||||
0x09, /* bLength: descriptor size */
|
||||
USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
AUDIO_SPK_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
|
||||
@@ -313,8 +313,8 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
|
||||
AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
|
||||
0x00, /* bInterfaceProtocol: unused */
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
0x00, /* iInterface: unused */
|
||||
|
||||
0x07, /* bLength: configuration descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
AUDIO_AS_GENERAL, /* bDescriptorSubtype: general sub type*/
|
||||
@@ -322,7 +322,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x01, /* bDelay: interface delay */
|
||||
0x01, /* wFormatTag: pcm format*/
|
||||
0x00, /* wFormatTag: pcm format*/
|
||||
|
||||
|
||||
0x08 + AUDIO_SPK_FREQ_SIZE * 3, /* bLength: descriptor size */
|
||||
AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
AUDIO_AS_FORMAT_TYPE, /* bDescriptorSubtype: format subtype */
|
||||
@@ -331,13 +331,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
AUDIO_SPK_BITW / 8, /* bSubFrameSize: per audio subframe */
|
||||
AUDIO_SPK_BITW, /* bBitResolution: n bits per sample */
|
||||
AUDIO_SPK_FREQ_SIZE, /* bSamFreqType: n frequency supported */
|
||||
#if (AUDIO_SUPPORT_FREQ_16K == 1)
|
||||
#if (AUDIO_SUPPORT_FREQ_16K == 1)
|
||||
SAMPLE_FREQ(AT32_AUDIO_FREQ_16K), /* tSamFreq: 16000hz */
|
||||
#endif
|
||||
#if (AUDIO_SUPPORT_FREQ_48K == 1)
|
||||
#if (AUDIO_SUPPORT_FREQ_48K == 1)
|
||||
SAMPLE_FREQ(AT32_AUDIO_FREQ_48K), /* tSamFreq: 48000hz */
|
||||
#endif
|
||||
|
||||
|
||||
0x09, /* bLength: size of endpoint descriptor in bytes */
|
||||
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
|
||||
USBD_AUHID_AUDIO_SPK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
|
||||
@@ -359,7 +359,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x00, /* bLockDelayUnits: unused */
|
||||
0x00, /* wLockDelay: unused */
|
||||
0x00, /* wLockDelay: unused */
|
||||
|
||||
|
||||
#if (AUDIO_SUPPORT_FEEDBACK == 1)
|
||||
0x09, /* bLength: size of endpoint descriptor in bytes */
|
||||
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
|
||||
@@ -370,11 +370,11 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
1, /* bInterval: interval for polling endpoint for data transfers */
|
||||
FEEDBACK_REFRESH_TIME, /* bRefresh: this field indicates the rate at which an iso syncronization
|
||||
pipe provides new syncronization feedback data. this rate must be a power of
|
||||
2, therefore only the power is reported back and the range of this field is from
|
||||
2, therefore only the power is reported back and the range of this field is from
|
||||
1(2ms) to 9(512ms) */
|
||||
0x00, /* bSynchAddress: 0x00*/
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
|
||||
@@ -386,7 +386,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
0x00, /* bInterfaceSubClass: subclass code */
|
||||
0x00, /* bInterfaceProtocol: protocol code */
|
||||
0x00, /* iInterface: index of string descriptor */
|
||||
|
||||
|
||||
0x09, /* bLength: size of HID descriptor in bytes */
|
||||
HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
|
||||
LBYTE(AUHID_HID_BCD_NUM),
|
||||
@@ -396,7 +396,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
|
||||
LBYTE(sizeof(g_usbd_audio_hid_report)),
|
||||
HBYTE(sizeof(g_usbd_audio_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
|
||||
|
||||
|
||||
USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
|
||||
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
|
||||
USBD_AUHID_HID_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
|
||||
@@ -404,12 +404,12 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
LBYTE(USBD_AUHID_IN_MAXPACKET_SIZE),
|
||||
HBYTE(USBD_AUHID_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
|
||||
AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
|
||||
|
||||
|
||||
USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
|
||||
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
|
||||
USBD_AUHID_HID_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
|
||||
USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
|
||||
LBYTE(USBD_AUHID_OUT_MAXPACKET_SIZE),
|
||||
LBYTE(USBD_AUHID_OUT_MAXPACKET_SIZE),
|
||||
HBYTE(USBD_AUHID_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
|
||||
AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
|
||||
};
|
||||
@@ -420,94 +420,94 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
|
||||
#if defined ( __ICCARM__ ) /* iar compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
ALIGNED_HEAD uint8_t g_usbd_audio_hid_report[USBD_AUHID_HID_SIZ_REPORT_DESC] ALIGNED_TAIL =
|
||||
ALIGNED_HEAD uint8_t g_usbd_audio_hid_report[USBD_AUHID_HID_SIZ_REPORT_DESC] ALIGNED_TAIL =
|
||||
{
|
||||
0x06, 0xFF, 0x00, /* USAGE_PAGE(Vendor Page:0xFF00) */
|
||||
0x09, 0x01, /* USAGE (Demo Kit) */
|
||||
0xa1, 0x01, /* COLLECTION (Application) */
|
||||
0x06, 0xFF, 0x00, /* USAGE_PAGE(Vendor Page:0xFF00) */
|
||||
0x09, 0x01, /* USAGE (Demo Kit) */
|
||||
0xa1, 0x01, /* COLLECTION (Application) */
|
||||
/* 7 */
|
||||
|
||||
|
||||
/* Led 2 */
|
||||
0x85, HID_REPORT_ID_2, /* REPORT_ID 2 */
|
||||
0x09, 0x02, /* USAGE (LED 2) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (1) */
|
||||
0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (1) */
|
||||
0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
|
||||
0x85, 0x02, /* REPORT_ID (2) */
|
||||
0x09, 0x02, /* USAGE (LED 2) */
|
||||
0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
|
||||
/* 27 */
|
||||
|
||||
/* Led 3 */
|
||||
|
||||
/* Led 3 */
|
||||
0x85, HID_REPORT_ID_3, /* REPORT_ID (3) */
|
||||
0x09, 0x03, /* USAGE (LED 3) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (1) */
|
||||
0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (1) */
|
||||
0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
|
||||
0x85, 0x03, /* REPORT_ID (3) */
|
||||
0x09, 0x03, /* USAGE (LED 3) */
|
||||
0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
|
||||
/* 47 */
|
||||
|
||||
|
||||
/* Led 4 */
|
||||
0x85, HID_REPORT_ID_4, /* REPORT_ID 4) */
|
||||
0x09, 0x04, /* USAGE (LED 4) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (1) */
|
||||
0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (1) */
|
||||
0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
|
||||
0x85, 0x04, /* REPORT_ID (4) */
|
||||
0x09, 0x04, /* USAGE (LED 4) */
|
||||
0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
|
||||
/* 67 */
|
||||
|
||||
/* key Push Button */
|
||||
|
||||
/* key Push Button */
|
||||
0x85, HID_REPORT_ID_5, /* REPORT_ID (5) */
|
||||
0x09, 0x05, /* USAGE (Push Button) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x82, /* INPUT (Data,Var,Abs,Vol) */
|
||||
|
||||
0x09, 0x05, /* USAGE (Push Button) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0xb1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
|
||||
0x75, 0x07, /* REPORT_SIZE (7) */
|
||||
0x81, 0x83, /* INPUT (Cnst,Var,Abs,Vol) */
|
||||
0x85, 0x05, /* REPORT_ID (5) */
|
||||
|
||||
0x75, 0x07, /* REPORT_SIZE (7) */
|
||||
0xb1, 0x83, /* FEATURE (Cnst,Var,Abs,Vol) */
|
||||
0x09, 0x05, /* USAGE (Push Button) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x82, /* INPUT (Data,Var,Abs,Vol) */
|
||||
|
||||
0x09, 0x05, /* USAGE (Push Button) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0xb1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
|
||||
|
||||
0x75, 0x07, /* REPORT_SIZE (7) */
|
||||
0x81, 0x83, /* INPUT (Cnst,Var,Abs,Vol) */
|
||||
0x85, 0x05, /* REPORT_ID (5) */
|
||||
|
||||
0x75, 0x07, /* REPORT_SIZE (7) */
|
||||
0xb1, 0x83, /* FEATURE (Cnst,Var,Abs,Vol) */
|
||||
/* 95 */
|
||||
|
||||
/* Data OUT */
|
||||
0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
|
||||
0x09, 0x06, /* USAGE */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x26, 0x00,0xff, /* LOGICAL_MAXIMUM (255) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (64) */
|
||||
0x91, 0x02, /* OUTPUT(Data,Var,Abs,Vol) */
|
||||
|
||||
/* Data OUT */
|
||||
0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
|
||||
0x09, 0x06, /* USAGE */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x26, 0x00,0xff, /* LOGICAL_MAXIMUM (255) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (64) */
|
||||
0x91, 0x02, /* OUTPUT(Data,Var,Abs,Vol) */
|
||||
/* 110 */
|
||||
|
||||
/* Data IN */
|
||||
0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
|
||||
0x09, 0x07, /* USAGE */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x26, 0x00,0xff, /* LOGICAL_MAXIMUM (255) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (64) */
|
||||
0x81, 0x82, /* INPUT(Data,Var,Abs,Vol) */
|
||||
|
||||
|
||||
/* Data IN */
|
||||
0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
|
||||
0x09, 0x07, /* USAGE */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x26, 0x00,0xff, /* LOGICAL_MAXIMUM (255) */
|
||||
0x75, 0x08, /* REPORT_SIZE (8) */
|
||||
0x95, 0x3F, /* REPORT_COUNT (64) */
|
||||
0x81, 0x82, /* INPUT(Data,Var,Abs,Vol) */
|
||||
|
||||
/* 125 */
|
||||
0xc0 /* END_COLLECTION */
|
||||
};
|
||||
@@ -518,7 +518,7 @@ ALIGNED_HEAD uint8_t g_usbd_audio_hid_report[USBD_AUHID_HID_SIZ_REPORT_DESC] ALI
|
||||
#if defined ( __ICCARM__ ) /* iar compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
ALIGNED_HEAD uint8_t g_audio_hid_usb_desc[9] ALIGNED_TAIL =
|
||||
ALIGNED_HEAD uint8_t g_audio_hid_usb_desc[9] ALIGNED_TAIL =
|
||||
{
|
||||
0x09, /* bLength: size of HID descriptor in bytes */
|
||||
HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
|
||||
@@ -592,24 +592,24 @@ static usbd_desc_t vp_desc;
|
||||
* @brief standard usb unicode convert
|
||||
* @param string: source string
|
||||
* @param unicode_buf: unicode buffer
|
||||
* @retval length
|
||||
* @retval length
|
||||
*/
|
||||
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
|
||||
{
|
||||
uint16_t str_len = 0, id_pos = 2;
|
||||
uint8_t *tmp_str = string;
|
||||
|
||||
|
||||
while(*tmp_str != '\0')
|
||||
{
|
||||
str_len ++;
|
||||
unicode_buf[id_pos ++] = *tmp_str ++;
|
||||
unicode_buf[id_pos ++] = 0x00;
|
||||
}
|
||||
|
||||
|
||||
str_len = str_len * 2 + 2;
|
||||
unicode_buf[0] = str_len;
|
||||
unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
|
||||
|
||||
|
||||
return str_len;
|
||||
}
|
||||
|
||||
@@ -618,12 +618,12 @@ static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
|
||||
* @param value: int value
|
||||
* @param pbus: unicode buffer
|
||||
* @param len: length
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
|
||||
{
|
||||
uint8_t idx = 0;
|
||||
|
||||
|
||||
for( idx = 0 ; idx < len ; idx ++)
|
||||
{
|
||||
if( ((value >> 28)) < 0xA )
|
||||
@@ -632,11 +632,11 @@ static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
|
||||
}
|
||||
else
|
||||
{
|
||||
pbuf[2 * idx] = (value >> 28) + 'A' - 10;
|
||||
pbuf[2 * idx] = (value >> 28) + 'A' - 10;
|
||||
}
|
||||
|
||||
|
||||
value = value << 4;
|
||||
|
||||
|
||||
pbuf[2 * idx + 1] = 0;
|
||||
}
|
||||
}
|
||||
@@ -644,18 +644,18 @@ static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
|
||||
/**
|
||||
* @brief usb get serial number
|
||||
* @param none
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
static void get_serial_num(void)
|
||||
{
|
||||
uint32_t serial0, serial1, serial2;
|
||||
|
||||
|
||||
serial0 = *(uint32_t*)MCU_ID1;
|
||||
serial1 = *(uint32_t*)MCU_ID2;
|
||||
serial2 = *(uint32_t*)MCU_ID3;
|
||||
|
||||
|
||||
serial0 += serial2;
|
||||
|
||||
|
||||
if (serial0 != 0)
|
||||
{
|
||||
usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
|
||||
@@ -666,7 +666,7 @@ static void get_serial_num(void)
|
||||
/**
|
||||
* @brief get device descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_descriptor(void)
|
||||
{
|
||||
@@ -676,7 +676,7 @@ static usbd_desc_t *get_device_descriptor(void)
|
||||
/**
|
||||
* @brief get device qualifier
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t * get_device_qualifier(void)
|
||||
{
|
||||
@@ -686,7 +686,7 @@ static usbd_desc_t * get_device_qualifier(void)
|
||||
/**
|
||||
* @brief get config descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_configuration(void)
|
||||
{
|
||||
@@ -696,7 +696,7 @@ static usbd_desc_t *get_device_configuration(void)
|
||||
/**
|
||||
* @brief get other speed descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_other_speed(void)
|
||||
{
|
||||
@@ -706,7 +706,7 @@ static usbd_desc_t *get_device_other_speed(void)
|
||||
/**
|
||||
* @brief get lang id descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_lang_id(void)
|
||||
{
|
||||
@@ -717,7 +717,7 @@ static usbd_desc_t *get_device_lang_id(void)
|
||||
/**
|
||||
* @brief get manufacturer descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_manufacturer_string(void)
|
||||
{
|
||||
@@ -729,7 +729,7 @@ static usbd_desc_t *get_device_manufacturer_string(void)
|
||||
/**
|
||||
* @brief get product descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_product_string(void)
|
||||
{
|
||||
@@ -741,7 +741,7 @@ static usbd_desc_t *get_device_product_string(void)
|
||||
/**
|
||||
* @brief get serial descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_serial_string(void)
|
||||
{
|
||||
@@ -752,7 +752,7 @@ static usbd_desc_t *get_device_serial_string(void)
|
||||
/**
|
||||
* @brief get interface descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_interface_string(void)
|
||||
{
|
||||
@@ -764,7 +764,7 @@ static usbd_desc_t *get_device_interface_string(void)
|
||||
/**
|
||||
* @brief get device config descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
static usbd_desc_t *get_device_config_string(void)
|
||||
{
|
||||
@@ -775,7 +775,7 @@ static usbd_desc_t *get_device_config_string(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_desc.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb audio descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __AUDIO_HID_DESC_H
|
||||
#define __AUDIO_HID_DESC_H
|
||||
@@ -31,7 +31,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include "audio_hid_class.h"
|
||||
#include "usbd_core.h"
|
||||
#include "audio_conf.h"
|
||||
@@ -39,15 +39,15 @@ extern "C" {
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup USB_audio_hid_desc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_audio_hid_desc_definition
|
||||
/** @defgroup USB_audio_hid_desc_definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#define AUHID_BCD_NUM 0x0100
|
||||
|
||||
#define USBD_AUHID_VENDOR_ID 0x2E3C
|
||||
@@ -69,7 +69,7 @@ extern "C" {
|
||||
#define AUDIO_SUBCLASS_MIDISTREMING 0x03
|
||||
|
||||
/**
|
||||
* @brief audio class-specific descriptor types
|
||||
* @brief audio class-specific descriptor types
|
||||
*/
|
||||
#define AUDIO_CS_INTERFACE 0x24
|
||||
#define AUDIO_CS_ENDPOINT 0x25
|
||||
@@ -97,7 +97,7 @@ extern "C" {
|
||||
#define AUDIO_AC_EXTENSION_UNIT 0x08
|
||||
|
||||
/**
|
||||
* @brief audio class-specific as interface descriptor subtypes
|
||||
* @brief audio class-specific as interface descriptor subtypes
|
||||
*/
|
||||
#define AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
|
||||
#define AUDIO_AS_GENERAL 0x01
|
||||
@@ -217,7 +217,7 @@ extern "C" {
|
||||
#define HID_CLASS_DESC_PHYSICAL 0x23
|
||||
|
||||
/**
|
||||
* @brief usb hid report id define
|
||||
* @brief usb hid report id define
|
||||
*/
|
||||
#define HID_REPORT_ID_1 0x01
|
||||
#define HID_REPORT_ID_2 0x02
|
||||
@@ -249,11 +249,11 @@ extern usbd_desc_handler audio_hid_desc_handler;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user