1 /*********************************************************************************************************//**
2  * @file    ht32f5xxxx_bftm.h
3  * @version $Rev:: 6393         $
4  * @date    $Date:: 2022-10-27 #$
5  * @brief   The header file of the BFTM library.
6  *************************************************************************************************************
7  * @attention
8  *
9  * Firmware Disclaimer Information
10  *
11  * 1. The customer hereby acknowledges and agrees that the program technical documentation, including the
12  *    code, which is supplied by Holtek Semiconductor Inc., (hereinafter referred to as "HOLTEK") is the
13  *    proprietary and confidential intellectual property of HOLTEK, and is protected by copyright law and
14  *    other intellectual property laws.
15  *
16  * 2. The customer hereby acknowledges and agrees that the program technical documentation, including the
17  *    code, is confidential information belonging to HOLTEK, and must not be disclosed to any third parties
18  *    other than HOLTEK and the customer.
19  *
20  * 3. The program technical documentation, including the code, is provided "as is" and for customer reference
21  *    only. After delivery by HOLTEK, the customer shall use the program technical documentation, including
22  *    the code, at their own risk. HOLTEK disclaims any expressed, implied or statutory warranties, including
23  *    the warranties of merchantability, satisfactory quality and fitness for a particular purpose.
24  *
25  * <h2><center>Copyright (C) Holtek Semiconductor Inc. All rights reserved</center></h2>
26  ************************************************************************************************************/
27 
28 /* Define to prevent recursive inclusion -------------------------------------------------------------------*/
29 #ifndef __HT32F5XXXX_BFTM_H
30 #define __HT32F5XXXX_BFTM_H
31 
32 #ifdef __cplusplus
33  extern "C" {
34 #endif
35 
36 /* Includes ------------------------------------------------------------------------------------------------*/
37 #include "ht32.h"
38 
39 /** @addtogroup HT32F5xxxx_Peripheral_Driver HT32F5xxxx Peripheral Driver
40   * @{
41   */
42 
43 /** @addtogroup BFTM
44   * @{
45   */
46 
47 /* Exported types ------------------------------------------------------------------------------------------*/
48 /** @defgroup BFTM_Exported_Types BFTM exported types
49   * @{
50   */
51 #if (LIBCFG_BFTM_16BIT_COUNTER)
52 typedef u16 BFTM_DataTypeDef;
53 #else
54 typedef u32 BFTM_DataTypeDef;
55 #endif
56 /**
57   * @}
58   */
59 
60 /* Exported constants --------------------------------------------------------------------------------------*/
61 /** @defgroup BFTM_Exported_Constants BFTM exported constants
62   * @{
63   */
64 #define IS_BFTM(x)                (IS_BFTM0(x) || IS_BFTM1(x))
65 
66 #define IS_BFTM0(x)               (x == HT_BFTM0)
67 
68 #if (LIBCFG_BFTM1)
69 #define IS_BFTM1(x)               (x == HT_BFTM1)
70 #else
71 #define IS_BFTM1(x)               (0)
72 #endif
73 
74 #define BFTM_FLAG_MATCH           (1UL << 0)
75 #define BFTM_INT_MATCH            (1UL << 0)
76 /**
77   * @}
78   */
79 
80 /* Exported functions --------------------------------------------------------------------------------------*/
81 /** @defgroup BFTM_Exported_Functions BFTM exported functions
82   * @{
83   */
84 void BFTM_DeInit(HT_BFTM_TypeDef* HT_BFTMn);
85 void BFTM_EnaCmd(HT_BFTM_TypeDef* HT_BFTMn, ControlStatus NewState);
86 void BFTM_SetCompare(HT_BFTM_TypeDef* HT_BFTMn, BFTM_DataTypeDef uCompare);
87 u32 BFTM_GetCompare(HT_BFTM_TypeDef* HT_BFTMn);
88 void BFTM_SetCounter(HT_BFTM_TypeDef* HT_BFTMn, BFTM_DataTypeDef uCounter);
89 u32 BFTM_GetCounter(HT_BFTM_TypeDef* HT_BFTMn);
90 void BFTM_OneShotModeCmd(HT_BFTM_TypeDef* HT_BFTMn, ControlStatus NewState);
91 void BFTM_IntConfig(HT_BFTM_TypeDef* HT_BFTMn, ControlStatus NewState);
92 FlagStatus BFTM_GetFlagStatus(HT_BFTM_TypeDef* HT_BFTMn);
93 void BFTM_ClearFlag(HT_BFTM_TypeDef* HT_BFTMn);
94 /**
95   * @}
96   */
97 
98 
99 /**
100   * @}
101   */
102 
103 /**
104   * @}
105   */
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif
112