update version to v2.0.8

This commit is contained in:
Artery-MCU
2022-11-22 18:16:27 +08:00
parent caea1e6d25
commit 0d6e76999d
1301 changed files with 16158 additions and 12379 deletions

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413.h * @file at32f413.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 header file * @brief at32f413 header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -68,6 +66,22 @@ extern "C" {
#define AT32F413xx #define AT32F413xx
#endif #endif
#if defined (AT32F413RBT7) || defined (AT32F413RCT7)
#define AT32F413Rx
#endif
#if defined (AT32F413CBU7) || defined (AT32F413CCU7) || defined (AT32F413C8T7) || \
defined (AT32F413CBT7) || defined (AT32F413CCT7)
#define AT32F413Cx
#endif
#if defined (AT32F413KBU7_4) || defined (AT32F413KCU7_4)
#define AT32F413Kx
#endif
#ifndef USE_STDPERIPH_DRIVER #ifndef USE_STDPERIPH_DRIVER
/** /**
* @brief comment the line below if you will not use the peripherals drivers. * @brief comment the line below if you will not use the peripherals drivers.
@@ -87,7 +101,7 @@ extern "C" {
*/ */
#define __AT32F413_LIBRARY_VERSION_MAJOR (0x02) /*!< [31:24] major version */ #define __AT32F413_LIBRARY_VERSION_MAJOR (0x02) /*!< [31:24] major version */
#define __AT32F413_LIBRARY_VERSION_MIDDLE (0x00) /*!< [23:16] middle version */ #define __AT32F413_LIBRARY_VERSION_MIDDLE (0x00) /*!< [23:16] middle version */
#define __AT32F413_LIBRARY_VERSION_MINOR (0x07) /*!< [15:8] minor version */ #define __AT32F413_LIBRARY_VERSION_MINOR (0x08) /*!< [15:8] minor version */
#define __AT32F413_LIBRARY_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __AT32F413_LIBRARY_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __AT32F413_LIBRARY_VERSION ((__AT32F413_LIBRARY_VERSION_MAJOR << 24) | \ #define __AT32F413_LIBRARY_VERSION ((__AT32F413_LIBRARY_VERSION_MAJOR << 24) | \
(__AT32F413_LIBRARY_VERSION_MIDDLE << 16) | \ (__AT32F413_LIBRARY_VERSION_MIDDLE << 16) | \

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_conf.h * @file at32f413_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 config header file * @brief at32f413 config header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
****************************************************************************** ******************************************************************************
* @file startup_at32f413.s * @file startup_at32f413.s
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413xx devices vector table for gcc toolchain. * @brief at32f413xx devices vector table for gcc toolchain.
* this module performs: * this module performs:
* - set the initial sp * - set the initial sp

View File

@@ -1,7 +1,5 @@
;************************************************************************** ;**************************************************************************
;* @file startup_at32f413.s ;* @file startup_at32f413.s
;* @version v2.0.7
;* @date 2022-08-16
;* @brief at32f413 startup file for IAR Systems ;* @brief at32f413 startup file for IAR Systems
;************************************************************************** ;**************************************************************************
; ;

View File

@@ -1,7 +1,5 @@
;************************************************************************** ;**************************************************************************
;* @file startup_at32f403a_407.s ;* @file startup_at32f403a_407.s
;* @version v2.0.7
;* @date 2022-08-16
;* @brief at32f403a_407 startup file for keil ;* @brief at32f403a_407 startup file for keil
;* <<< Use Configuration Wizard in Context Menu >>> ;* <<< Use Configuration Wizard in Context Menu >>>
;************************************************************************** ;**************************************************************************

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file system_at32f413.c * @file system_at32f413.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for cmsis cortex-m4 system source file * @brief contains all the functions for cmsis cortex-m4 system source file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file system_at32f413.h * @file system_at32f413.h
* @version v2.0.7
* @date 2022-08-16
* @brief cmsis cortex-m4 system header file. * @brief cmsis cortex-m4 system header file.
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,8 @@
/****************************************************************************** /******************************************************************************
* @file arm_sorting.h * @file arm_sorting.h
* @version v2.0.7
* @date 2022-08-16
* @brief Private header file for CMSIS DSP Library * @brief Private header file for CMSIS DSP Library
* @version V1.7.0
* @date 2019
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.

View File

@@ -1,8 +1,8 @@
/****************************************************************************** /******************************************************************************
* @file arm_vec_fft.h * @file arm_vec_fft.h
* @version v2.0.7
* @date 2022-08-16
* @brief Private header file for CMSIS DSP Library * @brief Private header file for CMSIS DSP Library
* @version V1.7.0
* @date 07. January 2020
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.

View File

@@ -1,8 +1,8 @@
/****************************************************************************** /******************************************************************************
* @file arm_vec_filtering.h * @file arm_vec_filtering.h
* @version v2.0.7
* @date 2022-08-16
* @brief Private header file for CMSIS DSP Library * @brief Private header file for CMSIS DSP Library
* @version V1.7.0
* @date 30. October 2019
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.

View File

@@ -1,8 +1,8 @@
/****************************************************************************** /******************************************************************************
* @file arm_math.h * @file arm_math.h
* @version v2.0.7
* @date 2022-08-16
* @brief Public header file for CMSIS DSP Library * @brief Public header file for CMSIS DSP Library
* @version V1.7.0
* @date 18. March 2019
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.

View File

@@ -1,8 +1,8 @@
/****************************************************************************** /******************************************************************************
* @file arm_vec_math.h * @file arm_vec_math.h
* @version v2.0.7
* @date 2022-08-16
* @brief Public header file for CMSIS DSP Library * @brief Public header file for CMSIS DSP Library
* @version V1.7.0
* @date 15. October 2019
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_acc.h * @file at32f413_acc.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 acc header file * @brief at32f413 acc header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_adc.h * @file at32f413_adc.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 adc header file * @brief at32f413 adc header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_bpr.h * @file at32f413_bpr.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 bpr header file * @brief at32f413 bpr header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_can.h * @file at32f413_can.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 can header file * @brief at32f413 can header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -936,7 +934,10 @@ typedef struct
*/ */
#define CAN1 ((can_type *) CAN1_BASE) #define CAN1 ((can_type *) CAN1_BASE)
#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
defined (AT32F413Kx)
#define CAN2 ((can_type *) CAN2_BASE) #define CAN2 ((can_type *) CAN2_BASE)
#endif
/** @defgroup CAN_exported_functions /** @defgroup CAN_exported_functions
* @{ * @{

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_crc.h * @file at32f413_crc.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 crc header file * @brief at32f413 crc header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_crm.h * @file at32f413_crm.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 crm header file * @brief at32f413 crm header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_debug.h * @file at32f413_debug.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 debug header file * @brief at32f413 debug header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_def.h * @file at32f413_def.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 macros header file * @brief at32f413 macros header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_dma.h * @file at32f413_dma.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 dma header file * @brief at32f413 dma header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_exint.h * @file at32f413_exint.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 exint header file * @brief at32f413 exint header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_flash.h * @file at32f413_flash.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 flash header file * @brief at32f413 flash header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_gpio.h * @file at32f413_gpio.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 gpio header file * @brief at32f413 gpio header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_i2c.h * @file at32f413_i2c.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 i2c header file * @brief at32f413 i2c header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_misc.h * @file at32f413_misc.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 misc header file * @brief at32f413 misc header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_pwc.h * @file at32f413_pwc.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 pwc header file * @brief at32f413 pwc header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_rtc.h * @file at32f413_rtc.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 rtc header file * @brief at32f413 rtc header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_sdio.h * @file at32f413_sdio.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 sdio header file * @brief at32f413 sdio header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -569,7 +567,10 @@ typedef struct
* @} * @}
*/ */
#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
defined (AT32F413Kx)
#define SDIO1 ((sdio_type *) SDIO1_BASE) #define SDIO1 ((sdio_type *) SDIO1_BASE)
#endif
/** @defgroup SDIO_exported_functions /** @defgroup SDIO_exported_functions
* @{ * @{

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_spi.h * @file at32f413_spi.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 spi header file * @brief at32f413 spi header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_tmr.h * @file at32f413_tmr.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 tmr header file * @brief at32f413 tmr header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -833,11 +831,16 @@ typedef struct
#define TMR2 ((tmr_type *) TMR2_BASE) #define TMR2 ((tmr_type *) TMR2_BASE)
#define TMR3 ((tmr_type *) TMR3_BASE) #define TMR3 ((tmr_type *) TMR3_BASE)
#define TMR4 ((tmr_type *) TMR4_BASE) #define TMR4 ((tmr_type *) TMR4_BASE)
#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
defined (AT32F413Kx)
#define TMR5 ((tmr_type *) TMR5_BASE) #define TMR5 ((tmr_type *) TMR5_BASE)
#if defined (AT32F413CCU7) || defined (AT32F413CCT7) || defined (AT32F413RCT7)
#define TMR8 ((tmr_type *) TMR8_BASE) #define TMR8 ((tmr_type *) TMR8_BASE)
#endif
#define TMR9 ((tmr_type *) TMR9_BASE) #define TMR9 ((tmr_type *) TMR9_BASE)
#define TMR10 ((tmr_type *) TMR10_BASE) #define TMR10 ((tmr_type *) TMR10_BASE)
#define TMR11 ((tmr_type *) TMR11_BASE) #define TMR11 ((tmr_type *) TMR11_BASE)
#endif
/** @defgroup TMR_exported_functions /** @defgroup TMR_exported_functions
* @{ * @{

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_usart.h * @file at32f413_usart.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 usart header file * @brief at32f413 usart header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -318,9 +316,13 @@ typedef struct
#define USART1 ((usart_type *) USART1_BASE) #define USART1 ((usart_type *) USART1_BASE)
#define USART2 ((usart_type *) USART2_BASE) #define USART2 ((usart_type *) USART2_BASE)
#if defined (AT32F413Rx) || defined (AT32F413Cx) || defined (AT32FEBKC8T7)
#define USART3 ((usart_type *) USART3_BASE) #define USART3 ((usart_type *) USART3_BASE)
#endif
#if defined (AT32F413Rx)
#define UART4 ((usart_type *) UART4_BASE) #define UART4 ((usart_type *) UART4_BASE)
#define UART5 ((usart_type *) UART5_BASE) #define UART5 ((usart_type *) UART5_BASE)
#endif
/** @defgroup USART_exported_functions /** @defgroup USART_exported_functions
* @{ * @{

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_usb.h * @file at32f413_usb.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 usb header file * @brief at32f413 usb header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_wdt.h * @file at32f413_wdt.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 wdt header file * @brief at32f413 wdt header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_wwdt.h * @file at32f413_wwdt.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f413 wwdt header file * @brief at32f413 wwdt header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_acc.c * @file at32f413_acc.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the acc firmware library * @brief contains all the functions for the acc firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_adc.c * @file at32f413_adc.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the adc firmware library * @brief contains all the functions for the adc firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_bpr.c * @file at32f413_bpr.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the bpr firmware library * @brief contains all the functions for the bpr firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_can.c * @file at32f413_can.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the can firmware library * @brief contains all the functions for the can firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -55,11 +53,14 @@ void can_reset(can_type* can_x)
crm_periph_reset(CRM_CAN1_PERIPH_RESET, TRUE); crm_periph_reset(CRM_CAN1_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_CAN1_PERIPH_RESET, FALSE); crm_periph_reset(CRM_CAN1_PERIPH_RESET, FALSE);
} }
#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
defined (AT32F413Kx)
else if(can_x == CAN2) else if(can_x == CAN2)
{ {
crm_periph_reset(CRM_CAN2_PERIPH_RESET, TRUE); crm_periph_reset(CRM_CAN2_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_CAN2_PERIPH_RESET, FALSE); crm_periph_reset(CRM_CAN2_PERIPH_RESET, FALSE);
} }
#endif
} }
/** /**

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_crc.c * @file at32f413_crc.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the crc firmware library * @brief contains all the functions for the crc firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_crm.c * @file at32f413_crm.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the crm firmware library * @brief contains all the functions for the crm firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -410,6 +408,7 @@ void crm_ahb_div_set(crm_ahb_div_type value)
/** /**
* @brief set crm apb1 division * @brief set crm apb1 division
* @note the maximum frequency of APB1/APB2 clock is 100 MHz
* @param value * @param value
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - CRM_APB1_DIV_1 * - CRM_APB1_DIV_1
@@ -426,6 +425,7 @@ void crm_apb1_div_set(crm_apb1_div_type value)
/** /**
* @brief set crm apb2 division * @brief set crm apb2 division
* @note the maximum frequency of APB1/APB2 clock is 100 MHz
* @param value * @param value
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - CRM_APB2_DIV_1 * - CRM_APB2_DIV_1
@@ -517,6 +517,7 @@ void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mu
if(clock_source == CRM_PLL_SOURCE_HICK) if(clock_source == CRM_PLL_SOURCE_HICK)
{ {
CRM->cfg_bit.pllrcs = FALSE; CRM->cfg_bit.pllrcs = FALSE;
CRM->misc1_bit.hickdiv = CRM_HICK48_NODIV;
} }
else else
{ {

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_debug.c * @file at32f413_debug.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the debug firmware library * @brief contains all the functions for the debug firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_dma.c * @file at32f413_dma.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the dma firmware library * @brief contains all the functions for the dma firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_exint.c * @file at32f413_exint.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the exint firmware library * @brief contains all the functions for the exint firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_flash.c * @file at32f413_flash.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the flash firmware library * @brief contains all the functions for the flash firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_gpio.c * @file at32f413_gpio.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the gpio firmware library * @brief contains all the functions for the gpio firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_i2c.c * @file at32f413_i2c.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the i2c firmware library * @brief contains all the functions for the i2c firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_misc.c * @file at32f413_misc.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the misc firmware library * @brief contains all the functions for the misc firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_pwc.c * @file at32f413_pwc.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the pwc firmware library * @brief contains all the functions for the pwc firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_rtc.c * @file at32f413_rtc.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the rtc firmware library * @brief contains all the functions for the rtc firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_sdio.c * @file at32f413_sdio.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the sdio firmware library * @brief contains all the functions for the sdio firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_spi.c * @file at32f413_spi.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the spi firmware library * @brief contains all the functions for the spi firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_tmr.c * @file at32f413_tmr.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the tmr firmware library * @brief contains all the functions for the tmr firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -71,16 +69,20 @@ void tmr_reset(tmr_type *tmr_x)
crm_periph_reset(CRM_TMR4_PERIPH_RESET, TRUE); crm_periph_reset(CRM_TMR4_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_TMR4_PERIPH_RESET, FALSE); crm_periph_reset(CRM_TMR4_PERIPH_RESET, FALSE);
} }
#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
defined (AT32F413Kx)
else if(tmr_x == TMR5) else if(tmr_x == TMR5)
{ {
crm_periph_reset(CRM_TMR5_PERIPH_RESET, TRUE); crm_periph_reset(CRM_TMR5_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_TMR5_PERIPH_RESET, FALSE); crm_periph_reset(CRM_TMR5_PERIPH_RESET, FALSE);
} }
#if defined (AT32F413CCU7) || defined (AT32F413CCT7) || defined (AT32F413RCT7)
else if(tmr_x == TMR8) else if(tmr_x == TMR8)
{ {
crm_periph_reset(CRM_TMR8_PERIPH_RESET, TRUE); crm_periph_reset(CRM_TMR8_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_TMR8_PERIPH_RESET, FALSE); crm_periph_reset(CRM_TMR8_PERIPH_RESET, FALSE);
} }
#endif
else if(tmr_x == TMR9) else if(tmr_x == TMR9)
{ {
crm_periph_reset(CRM_TMR9_PERIPH_RESET, TRUE); crm_periph_reset(CRM_TMR9_PERIPH_RESET, TRUE);
@@ -96,6 +98,7 @@ void tmr_reset(tmr_type *tmr_x)
crm_periph_reset(CRM_TMR11_PERIPH_RESET, TRUE); crm_periph_reset(CRM_TMR11_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_TMR11_PERIPH_RESET, FALSE); crm_periph_reset(CRM_TMR11_PERIPH_RESET, FALSE);
} }
#endif
} }
/** /**
@@ -750,7 +753,12 @@ void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state)
void tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state) void tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state)
{ {
/* tmr 32 bit function(plus mode) enable,only for TMR2/TMR5 */ /* tmr 32 bit function(plus mode) enable,only for TMR2/TMR5 */
if((tmr_x == TMR2) || (tmr_x == TMR5)) if((tmr_x == TMR2)
#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
defined (AT32F413Kx)
|| (tmr_x == TMR5)
#endif
)
{ {
tmr_x->ctrl1_bit.pmen = new_state; tmr_x->ctrl1_bit.pmen = new_state;
} }

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_usart.c * @file at32f413_usart.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the usart firmware library * @brief contains all the functions for the usart firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -61,11 +59,14 @@ void usart_reset(usart_type* usart_x)
crm_periph_reset(CRM_USART2_PERIPH_RESET, TRUE); crm_periph_reset(CRM_USART2_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_USART2_PERIPH_RESET, FALSE); crm_periph_reset(CRM_USART2_PERIPH_RESET, FALSE);
} }
#if defined (AT32F413Rx) || defined (AT32F413Cx) || defined (AT32FEBKC8T7)
else if(usart_x == USART3) else if(usart_x == USART3)
{ {
crm_periph_reset(CRM_USART3_PERIPH_RESET, TRUE); crm_periph_reset(CRM_USART3_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_USART3_PERIPH_RESET, FALSE); crm_periph_reset(CRM_USART3_PERIPH_RESET, FALSE);
} }
#endif
#if defined (AT32F413Rx)
else if(usart_x == UART4) else if(usart_x == UART4)
{ {
crm_periph_reset(CRM_UART4_PERIPH_RESET, TRUE); crm_periph_reset(CRM_UART4_PERIPH_RESET, TRUE);
@@ -76,6 +77,7 @@ void usart_reset(usart_type* usart_x)
crm_periph_reset(CRM_UART5_PERIPH_RESET, TRUE); crm_periph_reset(CRM_UART5_PERIPH_RESET, TRUE);
crm_periph_reset(CRM_UART5_PERIPH_RESET, FALSE); crm_periph_reset(CRM_UART5_PERIPH_RESET, FALSE);
} }
#endif
} }
/** /**

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_usb.c * @file at32f413_usb.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains the functions for the usb firmware library * @brief contains the functions for the usb firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_wdt.c * @file at32f413_wdt.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the wdt firmware library * @brief contains all the functions for the wdt firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file at32f413_wwdt.c * @file at32f413_wwdt.c
* @version v2.0.7
* @date 2022-08-16
* @brief contains all the functions for the wwdt firmware library * @brief contains all the functions for the wwdt firmware library
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file i2c_application.c * @file i2c_application.c
* @version v2.0.7
* @date 2022-08-16
* @brief the driver library of the i2c peripheral * @brief the driver library of the i2c peripheral
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -891,15 +889,6 @@ i2c_status_type i2c_slave_receive_int(i2c_handle_type* hi2c, uint8_t* pdata, uin
/* enable ack */ /* enable ack */
i2c_ack_enable(hi2c->i2cx, TRUE); i2c_ack_enable(hi2c->i2cx, TRUE);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
return I2C_ERR_STEP_2;
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* enable interrupt */ /* enable interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE); i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
@@ -1017,30 +1006,6 @@ i2c_status_type i2c_slave_transmit_int(i2c_handle_type* hi2c, uint8_t* pdata, ui
/* enable ack */ /* enable ack */
i2c_ack_enable(hi2c->i2cx, TRUE); i2c_ack_enable(hi2c->i2cx, TRUE);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
return I2C_ERR_STEP_2;
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_10BIT)
{
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_3;
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* enable interrupt */ /* enable interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE); i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
@@ -1139,20 +1104,11 @@ i2c_status_type i2c_slave_receive_dma(i2c_handle_type* hi2c, uint8_t* pdata, uin
/* configure the dma channel */ /* configure the dma channel */
i2c_dma_config(hi2c, hi2c->dma_rx_channel, pdata, size); i2c_dma_config(hi2c, hi2c->dma_rx_channel, pdata, size);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_2;
}
/* enable dma request */ /* enable dma request */
i2c_dma_enable(hi2c->i2cx, TRUE); i2c_dma_enable(hi2c->i2cx, TRUE);
/* clear addr flag */ /* enable address interrupt */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG); i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
return I2C_OK; return I2C_OK;
} }
@@ -1272,37 +1228,12 @@ i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, ui
/* configure the dma channel */ /* configure the dma channel */
i2c_dma_config(hi2c, hi2c->dma_tx_channel, pdata, size); i2c_dma_config(hi2c, hi2c->dma_tx_channel, pdata, size);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_2;
}
if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_10BIT)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_3;
}
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* enable dma request */ /* enable dma request */
i2c_dma_enable(hi2c->i2cx, TRUE); i2c_dma_enable(hi2c->i2cx, TRUE);
/* enable address interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
return I2C_OK; return I2C_OK;
} }
@@ -1311,8 +1242,8 @@ i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, ui
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param timeout: maximum waiting time. * @param timeout: maximum waiting time.
@@ -1321,7 +1252,7 @@ i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, ui
i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout) i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout)
{ {
i2c_status_type err_code; i2c_status_type err_code;
if(mem_address_width == I2C_MEM_ADDR_WIDIH_8) if(mem_address_width == I2C_MEM_ADDR_WIDIH_8)
{ {
/* send memory address */ /* send memory address */
@@ -1330,11 +1261,11 @@ i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_w
else else
{ {
/* send memory address */ /* send memory address */
i2c_data_send(hi2c->i2cx, (mem_address >> 8) & 0xFF); i2c_data_send(hi2c->i2cx, (mem_address >> 8) & 0xFF);
/* wait for the tdbe flag to be set */ /* wait for the tdbe flag to be set */
err_code = i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout); err_code = i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout);
if(err_code != I2C_OK) if(err_code != I2C_OK)
{ {
/* generate stop condtion */ /* generate stop condtion */
@@ -1342,21 +1273,21 @@ i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_w
return err_code; return err_code;
} }
/* send memory address */ /* send memory address */
i2c_data_send(hi2c->i2cx, mem_address & 0xFF); i2c_data_send(hi2c->i2cx, mem_address & 0xFF);
} }
return I2C_OK; return I2C_OK;
} }
/** /**
* @brief write data to the memory device through polling mode. * @brief write data to the memory device through polling mode.
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param pdata: data buffer. * @param pdata: data buffer.
@@ -1401,7 +1332,7 @@ i2c_status_type i2c_memory_write(i2c_handle_type* hi2c, i2c_mem_address_width_ty
return I2C_ERR_STEP_3; return I2C_ERR_STEP_3;
} }
/* send memory address */ /* send memory address */
if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK) if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
{ {
@@ -1444,8 +1375,8 @@ i2c_status_type i2c_memory_write(i2c_handle_type* hi2c, i2c_mem_address_width_ty
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param pdata: data buffer. * @param pdata: data buffer.
@@ -1657,8 +1588,8 @@ i2c_status_type i2c_memory_read(i2c_handle_type* hi2c, i2c_mem_address_width_typ
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param pdata: data buffer. * @param pdata: data buffer.
@@ -1734,8 +1665,8 @@ i2c_status_type i2c_memory_write_int(i2c_handle_type* hi2c, i2c_mem_address_widt
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param pdata: data buffer. * @param pdata: data buffer.
@@ -1851,8 +1782,8 @@ i2c_status_type i2c_memory_read_int(i2c_handle_type* hi2c, i2c_mem_address_width
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param pdata: data buffer. * @param pdata: data buffer.
@@ -1934,8 +1865,8 @@ i2c_status_type i2c_memory_write_dma(i2c_handle_type* hi2c, i2c_mem_address_widt
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width. * @param mem_address_width: memory address width.
* this parameter can be one of the following values: * this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit * - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit * - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address. * @param address: memory device address.
* @param mem_address: memory address. * @param mem_address: memory address.
* @param pdata: data buffer. * @param pdata: data buffer.
@@ -2157,8 +2088,15 @@ void i2c_master_rx_isr_int(i2c_handle_type* hi2c)
*/ */
void i2c_slave_tx_isr_int(i2c_handle_type* hi2c) void i2c_slave_tx_isr_int(i2c_handle_type* hi2c)
{ {
/* transfer data */ /* step 1: receive slave address */
if(i2c_flag_get(hi2c->i2cx, I2C_TDBE_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* step 2: transfer data */
else if(i2c_flag_get(hi2c->i2cx, I2C_TDBE_FLAG) != RESET)
{ {
if(hi2c->pcount) if(hi2c->pcount)
{ {
@@ -2191,8 +2129,15 @@ void i2c_slave_tx_isr_int(i2c_handle_type* hi2c)
*/ */
void i2c_slave_rx_isr_int(i2c_handle_type* hi2c) void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
{ {
/* receive data */ /* step 1: receive slave address */
if(i2c_flag_get(hi2c->i2cx, I2C_RDBF_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* step 2: receive data */
else if(i2c_flag_get(hi2c->i2cx, I2C_RDBF_FLAG) != RESET)
{ {
if(hi2c->pcount) if(hi2c->pcount)
{ {
@@ -2203,7 +2148,7 @@ void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
} }
} }
/* step 2: received stop conditon */ /* step 3: stop conditon is received, transfer ends */
else if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET) else if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
{ {
/* clear stop flag */ /* clear stop flag */
@@ -2217,6 +2162,58 @@ void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
} }
} }
/**
* @brief master interrupt processing function in dma mode.
* @param hi2c: the handle points to the operation information.
* @retval none.
*/
void i2c_master_tx_isr_dma(i2c_handle_type* hi2c)
{
/* tdc interrupt */
if(i2c_flag_get(hi2c->i2cx, I2C_TDC_FLAG) != RESET)
{
/* generate stop condtion */
i2c_stop_generate(hi2c->i2cx);
/* disable evt interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
}
}
/**
* @brief slave interrupt processing function in dma mode.
* @param hi2c: the handle points to the operation information.
* @retval none.
*/
void i2c_slave_tx_rx_isr_dma(i2c_handle_type* hi2c)
{
/* receive slave address */
if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* wait for the stop flag to be set, trasnfer end */
if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
{
/* clear stop flag */
i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
/* disable evt interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
/* disable ack */
i2c_ack_enable(hi2c->i2cx, TRUE);
/* transfer complete */
hi2c->status = I2C_END;
}
}
/** /**
* @brief interrupt procession function. * @brief interrupt procession function.
* @param hi2c: the handle points to the operation information. * @param hi2c: the handle points to the operation information.
@@ -2238,6 +2235,13 @@ void i2c_evt_irq_handler(i2c_handle_type* hi2c)
case I2C_INT_SLA_RX: case I2C_INT_SLA_RX:
i2c_slave_rx_isr_int(hi2c); i2c_slave_rx_isr_int(hi2c);
break; break;
case I2C_DMA_MA_TX:
i2c_master_tx_isr_dma(hi2c);
break;
case I2C_DMA_SLA_TX:
case I2C_DMA_SLA_RX:
i2c_slave_tx_rx_isr_dma(hi2c);
break;
default: default:
break; break;
} }
@@ -2259,36 +2263,24 @@ void i2c_dma_tx_irq_handler(i2c_handle_type* hi2c)
/* clear the transfer complete flag */ /* clear the transfer complete flag */
dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_tx_channel)); dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_tx_channel));
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
hi2c->pcount = 0;
switch(hi2c->mode) switch(hi2c->mode)
{ {
case I2C_DMA_MA_TX: case I2C_DMA_MA_TX:
/* wait for the tdc flag to be set */ /* enable tdc interrupt, generate stop condition in tdc interrupt */
hi2c->status = i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout); i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
/* generate stop condtion */
i2c_stop_generate(hi2c->i2cx);
break; break;
case I2C_DMA_SLA_TX: case I2C_DMA_SLA_TX:
/* wait for the ackfail flag to be set */ /* enable ackfail interrupt, generate stop condition in ackfail interrupt */
hi2c->status = i2c_wait_flag(hi2c, I2C_ACKFAIL_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout); i2c_interrupt_enable(hi2c->i2cx, I2C_ERR_INT, TRUE);
/* clear ackfail flag */
i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
break; break;
default: default:
break; break;
} }
hi2c->pcount = 0;
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
} }
} }
@@ -2308,6 +2300,11 @@ void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
/* clear the transfer complete flag */ /* clear the transfer complete flag */
dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_rx_channel)); dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_rx_channel));
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
hi2c->pcount = 0;
switch(hi2c->mode) switch(hi2c->mode)
{ {
case I2C_DMA_MA_RX: case I2C_DMA_MA_RX:
@@ -2319,25 +2316,17 @@ void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
/* generate stop condtion */ /* generate stop condtion */
i2c_stop_generate(hi2c->i2cx); i2c_stop_generate(hi2c->i2cx);
} }
/* transfer complete */
hi2c->status = I2C_END;
break; break;
case I2C_DMA_SLA_RX: case I2C_DMA_SLA_RX:
/* wait for the stop flag to be set */ /* enable stop interrupt, wait for the stop flag to be set */
hi2c->status = i2c_wait_flag(hi2c, I2C_STOPF_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout); i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
/* clear stop flag */
i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
break; break;
default: default:
break; break;
} }
hi2c->pcount = 0;
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
} }
} }
@@ -2348,48 +2337,75 @@ void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
*/ */
void i2c_err_irq_handler(i2c_handle_type* hi2c) void i2c_err_irq_handler(i2c_handle_type* hi2c)
{ {
hi2c->error_code = I2C_ERR_INTERRUPT;
/* buserr */ /* buserr */
if(i2c_flag_get(hi2c->i2cx, I2C_BUSERR_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_BUSERR_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_BUSERR_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_BUSERR_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
} }
/* arlost */ /* arlost */
if(i2c_flag_get(hi2c->i2cx, I2C_ARLOST_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_ARLOST_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_ARLOST_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_ARLOST_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
} }
/* ackfail */ /* ackfail */
if(i2c_flag_get(hi2c->i2cx, I2C_ACKFAIL_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_ACKFAIL_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
switch(hi2c->mode)
{
case I2C_DMA_SLA_TX:
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
/* disable evt interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
break;
default:
hi2c->error_code = I2C_ERR_INTERRUPT;
break;
}
} }
/* ouf */ /* ouf */
if(i2c_flag_get(hi2c->i2cx, I2C_OUF_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_OUF_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_OUF_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_OUF_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
} }
/* pecerr */ /* pecerr */
if(i2c_flag_get(hi2c->i2cx, I2C_PECERR_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_PECERR_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_PECERR_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_PECERR_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
} }
/* tmout */ /* tmout */
if(i2c_flag_get(hi2c->i2cx, I2C_TMOUT_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_TMOUT_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_TMOUT_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_TMOUT_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
} }
/* alertf */ /* alertf */
if(i2c_flag_get(hi2c->i2cx, I2C_ALERTF_FLAG) != RESET) if(i2c_flag_get(hi2c->i2cx, I2C_ALERTF_FLAG) != RESET)
{ {
i2c_flag_clear(hi2c->i2cx, I2C_ALERTF_FLAG); i2c_flag_clear(hi2c->i2cx, I2C_ALERTF_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
} }
/* disable all interrupts */ /* disable all interrupts */

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file i2c_application.h * @file i2c_application.h
* @version v2.0.7
* @date 2022-08-16
* @brief i2c application libray header file * @brief i2c application libray header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_class.c * @file audio_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class type * @brief usb audio class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_class.h * @file audio_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class file * @brief usb audio class file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_conf.h * @file audio_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio config * @brief usb audio config
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_desc.c * @file audio_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio device descriptor * @brief usb audio device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -170,9 +168,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUDIO_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/ AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */ AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */ AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */ 0x02, /* bControlSize: 2 byte */
0x01, /* bmaControls0: mute */ 0x03, /* bmaControls0: mute & volume*/
0x02, /* bmaControls1: volume */ 0x00,
0x00, /* bmaControls1 */
0x00,
0x00, /* bmaControls2 */
0x00,
0x00, /* iFeature: unused */ 0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */ AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
@@ -211,9 +213,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUDIO_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/ AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */ AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */ AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */ 0x02, /* bControlSize: 2 byte */
0x01, /* bmaControls0: mute*/ 0x03, /* bmaControls0: mute & volume*/
0x02, /* bmaControls1: volume */ 0x00,
0x00, /* bmaControls1: 0x0000 */
0x00,
0x00, /* bmaControls2: 0x0000 */
0x00,
0x00, /* iFeature: unused */ 0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */ AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_desc.h * @file audio_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio descriptor header file * @brief usb audio descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -151,7 +149,7 @@ extern "C" {
* @brief audio interface config * @brief audio interface config
*/ */
#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC) #define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x1E) #define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define AUDIO_MIC_INTERFACE 0x01 #define AUDIO_MIC_INTERFACE 0x01
#define AUDIO_SPK_INTERFACE 0x02 #define AUDIO_SPK_INTERFACE 0x02
@@ -160,7 +158,7 @@ extern "C" {
*/ */
#define AUDIO_INPUT_TERMINAL_SIZE 0x0C #define AUDIO_INPUT_TERMINAL_SIZE 0x0C
#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09 #define AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define AUDIO_FEATURE_UNIT_SIZE 0x09 #define AUDIO_FEATURE_UNIT_SIZE 0x0D
/** /**
* @brief audio terminal id define * @brief audio terminal id define

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_conf.h * @file audio_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio config * @brief usb audio config
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_class.c * @file audio_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class type * @brief usb audio class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_class.h * @file audio_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class file * @brief usb audio class file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -137,10 +135,10 @@ typedef struct
uint32_t hid_protocol; uint32_t hid_protocol;
uint32_t hid_set_idle; uint32_t hid_set_idle;
uint32_t alt_setting; uint32_t alt_setting;
uint8_t hid_state;
uint8_t hid_set_report[64]; uint8_t hid_set_report[64];
uint8_t g_rxhid_buff[USBD_AUHID_OUT_MAXPACKET_SIZE]; uint8_t g_rxhid_buff[USBD_AUHID_OUT_MAXPACKET_SIZE];
uint8_t g_txhid_buff[USBD_AUHID_IN_MAXPACKET_SIZE]; uint8_t g_txhid_buff[USBD_AUHID_IN_MAXPACKET_SIZE];
uint8_t hid_state;
}usb_audio_hid_type; }usb_audio_hid_type;
extern usbd_class_handler audio_hid_class_handler; extern usbd_class_handler audio_hid_class_handler;

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_desc.c * @file audio_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio device descriptor * @brief usb audio device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -155,7 +153,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_MIC_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/ AUDIO_MIC_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
LBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE), LBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),
HBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),/* wTerminalType: terminal is microphone */ HBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),/* wTerminalType: terminal is microphone */
AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bAssocTerminal: no association */ 0x00, /* bAssocTerminal: no association */
AUDIO_MIC_CHR, /* bNrChannels: two channel */ AUDIO_MIC_CHR, /* bNrChannels: two channel */
#if (AUDIO_MIC_CHR == 2) #if (AUDIO_MIC_CHR == 2)
0x03, /* wChannelConfig: left front and right front */ 0x03, /* wChannelConfig: left front and right front */
@@ -172,9 +170,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/ AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */ AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */ AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */ 0x02, /* bControlSize: 2 byte */
0x01, /* bmaControls0: mute */ 0x03, /* bmaControls0: mute & volume*/
0x02, /* bmaControls1: volume */ 0x00,
0x00, /* bmaControls1 */
0x00,
0x00, /* bmaControls2 */
0x00,
0x00, /* iFeature: unused */ 0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */ AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
@@ -183,7 +185,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/ AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
LBYTE(AUDIO_TERMINAL_TYPE_STREAMING), LBYTE(AUDIO_TERMINAL_TYPE_STREAMING),
HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */ HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
AUDIO_MIC_INPUT_TERMINAL_ID, /* bAssocTerminal: unused */ 0x00, /* bAssocTerminal: unused */
AUDIO_MIC_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */ AUDIO_MIC_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
0x00, /* iTerminal: unused */ 0x00, /* iTerminal: unused */
#endif #endif
@@ -196,7 +198,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/ AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
LBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */ LBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */ HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bAssocTerminal: no association */ 0x00, /* bAssocTerminal: no association */
AUDIO_SPK_CHR, /* bNrChannels: two channel */ AUDIO_SPK_CHR, /* bNrChannels: two channel */
#if (AUDIO_SPK_CHR == 2) #if (AUDIO_SPK_CHR == 2)
0x03, /* wChannelConfig: left front and right front */ 0x03, /* wChannelConfig: left front and right front */
@@ -213,9 +215,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/ AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */ AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */ AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */ 0x02, /* bControlSize: 2 byte */
0x01, /* bmaControls0: mute*/ 0x03, /* bmaControls0: mute & volume*/
0x02, /* bmaControls1: volume */ 0x00,
0x00, /* bmaControls1: 0x0000 */
0x00,
0x00, /* bmaControls2: 0x0000 */
0x00,
0x00, /* iFeature: unused */ 0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */ AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
@@ -224,7 +230,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/ AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
LBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */ LBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
HBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */ HBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
AUDIO_SPK_INPUT_TERMINAL_ID, /* bAssocTerminal: unused */ 0x00, /* bAssocTerminal: unused */
AUDIO_SPK_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */ AUDIO_SPK_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
0x00, /* iTerminal: unused */ 0x00, /* iTerminal: unused */
#endif #endif

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file audio_desc.h * @file audio_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio descriptor header file * @brief usb audio descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -150,7 +148,7 @@ extern "C" {
* @brief audio interface config * @brief audio interface config
*/ */
#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC) #define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x1E) #define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define AUDIO_MIC_INTERFACE 0x01 #define AUDIO_MIC_INTERFACE 0x01
#define AUDIO_SPK_INTERFACE 0x02 #define AUDIO_SPK_INTERFACE 0x02
@@ -159,7 +157,7 @@ extern "C" {
*/ */
#define AUDIO_INPUT_TERMINAL_SIZE 0x0C #define AUDIO_INPUT_TERMINAL_SIZE 0x0C
#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09 #define AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define AUDIO_FEATURE_UNIT_SIZE 0x09 #define AUDIO_FEATURE_UNIT_SIZE 0x0D
/** /**
* @brief audio terminal id define * @brief audio terminal id define

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_class.c * @file cdc_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class type * @brief usb cdc class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_class.h * @file cdc_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class file * @brief usb cdc class file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_desc.c * @file cdc_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc device descriptor * @brief usb cdc device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_desc.h * @file cdc_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc descriptor header file * @brief usb cdc descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_keyboard_class.c * @file cdc_keyboard_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard class type * @brief usb cdc and keyboard class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_keyboard_class.h * @file cdc_keyboard_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard class file * @brief usb cdc and keyboard class file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_keyboard_desc.c * @file cdc_keyboard_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard device descriptor * @brief usb cdc and keyboard device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_keyboard_desc.h * @file cdc_keyboard_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard descriptor header file * @brief usb cdc and keyboard descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_msc_class.c * @file cdc_msc_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class type * @brief usb cdc class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_msc_class.h * @file cdc_msc_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class file * @brief usb cdc class file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_msc_desc.c * @file cdc_msc_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc device descriptor * @brief usb cdc device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -202,8 +200,8 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_CDC_MSC_CONFIG_DESC_SIZE]
0x05, /* bFunctionLength: size of this descriptor in bytes */ 0x05, /* bFunctionLength: size of this descriptor in bytes */
USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */ USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
USBD_CDC_SUBTYPE_UFD, /* bDescriptorSubtype: Union Function Descriptor subtype 0x06 */ USBD_CDC_SUBTYPE_UFD, /* bDescriptorSubtype: Union Function Descriptor subtype 0x06 */
0x00, /* bControlInterface: The interface number of the communications or data class interface 0x00 */ 0x01, /* bControlInterface: The interface number of the communications or data class interface 0x00 */
0x01, /* bSubordinateInterface0: interface number of first subordinate interface in the union */ 0x02, /* bSubordinateInterface0: interface number of first subordinate interface in the union */
USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */ USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */ USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file cdc_msc_desc.h * @file cdc_msc_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc descriptor header file * @brief usb cdc descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file msc_bot_scsi.c * @file msc_bot_scsi.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb mass storage bulk-only transport and scsi command * @brief usb mass storage bulk-only transport and scsi command
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file custom_hid_class.c * @file custom_hid_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb custom hid class type * @brief usb custom hid class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file custom_hid_class.h * @file custom_hid_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb custom hid header file * @brief usb custom hid header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer
@@ -75,9 +73,10 @@ typedef struct
uint32_t hid_protocol; uint32_t hid_protocol;
uint32_t hid_set_idle; uint32_t hid_set_idle;
uint32_t alt_setting; uint32_t alt_setting;
uint8_t hid_state;
uint8_t hid_set_report[64]; uint8_t hid_set_report[64];
uint8_t hid_get_report[64]; uint8_t hid_get_report[64];
uint8_t hid_state;
}custom_hid_type; }custom_hid_type;
/** /**

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file custom_hid_desc.c * @file custom_hid_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid device descriptor * @brief usb hid device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file custom_hid_desc.h * @file custom_hid_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb custom hid descriptor header file * @brief usb custom hid descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file hid_iap_class.c * @file hid_iap_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid iap class type * @brief usb hid iap class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file hid_iap_class.h * @file hid_iap_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid iap header file * @brief usb hid iap header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file hid_iap_desc.c * @file hid_iap_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid device descriptor * @brief usb hid device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file hid_iap_desc.h * @file hid_iap_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid descriptor header file * @brief usb hid descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file keyboard_class.c * @file keyboard_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid keyboard class type * @brief usb hid keyboard class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file keyboard_class.h * @file keyboard_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid keyboard header file * @brief usb hid keyboard header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file keyboard_desc.c * @file keyboard_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid keyboard device descriptor * @brief usb hid keyboard device descriptor
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file keyboard_desc.h * @file keyboard_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb keyboard descriptor header file * @brief usb keyboard descriptor header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file mouse_class.c * @file mouse_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid mouse class type * @brief usb hid mouse class type
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/** /**
************************************************************************** **************************************************************************
* @file mouse_class.h * @file mouse_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid mouse header file * @brief usb hid mouse header file
************************************************************************** **************************************************************************
* Copyright notice & Disclaimer * Copyright notice & Disclaimer

Some files were not shown because too many files have changed in this diff Show More