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:
Binary file not shown.
1015
document/ReleaseNotes_AT32F403A_407_Firmware_Library.htm
Normal file
1015
document/ReleaseNotes_AT32F403A_407_Firmware_Library.htm
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407.h
|
||||
* @brief at32f403a_407 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.
|
||||
@@ -161,7 +162,7 @@ extern "C" {
|
||||
*/
|
||||
#define __AT32F403A_407_LIBRARY_VERSION_MAJOR (0x02) /*!< [31:24] major version */
|
||||
#define __AT32F403A_407_LIBRARY_VERSION_MIDDLE (0x02) /*!< [23:16] middle version */
|
||||
#define __AT32F403A_407_LIBRARY_VERSION_MINOR (0x01) /*!< [15:8] minor version */
|
||||
#define __AT32F403A_407_LIBRARY_VERSION_MINOR (0x02) /*!< [15:8] minor version */
|
||||
#define __AT32F403A_407_LIBRARY_VERSION_RC (0x00) /*!< [7:0] release candidate */
|
||||
#define __AT32F403A_407_LIBRARY_VERSION ((__AT32F403A_407_LIBRARY_VERSION_MAJOR << 24) | \
|
||||
(__AT32F403A_407_LIBRARY_VERSION_MIDDLE << 16) | \
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407_conf.h
|
||||
* @brief at32f403a_407 config 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 system_at32f403a_407.c
|
||||
* @brief contains all the functions for cmsis cortex-m4 system source 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.
|
||||
@@ -136,14 +137,14 @@ void system_core_clock_update(void)
|
||||
pll_mult_h = CRM->cfg_bit.pllmult_h;
|
||||
/* process high bits */
|
||||
if((pll_mult_h != 0U) || (pll_mult == 15U)){
|
||||
pll_mult += ((16U * pll_mult_h) + 1U);
|
||||
pll_mult += ((16U * pll_mult_h) + 1U);
|
||||
}
|
||||
else
|
||||
{
|
||||
pll_mult += 2U;
|
||||
pll_mult += 2U;
|
||||
}
|
||||
|
||||
if (pll_clock_source == 0x00)
|
||||
if(pll_clock_source == 0x00)
|
||||
{
|
||||
/* hick divided by 2 selected as pll clock entry */
|
||||
system_core_clock = (HICK_VALUE >> 1) * pll_mult;
|
||||
@@ -151,7 +152,7 @@ void system_core_clock_update(void)
|
||||
else
|
||||
{
|
||||
/* hext selected as pll clock entry */
|
||||
if (CRM->cfg_bit.pllhextdiv != RESET)
|
||||
if(CRM->cfg_bit.pllhextdiv != RESET)
|
||||
{
|
||||
hext_prediv = CRM->misc3_bit.hextdiv;
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file system_at32f403a_407.h
|
||||
* @brief cmsis cortex-m4 system 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.
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
|
||||
<meta name=Generator content="Microsoft Word 15 (filtered)">
|
||||
<style>
|
||||
<!--
|
||||
/* Font Definitions */
|
||||
@font-face
|
||||
{font-family:Wingdings;
|
||||
panose-1:5 0 0 0 0 0 0 0 0 0;}
|
||||
@font-face
|
||||
{font-family:宋体;
|
||||
panose-1:2 1 6 0 3 1 1 1 1 1;}
|
||||
@font-face
|
||||
{font-family:"Cambria Math";
|
||||
panose-1:2 4 5 3 5 4 6 3 2 4;}
|
||||
@font-face
|
||||
{font-family:Calibri;
|
||||
panose-1:2 15 5 2 2 2 4 3 2 4;}
|
||||
@font-face
|
||||
{font-family:"\@宋体";
|
||||
panose-1:2 1 6 0 3 1 1 1 1 1;}
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
text-align:justify;
|
||||
text-justify:inter-ideograph;
|
||||
font-size:10.5pt;
|
||||
font-family:"Calibri",sans-serif;}
|
||||
p.MsoHeader, li.MsoHeader, div.MsoHeader
|
||||
{mso-style-link:"页眉 字符";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
text-align:center;
|
||||
layout-grid-mode:char;
|
||||
border:none;
|
||||
padding:0cm;
|
||||
font-size:9.0pt;
|
||||
font-family:"Calibri",sans-serif;}
|
||||
p.MsoFooter, li.MsoFooter, div.MsoFooter
|
||||
{mso-style-link:"页脚 字符";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
layout-grid-mode:char;
|
||||
font-size:9.0pt;
|
||||
font-family:"Calibri",sans-serif;}
|
||||
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
|
||||
{mso-style-link:"批注框文本 字符";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
text-align:justify;
|
||||
text-justify:inter-ideograph;
|
||||
font-size:9.0pt;
|
||||
font-family:"Calibri",sans-serif;}
|
||||
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
text-align:justify;
|
||||
text-justify:inter-ideograph;
|
||||
text-indent:21.0pt;
|
||||
font-size:10.5pt;
|
||||
font-family:"Calibri",sans-serif;}
|
||||
span.a
|
||||
{mso-style-name:"批注框文本 字符";
|
||||
mso-style-link:批注框文本;}
|
||||
span.a0
|
||||
{mso-style-name:"页眉 字符";
|
||||
mso-style-link:页眉;}
|
||||
span.a1
|
||||
{mso-style-name:"页脚 字符";
|
||||
mso-style-link:页脚;}
|
||||
p.Default, li.Default, div.Default
|
||||
{mso-style-name:Default;
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
text-autospace:none;
|
||||
font-size:12.0pt;
|
||||
font-family:"Calibri",sans-serif;
|
||||
color:black;}
|
||||
/* Page Definitions */
|
||||
@page WordSection1
|
||||
{size:595.3pt 841.9pt;
|
||||
margin:72.0pt 90.0pt 72.0pt 90.0pt;
|
||||
layout-grid:15.6pt;}
|
||||
div.WordSection1
|
||||
{page:WordSection1;}
|
||||
/* List Definitions */
|
||||
ol
|
||||
{margin-bottom:0cm;}
|
||||
ul
|
||||
{margin-bottom:0cm;}
|
||||
-->
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body lang=ZH-CN style='text-justify-trim:punctuation'>
|
||||
|
||||
<div class=WordSection1 style='layout-grid:15.6pt'>
|
||||
|
||||
<p class=MsoNormal align=center style='text-align:center;word-break:break-all'><b><i><span
|
||||
lang=EN-US style='font-size:16.0pt;font-family:"Arial",sans-serif;color:#0070C0'>Release
|
||||
Notes for </span></i></b></p>
|
||||
|
||||
<p class=MsoNormal align=center style='text-align:center;word-break:break-all'><b><i><span
|
||||
lang=EN-US style='font-size:16.0pt;font-family:"Arial",sans-serif;color:#0070C0'>AT32F403A_407
|
||||
Firmware Library Drivers</span></i></b></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.8-2025/11/24</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span lang=EN-US>GPIO</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US style='font-family:Wingdings'>l<span
|
||||
style='font:7.0pt "Times New Roman"'> </span></span><span
|
||||
style='font-family:宋体'>更新</span><span lang=EN-US>gpio_bits_toggle()</span><span
|
||||
style='font-family:宋体'>函数,操作流程更严谨。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span lang=EN-US>USB</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US style='font-family:Wingdings'>l<span
|
||||
style='font:7.0pt "Times New Roman"'> </span></span><span
|
||||
style='font-family:宋体'>更新</span><span lang=EN-US>usb_ept_open()</span><span
|
||||
style='font-family:宋体'>函数,当设置同步</span><span lang=EN-US>IN</span><span
|
||||
style='font-family:宋体'>传输端点时,默认将端点状态由</span><span lang=EN-US>NAK</span><span
|
||||
style='font-family:宋体'>改为</span><span lang=EN-US>DISABLE</span><span
|
||||
style='font-family:宋体'>,解决同步端点在错误的</span><span lang=EN-US>NAK</span><span
|
||||
style='font-family:宋体'>状态下引起错误。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US>3.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span lang=EN-US>TMR</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US style='font-family:Wingdings'>l<span
|
||||
style='font:7.0pt "Times New Roman"'> </span></span><span
|
||||
style='font-family:宋体'>更新</span><span lang=EN-US>tmr_pwm_input_config()</span><span
|
||||
style='font-family:宋体'>、</span><span lang=EN-US>tmr_encoder_mode_config()</span><span
|
||||
style='font-family:宋体'>和</span><span lang=EN-US>tmr_output_channel_config()</span><span
|
||||
style='font-family:宋体'>函数。通道模式配置前关闭通道使能,否则通道模式无法切换。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt;
|
||||
word-break:break-all'><span lang=EN-US>4.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新部分注释。</span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'> </span></b></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.7-2025/04/25</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新</span><span lang=EN-US>RTC</span><span
|
||||
style='font-family:宋体'>计数值读取流程。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新</span><span lang=EN-US>Flash</span><span
|
||||
style='font-family:宋体'>驱动,优化部分流程。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>3.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>新增</span><span lang=EN-US>gpio_bits_toggle</span><span
|
||||
style='font-family:宋体'>函数。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.6-2024/12/13</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新</span><span lang=EN-US>CAN</span><span
|
||||
style='font-family:宋体'>驱动。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新</span><span lang=EN-US>Flash</span><span
|
||||
style='font-family:宋体'>驱动。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>3.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新部分注释。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.5-2024/08/08</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新</span><span lang=EN-US>i2c_flag_clear</span><span
|
||||
style='font-family:宋体'>和</span><span lang=EN-US>i2c_init</span><span
|
||||
style='font-family:宋体'>函数。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新部分注释。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.4-2024/01/05</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>完善部分驱动流程在</span><span lang=EN-US>IAR7.4</span><span
|
||||
style='font-family:宋体'>下的编译警告。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>完善</span><span lang=EN-US>EMAC</span><span
|
||||
style='font-family:宋体'>的</span><span lang=EN-US>PTP</span><span
|
||||
style='font-family:宋体'>驱动。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.3-2023/10/26</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>各</span><span lang=EN-US>IP</span><span
|
||||
style='font-family:宋体'>驱动新增</span><span lang=EN-US>interrupt_flag_get</span><span
|
||||
style='font-family:宋体'>函数。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>优化系统时钟切换流程。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.2-2023/08/04</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span lang=EN-US>CRC</span><span style='font-family:宋体'>驱动新增多项式及多项式宽度可修改的支持。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span lang=EN-US>FLASH</span><span style='font-family:宋体'>中新增</span><span
|
||||
lang=EN-US>flash_spim_dummy_read</span><span style='font-family:宋体'>和</span><span
|
||||
lang=EN-US>flash_spim_mass_program</span><span style='font-family:宋体'>函数。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>3.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新了</span><span lang=EN-US>adc_ordinary_channel_set</span><span
|
||||
style='font-family:宋体'>和</span><span lang=EN-US>adc_preempt_channel_set</span><span
|
||||
style='font-family:宋体'>函数流程。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>4.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新部分注释。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.1-2023/02/16</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新</span><span lang=EN-US>EMAC</span><span
|
||||
style='font-family:宋体'>最大包长宏定义</span><span lang=EN-US>EMAC_MAX_PACKET_LENGTH</span><span
|
||||
style='font-family:宋体'>值为</span><span lang=EN-US>1524</span><span
|
||||
style='font-family:宋体'>。</span></p>
|
||||
|
||||
<p class=MsoNormal><span lang=EN-US> </span></p>
|
||||
|
||||
<p class=MsoNormal style='word-break:break-all'><b><span lang=EN-US
|
||||
style='font-family:"Arial",sans-serif;color:#7030A0'>V2.0.0-2022/11/18</span></b></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>1.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新了</span><span lang=EN-US>xmc_ext_timing_config</span><span
|
||||
style='font-family:宋体'>函数。</span></p>
|
||||
|
||||
<p class=MsoListParagraph style='margin-left:21.0pt;text-indent:-21.0pt'><span
|
||||
lang=EN-US>2.<span style='font:7.0pt "Times New Roman"'>
|
||||
</span></span><span style='font-family:宋体'>更新当</span><span lang=EN-US>HICK</span><span
|
||||
style='font-family:宋体'>作为</span><span lang=EN-US>PLL</span><span
|
||||
style='font-family:宋体'>时钟源时</span><span lang=EN-US>CRM_HICK48_NODIV</span><span
|
||||
style='font-family:宋体'>作为默认设置。</span></p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407_acc.h
|
||||
* @brief at32f403a_407 acc 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 at32f403a_407_adc.h
|
||||
* @brief at32f403a_407 adc 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 at32f403a_407_bpr.h
|
||||
* @brief at32f403a_407 bpr 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 at32f403a_407_can.h
|
||||
* @brief at32f403a_407 can 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 at32f403a_407_crc.h
|
||||
* @brief at32f403a_407 crc 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 at32f403a_407_crm.h
|
||||
* @brief at32f403a_407 crm 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 at32f403a_407_dac.h
|
||||
* @brief at32f403a_407 dac 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 at32f403a_407_debug.h
|
||||
* @brief at32f403a_407 debug 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 at32f403a_407_def.h
|
||||
* @brief at32f403a_407 macros 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 at32f403a_407_dma.h
|
||||
* @brief at32f403a_407 dma 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 at32f403a_407_emac.h
|
||||
* @brief at32f403a_407 emac 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 at32f403a_407_exint.h
|
||||
* @brief at32f403a_407 exint 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 at32f403a_407_flash.h
|
||||
* @brief at32f403a_407 flash 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 at32f403a_407_gpio.h
|
||||
* @brief at32f403a_407 gpio 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 at32f403a_407_i2c.h
|
||||
* @brief at32f403a_407 i2c 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 at32f403a_407_misc.h
|
||||
* @brief at32f403a_407 misc 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 at32f403a_407_pwc.h
|
||||
* @brief at32f403a_407 pwc 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 at32f403a_407_rtc.h
|
||||
* @brief at32f403a_407 rtc 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 at32f403a_407_sdio.h
|
||||
* @brief at32f403a_407 sdio 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 at32f403a_407_spi.h
|
||||
* @brief at32f403a_407 spi 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 at32f403a_407_tmr.h
|
||||
* @brief at32f403a_407 tmr 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 at32f403a_407_usart.h
|
||||
* @brief at32f403a_407 usart 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 at32f403a_407_usb.h
|
||||
* @brief at32f403a_407 usb 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 at32f403a_407_wdt.h
|
||||
* @brief at32f403a_407 wdt 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 at32f403a_407_wwdt.h
|
||||
* @brief at32f403a_407 wwdt 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 at32f403a_407_xmc.h
|
||||
* @brief at32f403a_407 xmc 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 at32f403a_407_acc.c
|
||||
* @brief contains all the functions for the acc firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_adc.c
|
||||
* @brief contains all the functions for the adc firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_bpr.c
|
||||
* @brief contains all the functions for the bpr firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_can.c
|
||||
* @brief contains all the functions for the can firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_crc.c
|
||||
* @brief contains all the functions for the crc firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_crm.c
|
||||
* @brief contains all the functions for the crm firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_dac.c
|
||||
* @brief contains all the functions for the dac firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_debug.c
|
||||
* @brief contains all the functions for the debug firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_dma.c
|
||||
* @brief contains all the functions for the dma firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_emac.c
|
||||
* @brief contains all the functions for the emac firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_exint.c
|
||||
* @brief contains all the functions for the exint firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_flash.c
|
||||
* @brief contains all the functions for the flash firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_gpio.c
|
||||
* @brief contains all the functions for the gpio firmware library
|
||||
**************************************************************************
|
||||
* 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.
|
||||
@@ -369,7 +370,9 @@ void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
|
||||
*/
|
||||
void gpio_bits_toggle(gpio_type *gpio_x, uint16_t pins)
|
||||
{
|
||||
gpio_x->odt ^= pins;
|
||||
uint32_t odt = gpio_x->odt;
|
||||
|
||||
gpio_x->scr = ((odt & pins) << 16) | (~odt & pins);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407_i2c.c
|
||||
* @brief contains all the functions for the i2c firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_misc.c
|
||||
* @brief contains all the functions for the misc firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_pwc.c
|
||||
* @brief contains all the functions for the pwc firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_rtc.c
|
||||
* @brief contains all the functions for the rtc firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_sdio.c
|
||||
* @brief contains all the functions for the sdio firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_spi.c
|
||||
* @brief contains all the functions for the spi firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_tmr.c
|
||||
* @brief contains all the functions for the tmr firmware library
|
||||
**************************************************************************
|
||||
* 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.
|
||||
@@ -359,21 +360,31 @@ void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_chan
|
||||
/* set channel output mode */
|
||||
channel = tmr_channel;
|
||||
|
||||
/* reset output channel(complementary) enable bit */
|
||||
chx_offset = (tmr_channel * 2);
|
||||
chcx_offset = ((tmr_channel * 2) + 2);
|
||||
tmr_x->cctrl &= ~(1<<chcx_offset);
|
||||
tmr_x->cctrl &= ~(1<<chx_offset);
|
||||
|
||||
switch(channel)
|
||||
{
|
||||
case TMR_SELECT_CHANNEL_1:
|
||||
tmr_x->cm1_output_bit.c1c = FALSE;
|
||||
tmr_x->cm1_output_bit.c1octrl = tmr_output_struct->oc_mode;
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_2:
|
||||
tmr_x->cm1_output_bit.c2c = FALSE;
|
||||
tmr_x->cm1_output_bit.c2octrl = tmr_output_struct->oc_mode;
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_3:
|
||||
tmr_x->cm2_output_bit.c3c = FALSE;
|
||||
tmr_x->cm2_output_bit.c3octrl = tmr_output_struct->oc_mode;
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_4:
|
||||
tmr_x->cm2_output_bit.c4c = FALSE;
|
||||
tmr_x->cm2_output_bit.c4octrl = tmr_output_struct->oc_mode;
|
||||
break;
|
||||
|
||||
@@ -398,9 +409,6 @@ void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_chan
|
||||
tmr_x->cctrl &= ~(1<<chx_offset);
|
||||
tmr_x->cctrl |= channel_index;
|
||||
|
||||
chx_offset = (tmr_channel * 2);
|
||||
chcx_offset = ((tmr_channel * 2) + 2);
|
||||
|
||||
/* get channel enable bit position in cctrl register */
|
||||
channel_index = (uint16_t)(tmr_output_struct->oc_output_state << (tmr_channel * 2));
|
||||
|
||||
@@ -408,11 +416,9 @@ void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_chan
|
||||
channel_c_index = (uint16_t)(tmr_output_struct->occ_output_state << ((tmr_channel * 2) + 2));
|
||||
|
||||
/* set output channel complementary enable bit */
|
||||
tmr_x->cctrl &= ~(1<<chcx_offset);
|
||||
tmr_x->cctrl |= channel_c_index;
|
||||
|
||||
/* set output channel enable bit */
|
||||
tmr_x->cctrl &= ~(1<<chx_offset);
|
||||
tmr_x->cctrl |= channel_index;
|
||||
}
|
||||
|
||||
@@ -834,7 +840,7 @@ void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct
|
||||
switch(channel)
|
||||
{
|
||||
case TMR_SELECT_CHANNEL_1:
|
||||
tmr_x->cctrl_bit.c1en = FALSE;
|
||||
tmr_x->cctrl_bit.c1en = FALSE;
|
||||
tmr_x->cctrl_bit.c1p = (uint32_t)input_struct->input_polarity_select;
|
||||
tmr_x->cctrl_bit.c1cp = (input_struct->input_polarity_select & 0x2) >> 1;
|
||||
tmr_x->cm1_input_bit.c1c = input_struct->input_mapped_select;
|
||||
@@ -844,7 +850,7 @@ void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_2:
|
||||
tmr_x->cctrl_bit.c2en = FALSE;
|
||||
tmr_x->cctrl_bit.c2en = FALSE;
|
||||
tmr_x->cctrl_bit.c2p = (uint32_t)input_struct->input_polarity_select;
|
||||
tmr_x->cctrl_bit.c2cp = (input_struct->input_polarity_select & 0x2) >> 1;
|
||||
tmr_x->cm1_input_bit.c2c = input_struct->input_mapped_select;
|
||||
@@ -854,7 +860,7 @@ void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_3:
|
||||
tmr_x->cctrl_bit.c3en = FALSE;
|
||||
tmr_x->cctrl_bit.c3en = FALSE;
|
||||
tmr_x->cctrl_bit.c3p = (uint32_t)input_struct->input_polarity_select;
|
||||
tmr_x->cctrl_bit.c3cp = (input_struct->input_polarity_select & 0x2) >> 1;
|
||||
tmr_x->cm2_input_bit.c3c = input_struct->input_mapped_select;
|
||||
@@ -864,7 +870,7 @@ void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_4:
|
||||
tmr_x->cctrl_bit.c4en = FALSE;
|
||||
tmr_x->cctrl_bit.c4en = FALSE;
|
||||
tmr_x->cctrl_bit.c4p = (uint32_t)input_struct->input_polarity_select;
|
||||
tmr_x->cm2_input_bit.c4c = input_struct->input_mapped_select;
|
||||
tmr_x->cm2_input_bit.c4df = input_struct->input_filter_value;
|
||||
@@ -1008,6 +1014,8 @@ void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct,
|
||||
switch(channel)
|
||||
{
|
||||
case TMR_SELECT_CHANNEL_1:
|
||||
tmr_x->cctrl_bit.c1en = FALSE;
|
||||
tmr_x->cctrl_bit.c2en = FALSE;
|
||||
if(input_struct->input_polarity_select == TMR_INPUT_RISING_EDGE)
|
||||
{
|
||||
/* set channel polarity */
|
||||
@@ -1051,6 +1059,8 @@ void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct,
|
||||
break;
|
||||
|
||||
case TMR_SELECT_CHANNEL_2:
|
||||
tmr_x->cctrl_bit.c1en = FALSE;
|
||||
tmr_x->cctrl_bit.c2en = FALSE;
|
||||
if(input_struct->input_polarity_select == TMR_INPUT_RISING_EDGE)
|
||||
{
|
||||
/* set channel polarity */
|
||||
@@ -1656,6 +1666,9 @@ void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode
|
||||
{
|
||||
tmr_x->stctrl_bit.smsel = encoder_mode;
|
||||
|
||||
tmr_x->cctrl_bit.c1en = FALSE;
|
||||
tmr_x->cctrl_bit.c2en = FALSE;
|
||||
|
||||
/* set ic1 polarity */
|
||||
tmr_x->cctrl_bit.c1p = (ic1_polarity & 0x1);
|
||||
tmr_x->cctrl_bit.c1cp = (ic1_polarity >> 1);
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407_usart.c
|
||||
* @brief contains all the functions for the usart firmware library
|
||||
**************************************************************************
|
||||
* 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.
|
||||
@@ -599,7 +600,7 @@ flag_status usart_flag_get(usart_type* usart_x, uint32_t flag)
|
||||
* USART1, USART2, USART3, UART4, UART5, USART6, UART7 or UART8.
|
||||
* @param flag: specifies the flag to check.
|
||||
* this parameter can be one of the following values:
|
||||
* - USART_CTSCF_FLAG: cts change flag (not available for UART4,UART5)
|
||||
* - USART_CTSCF_FLAG: cts change flag (not available for UART4,UART5,USART6,UART7 and UART8)
|
||||
* - USART_BFF_FLAG: break frame flag
|
||||
* - USART_TDBE_FLAG: transmit data buffer empty flag
|
||||
* - USART_TDC_FLAG: transmit data complete flag
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407_usb.c
|
||||
* @brief contains the functions for the usb firmware library
|
||||
**************************************************************************
|
||||
* 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.
|
||||
@@ -203,8 +204,16 @@ void usb_ept_open(usbd_type *usbx, usb_ept_info *ept_info)
|
||||
/* set endpoint reception status: disable */
|
||||
USB_SET_RXSTS(ept_info->eptn, USB_RX_DISABLE);
|
||||
|
||||
/* set endpoint transmision status: nak */
|
||||
USB_SET_TXSTS(ept_info->eptn, USB_TX_NAK);
|
||||
if(ept_info->trans_type == EPT_ISO_TYPE)
|
||||
{
|
||||
/* set endpoint transmision status: disable */
|
||||
USB_SET_TXSTS(ept_info->eptn, USB_TX_DISABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* set endpoint transmision status: nak */
|
||||
USB_SET_TXSTS(ept_info->eptn, USB_TX_NAK);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* @file at32f403a_407_wdt.c
|
||||
* @brief contains all the functions for the wdt firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_wwdt.c
|
||||
* @brief contains all the functions for the wwdt firmware library
|
||||
**************************************************************************
|
||||
* 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 at32f403a_407_xmc.c
|
||||
* @brief contains all the functions for the xmc firmware library
|
||||
**************************************************************************
|
||||
* 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 i2c_application.c
|
||||
* @brief the driver library of the i2c peripheral
|
||||
**************************************************************************
|
||||
* 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 i2c_application.h
|
||||
* @brief i2c application libray 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_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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
|
||||
{
|
||||
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;
|
||||
keyboard_type *pkeyboard = (keyboard_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 && 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 */
|
||||
@@ -83,6 +85,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.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user