mirror of
https://github.com/ArteryTek/AT32F403A_407_Firmware_Library.git
synced 2026-05-21 09:22:19 +00:00
update version to v2.2.2
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
* @file audio_class.c
|
||||
* @brief usb audio class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -417,32 +418,75 @@ static void audio_req_get_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio->g_audio_cur[0] = paudio->spk_mute;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio->g_audio_cur[0] = paudio->mic_mute;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio->g_audio_cur[0] = paudio->spk_mute;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio->g_audio_cur[0] = paudio->mic_mute;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
|
||||
{
|
||||
if(setup->wIndex == USBD_AUDIO_MIC_IN_EPT)
|
||||
{
|
||||
*((uint32_t *)paudio->g_audio_cur) = paudio->mic_freq;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(setup->wIndex == USBD_AUDIO_SPK_OUT_EPT)
|
||||
{
|
||||
*((uint32_t *)paudio->g_audio_cur) = paudio->spk_freq;
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,19 +515,35 @@ static void audio_req_set_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
paudio->request_no = AUDIO_MUTE_CONTROL;
|
||||
}
|
||||
else
|
||||
else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
|
||||
{
|
||||
paudio->request_no = AUDIO_VOLUME_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
paudio->enpd = setup->wIndex;
|
||||
paudio->request_no = AUDIO_FREQ_SET_CONTROL;
|
||||
if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
|
||||
{
|
||||
paudio->enpd = setup->wIndex;
|
||||
paudio->request_no = AUDIO_FREQ_SET_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -496,15 +556,31 @@ static void audio_req_get_min(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,15 +594,31 @@ static void audio_req_get_max(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,15 +632,30 @@ static void audio_req_get_res(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,7 +714,10 @@ static void audio_get_interface(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_ctrl_send(pudev, (uint8_t *)&paudio->mic_alt_setting, 1);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_class.h
|
||||
* @brief usb audio class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -74,6 +75,7 @@ extern "C" {
|
||||
#define AUDIO_MUTE_CONTROL 0x01
|
||||
#define AUDIO_VOLUME_CONTROL 0x02
|
||||
#define AUDIO_FREQ_SET_CONTROL 0x03
|
||||
#define AUDIO_SAMPLING_FREQ_CONTROL 0x01
|
||||
|
||||
/**
|
||||
* @brief audio descriptor type
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_conf.h
|
||||
* @brief usb audio config
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_desc.c
|
||||
* @brief usb audio device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_desc.h
|
||||
* @brief usb audio descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_conf.h
|
||||
* @brief usb audio config
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_class.c
|
||||
* @brief usb audio class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -580,32 +581,75 @@ static void audio_req_get_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio_hid->g_audio_cur[0] = paudio_hid->spk_mute;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio_hid->g_audio_cur[0] = paudio_hid->mic_mute;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio_hid->g_audio_cur[0] = paudio_hid->spk_mute;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
|
||||
{
|
||||
paudio_hid->g_audio_cur[0] = paudio_hid->mic_mute;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
|
||||
{
|
||||
if(setup->wIndex == USBD_AUHID_AUDIO_MIC_IN_EPT)
|
||||
{
|
||||
*((uint32_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_freq;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(setup->wIndex == USBD_AUHID_AUDIO_SPK_OUT_EPT)
|
||||
{
|
||||
*((uint32_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_freq;
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,6 +663,7 @@ static void audio_req_set_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
|
||||
if(setup->wLength > 0)
|
||||
{
|
||||
usbd_ctrl_recv(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
@@ -634,19 +679,35 @@ static void audio_req_set_cur(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
paudio_hid->request_no = AUDIO_MUTE_CONTROL;
|
||||
}
|
||||
else
|
||||
else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
|
||||
{
|
||||
paudio_hid->request_no = AUDIO_VOLUME_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
paudio_hid->enpd = setup->wIndex;
|
||||
paudio_hid->request_no = AUDIO_FREQ_SET_CONTROL;
|
||||
if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
|
||||
{
|
||||
paudio_hid->enpd = setup->wIndex;
|
||||
paudio_hid->request_no = AUDIO_FREQ_SET_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -659,15 +720,31 @@ static void audio_req_get_min(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[0];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,15 +758,31 @@ static void audio_req_get_max(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[1];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,15 +796,31 @@ static void audio_req_get_res(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
case AUDIO_REQ_CONTROL_INTERFACE:
|
||||
if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
|
||||
{
|
||||
*((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[2];
|
||||
usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
break;
|
||||
case AUDIO_REQ_CONTROL_ENDPOINT:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +879,10 @@ static void audio_get_interface(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->mic_alt_setting, 1);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_class.h
|
||||
* @brief usb audio class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -86,6 +87,7 @@ extern "C" {
|
||||
#define AUDIO_MUTE_CONTROL 0x01
|
||||
#define AUDIO_VOLUME_CONTROL 0x02
|
||||
#define AUDIO_FREQ_SET_CONTROL 0x03
|
||||
#define AUDIO_SAMPLING_FREQ_CONTROL 0x01
|
||||
|
||||
/**
|
||||
* @brief audio descriptor type
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_desc.c
|
||||
* @brief usb audio device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file audio_desc.h
|
||||
* @brief usb audio descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_class.c
|
||||
* @brief usb cdc class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_class.h
|
||||
* @brief usb cdc class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_desc.c
|
||||
* @brief usb cdc device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_desc.h
|
||||
* @brief usb cdc descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_keyboard_class.c
|
||||
* @brief usb cdc and keyboard class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_keyboard_class.h
|
||||
* @brief usb cdc and keyboard class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_keyboard_desc.c
|
||||
* @brief usb cdc and keyboard device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_keyboard_desc.h
|
||||
* @brief usb cdc and keyboard descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_msc_class.c
|
||||
* @brief usb cdc class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_msc_class.h
|
||||
* @brief usb cdc class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_msc_desc.c
|
||||
* @brief usb cdc device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file cdc_msc_desc.h
|
||||
* @brief usb cdc descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_bot_scsi.c
|
||||
* @brief usb mass storage bulk-only transport and scsi command
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file custom_hid_class.c
|
||||
* @brief usb custom hid class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -71,7 +72,7 @@ usbd_class_handler custom_hid_class_handler =
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_init_handler(void *udev)
|
||||
static usb_sts_type class_init_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
@@ -91,6 +92,8 @@ usb_sts_type class_init_handler(void *udev)
|
||||
/* set out endpoint to receive status */
|
||||
usbd_ept_recv(pudev, USBD_CUSTOM_HID_OUT_EPT, pcshid->g_rxhid_buff, USBD_CUSTOM_OUT_MAXPACKET_SIZE);
|
||||
|
||||
pcshid->send_state = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -246,7 +249,10 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
|
||||
|
||||
pcshid->send_state = 0;
|
||||
/* ...user code...
|
||||
trans next packet data
|
||||
*/
|
||||
@@ -332,12 +338,16 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
*/
|
||||
usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usb_sts_type status = USB_FAIL;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pcshid->send_state == 0)
|
||||
{
|
||||
pcshid->send_state = 1;
|
||||
usbd_ept_send(pudev, USBD_CUSTOM_HID_IN_EPT, report, len);
|
||||
|
||||
status = USB_OK;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -391,7 +401,7 @@ static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
pcshid->g_txhid_buff[i_index] = report[i_index];
|
||||
}
|
||||
usbd_ept_send(pudev, USBD_CUSTOM_HID_IN_EPT, pcshid->g_txhid_buff, len);
|
||||
custom_hid_class_send_report(pudev, pcshid->g_txhid_buff, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file custom_hid_class.h
|
||||
* @brief usb custom hid header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -77,6 +78,7 @@ typedef struct
|
||||
uint8_t hid_set_report[64];
|
||||
uint8_t hid_get_report[64];
|
||||
uint8_t hid_state;
|
||||
uint8_t send_state;
|
||||
}custom_hid_type;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file custom_hid_desc.c
|
||||
* @brief usb hid device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file custom_hid_desc.h
|
||||
* @brief usb custom hid descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file hid_iap_class.c
|
||||
* @brief usb hid iap class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file hid_iap_class.h
|
||||
* @brief usb hid iap header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file hid_iap_desc.c
|
||||
* @brief usb hid device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file hid_iap_desc.h
|
||||
* @brief usb hid descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file keyboard_class.c
|
||||
* @brief usb hid keyboard class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -217,6 +218,7 @@ static usb_sts_type class_init_handler(void *udev)
|
||||
usbd_ept_open(pudev, USBD_KEYBOARD_IN_EPT, EPT_INT_TYPE, USBD_KEYBOARD_IN_MAXPACKET_SIZE);
|
||||
|
||||
pkeyboard->g_u8tx_completed = 1;
|
||||
pkeyboard->send_state = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -373,6 +375,7 @@ static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
trans next packet data
|
||||
*/
|
||||
pkeyboard->g_u8tx_completed = 1;
|
||||
pkeyboard->send_state = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -446,11 +449,16 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
*/
|
||||
usb_sts_type usb_keyboard_class_send_report(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usb_sts_type status = USB_FAIL;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
|
||||
keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pkeyboard->send_state == 0)
|
||||
{
|
||||
pkeyboard->send_state = 1;
|
||||
usbd_ept_send(pudev, USBD_KEYBOARD_IN_EPT, report, len);
|
||||
status = USB_OK;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file keyboard_class.h
|
||||
* @brief usb hid keyboard header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -71,6 +72,7 @@ typedef struct
|
||||
|
||||
__IO uint8_t hid_suspend_flag;
|
||||
__IO uint8_t g_u8tx_completed;
|
||||
uint8_t send_state;
|
||||
uint8_t hid_state;
|
||||
uint8_t temp;
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file keyboard_desc.c
|
||||
* @brief usb hid keyboard device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file keyboard_desc.h
|
||||
* @brief usb keyboard descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file mouse_class.c
|
||||
* @brief usb hid mouse class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -74,6 +75,7 @@ static usb_sts_type class_init_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
|
||||
|
||||
#ifndef USB_EPT_AUTO_MALLOC_BUFFER
|
||||
/* use user define buffer address */
|
||||
@@ -82,6 +84,8 @@ static usb_sts_type class_init_handler(void *udev)
|
||||
|
||||
/* open hid in endpoint */
|
||||
usbd_ept_open(pudev, USBD_MOUSE_IN_EPT, EPT_INT_TYPE, USBD_MOUSE_IN_MAXPACKET_SIZE);
|
||||
|
||||
pmouse->send_state = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -231,11 +235,13 @@ static usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
|
||||
|
||||
/* ...user code...
|
||||
trans next packet data
|
||||
*/
|
||||
|
||||
pmouse->send_state = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -308,11 +314,16 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
*/
|
||||
usb_sts_type usb_mouse_class_send_report(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usb_sts_type status = USB_FAIL;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pmouse->send_state == 0)
|
||||
{
|
||||
pmouse->send_state = 1;
|
||||
usbd_ept_send(pudev, USBD_MOUSE_IN_EPT, report, len);
|
||||
status = USB_OK;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file mouse_class.h
|
||||
* @brief usb hid mouse header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
@@ -87,6 +88,7 @@ typedef struct
|
||||
uint8_t mouse_buffer[4];
|
||||
uint8_t hid_state;
|
||||
__IO uint8_t hid_suspend_flag;
|
||||
uint8_t send_state;
|
||||
}mouse_type;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file mouse_desc.c
|
||||
* @brief usb hid mouse device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file mouse_desc.h
|
||||
* @brief usb mouse descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_bot_scsi.c
|
||||
* @brief usb mass storage bulk-only transport and scsi command
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_bot_scsi.h
|
||||
* @brief usb mass storage bulk-only transport and scsi command header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_class.c
|
||||
* @brief usb msc class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_class.h
|
||||
* @brief usb msc class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_desc.c
|
||||
* @brief usb msc device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file msc_desc.h
|
||||
* @brief usb msc descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file printer_class.c
|
||||
* @brief usb printer class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file printer_class.h
|
||||
* @brief usb printer class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file printer_desc.c
|
||||
* @brief usb printer device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file printer_desc.h
|
||||
* @brief usb printer descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file winusb_class.c
|
||||
* @brief usb winusb class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file winusb_class.h
|
||||
* @brief usb winusb class file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file winusb_desc.c
|
||||
* @brief usb winusb device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file winusb_desc.h
|
||||
* @brief usb winusb descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* Copyright (c) 2025, Artery Technology, All rights reserved.
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
|
||||
Reference in New Issue
Block a user