tao_z
2022-05-25 1044ba0d2286698d0da28112bffc0f114bef2134
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/**
  ******************************************************************************
  * @file     xl_acmp.h
  * @author   software group
  * @brief    This file contains all the functions prototypes for the ACMP
  *           firmware library.
  ******************************************************************************
  * @attention
    *
  * 2019 by Chipways Communications,Inc. All Rights Reserved.
  * This software is supplied under the terms of a license
  * agreement or non-disclosure agreement with Chipways.
  * Passing on and copying of this document,and communication
  * of its contents is not permitted without prior written
  * authorization.
  *
  * <h2><center>&copy; COPYRIGHT 2019 Chipways</center></h2>
  ******************************************************************************
  */
/* Define to prevent recursive inclusion -------------------------------------*/    
#ifndef __XL_ACMP_H__
#define __XL_ACMP_H__
 
#ifdef __cplusplus
extern "C" {
#endif
    
/* Includes ---------------------------------------------------------------*/
#include "XL6600.h"
    
/* Register define ------------------------------------------------------------*/
 
/* CS Bit Fields */
#define ACMP_CS_ACMOD_MASK                       0x3u
#define ACMP_CS_ACMOD_SHIFT                      0
#define ACMP_CS_ACOPE_MASK                       0x4u
#define ACMP_CS_ACOPE_SHIFT                      2
#define ACMP_CS_ACO_MASK                         0x8u
#define ACMP_CS_ACO_SHIFT                        3
#define ACMP_CS_ACIE_MASK                        0x10u
#define ACMP_CS_ACIE_SHIFT                       4
#define ACMP_CS_ACF_MASK                         0x20u
#define ACMP_CS_ACF_SHIFT                        5
#define ACMP_CS_HYST_MASK                        0x40u
#define ACMP_CS_HYST_SHIFT                       6
#define ACMP_CS_ACE_MASK                         0x80u
#define ACMP_CS_ACE_SHIFT                        7
/* C0 Bit Fields */
#define ACMP_C0_ACNSEL_MASK                      0x3u
#define ACMP_C0_ACNSEL_SHIFT                     0
#define ACMP_C0_ACPSEL_MASK                      0x30u
#define ACMP_C0_ACPSEL_SHIFT                     4
/* C1 Bit Fields */
#define ACMP_C1_DACVAL_MASK                      0x3Fu
#define ACMP_C1_DACVAL_SHIFT                     0
#define ACMP_C1_DACREF_MASK                      0x40u
#define ACMP_C1_DACREF_SHIFT                     6
#define ACMP_C1_DACEN_MASK                       0x80u
#define ACMP_C1_DACEN_SHIFT                      7
/* C2 Bit Fields */
#define ACMP_C2_ACIPE_MASK                       0x7u
#define ACMP_C2_ACIPE_SHIFT                      0
 
/** ACMP - Register Layout Typedef */
typedef struct {
  __IO uint8_t CS;                                 /*!< ACMP¿ØÖƺÍ״̬¼Ä´æÆ÷, offset: 0x0 */
  __IO uint8_t C0;                                 /*!< ACMP¿ØÖƼĴæÆ÷0, offset: 0x1 */
  __IO uint8_t C1;                                 /*!< ACMP¿ØÖƼĴæÆ÷1, offset: 0x2 */
  __IO uint8_t C2;                                 /*!< ACMP¿ØÖƼĴæÆ÷2, offset: 0x3 */
} ACMP_Type;
extern  ACMP_Type* ACMP0;
extern  ACMP_Type* ACMP1;
 
 
/** @addtogroup XL6600_StdPeriph_Driver
  * @{
  */
 
/** @addtogroup ACMP 
  * @{
  */
 
/* Exported types ------------------------------------------------------------*/ 
 
/**
 * @brief ACMP ³õʼ»¯½á¹¹Ì嶨Òå
 */
typedef struct
{
    FunctionalState ACMP_DACEN;                /*!< Ê¹ÄÜÄÚ²¿6λDAC */
    uint8_t ACMP_DACRefVoltage;                /*!< ÎªDACÑ¡Ôñ²Î¿¼µçѹ */
    uint8_t ACMP_DACValue;                     /*!< ÎªÄÚ²¿DACÉèÖµ */
 
    uint8_t ACMP_HystMode;                     /*!< Ä£Äâ±È½ÏÆ÷³ÙÖÍÑ¡Ôñ */  
    uint8_t ACMP_IntTrigMode;                  /*!< Ê¹ÄÜÖжϴ¥·¢ */
 
    uint8_t ACMP_InputP;                       /*!< ÉèÖÃÉÏÉýÑØÊäÈëµ½±È½ÏÆ÷ */
    uint8_t ACMP_InputN;                       /*!< ÉèÖÃϽµÑØÊäÈëµ½±È½ÏÆ÷ */
 
    uint8_t ACMP_InputPin;                     /*!< ACMPÊäÈëÒý½ÅʹÄÜ */
    
}ACMP_InitTypeDef;
 
/* Exported constants --------------------------------------------------------*/
/** @defgroup ACMP_Exported_Constants ACMPÄ£¿éʹÓòÎÊý¶¨Òå
  * @{
  */
 
/**
    * @defgroup ACMP_Hyst   ACMPÄ£Äâ±È½ÏÆ÷³ÙÖÍÑ¡Ôñ
    * @{
    */
#define ACMP_Hyst_20mv                0                  /*!< ACMP³ÙÖÍ20mv */
#define ACMP_Hyst_30mv                  1                  /*!< ACMP³ÙÖÍ30mv */
/**
  * @}
  */
 
/**
    * @defgroup ACMP_InterruptEdge_Seclect ACMPÖжϴ¥·¢·½Ê½
    * @{
    */
#define ACMP_Int_FallEdge             0                  /*!< ACMPÖжÏÔÚÊä³öϽµÑØ·¢Éú */
#define    ACMP_Int_RiseEdge             1                  /*!< ACMPÖжÏÔÚÊä³öÉÏÉýÑØ·¢Éú */
#define ACMP_Int_FallEdge_1           2                  /*!< ACMPÖжÏÔÚÊä³öϽµÑØ·¢Éú */
#define ACMP_Int_FallorRiseEdge       3                  /*!< ACMPÖжÏÔÚÊä³öϽµÑØ»òÉÏÉýÑØ·¢Éú */
/**
  * @}
  */
 
/**
    * @defgroup ACMP_PositiveChannel_Seclect  ACMPÕý¼«ÊäÈëÑ¡Ôñ
    * @{
    */
#define ACMP_Positive_EXT0            0                 /*!< ÕýÊäÈëÍⲿ»ù×¼0 */
#define    ACMP_Positive_EXT1            1                 /*!< ÕýÊäÈëÍⲿ»ù×¼1 */
#define    ACMP_Positive_EXT2            2                 /*!< ÕýÊäÈëÍⲿ»ù×¼2 */
#define    ACMP_Positive_DAC             3                 /*!< ÕýÊäÈëDACÊä³ö */
/**
  * @}
  */
 
/**
    * @defgroup ACMP_NegativeChannel_Seclect  ACMP¸º¼«ÊäÈëÑ¡Ôñ
    * @{
    */
#define    ACMP_Negative_EXT0            0                /*!< ¸ºÊäÈëÍⲿ»ù×¼0 */
#define    ACMP_Negative_EXT1            1                /*!< ¸ºÊäÈëÍⲿ»ù×¼1 */
#define    ACMP_Negative_EXT2            2                /*!< ¸ºÊäÈëÍⲿ»ù×¼2 */
#define    ACMP_Negative_DAC             3                /*!< ¸ºÊäÈëDACÊä³ö */
/**
  * @}
  */
 
/**
    * @defgroup ACMP_DAC_Reference_Seclect ACMPµÄDAC²Î¿¼µçѹѡÔñ
    * @{
    */
#define  ACMP_DACRef_BANDGAP          0               /*!< DACÑ¡Ôñ´øÏ¶»ù×¼×÷Ϊ»ù×¼ */
#define  ACMP_DACRef_VDDA             1               /*!< DACÑ¡ÔñVDDA×÷Ϊ»ù×¼ */
/**
  * @}
  */
 
/**
    * @defgroup ACMP_Channel_Seclect ACMPµÄͨµÀÑ¡Ôñ
    * @{
    */
#define ACMP_INNUll                   0                /*!< ACMPÍⲿÊä³öÒý½Å½ûÓà*/
#define    ACMP_IN0                      1                /*!< ACMPÍⲿÊä³öÒý½Å0 */
#define    ACMP_IN1                      2                /*!< ACMPÍⲿÊä³öÒý½Å1 */
#define    ACMP_IN1IN0                   3                /*!< ACMPÍⲿÊä³öÒý½Å0ºÍ1 */
#define    ACMP_IN2                      4                /*!< ACMPÍⲿÊä³öÒý½Å2 */
#define    ACMP_IN2IN0                   5                /*!< ACMPÍⲿÊä³öÒý½Å0ºÍ2 */
#define    ACMP_IN2IN1                   6                /*!< ACMPÍⲿÊä³öÒý½Å1ºÍ2 */
#define    ACMP_IN2IN1IN0                7                /*!< ACMPÍⲿÊä³öÒý½Å0¡¢1ºÍ2 */
/**
  * @}
  */
                                                                                        
/**
  * @}
  */
 
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/ 
void ACMP_DeInit(ACMP_Type *ACMPx);
void ACMP_Init(ACMP_Type *ACMPx,const ACMP_InitTypeDef *ACMP_InitStruct);
void ACMP_EnableCmd(ACMP_Type *ACMPx,FunctionalState NewState);
void ACMP_InterruptEn(ACMP_Type *ACMPx,FunctionalState NewState);
void ACMP_OutputPinEn(ACMP_Type *ACMPx,FunctionalState NewState);
uint8_t ACMP_GetOutPutLogic(const ACMP_Type *ACMPx);
uint8_t ACMP_GetIntFlag(const ACMP_Type *ACMPx);
void ACMP_ClearIntFlag(ACMP_Type *ACMPx);
 
#ifdef __cplusplus
}
#endif
 
#endif /*__XL_ACMP_H__ */    
 
/**
  * @}
  */
 
/**
  * @}
  */