MG32F10x Standard Peripherals Firmware Library
mg32f10x_anctl.h
Go to the documentation of this file.
1 
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32F10x_ANCTL_H
12 #define __MG32F10x_ANCTL_H
13 
14 #ifdef __cplusplus
15  extern "C" {
16 #endif
17 
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f10x.h"
20 
29 /* Exported types ------------------------------------------------------------*/
30 /* Exported constants --------------------------------------------------------*/
31 
39 #define ANCTL_HSE_OFF ((uint32_t)0x00000000)
40 #define ANCTL_HSE_ON ((uint32_t)0x00000201)
41 #define ANCTL_HSE_Bypass ((uint32_t)0x00000002)
42 
50 #define ANCTL_PLLMul_12 ((uint32_t)0x000000C0)
51 #define ANCTL_PLLMul_16 ((uint32_t)0x00000080)
52 #define ANCTL_PLLMul_20 ((uint32_t)0x00000040)
53 #define ANCTL_PLLMul_24 ((uint32_t)0x00000000)
54 
62 #define ANCTL_FLAG_MHSIRDY ((uint16_t)0x3001)
63 #define ANCTL_FLAG_FHSIRDY ((uint16_t)0x3C01)
64 #define ANCTL_FLAG_LSIRDY ((uint16_t)0x4801)
65 #define ANCTL_FLAG_HSERDY ((uint16_t)0x5801)
66 #define ANCTL_FLAG_PLLRDY ((uint16_t)0x7C03)
67 
75 #define ANCTL_PVDLevel_0 ANCTL_PVDCR_PLS_LEV0
76 #define ANCTL_PVDLevel_1 ANCTL_PVDCR_PLS_LEV1
77 #define ANCTL_PVDLevel_2 ANCTL_PVDCR_PLS_LEV2
78 #define ANCTL_PVDLevel_3 ANCTL_PVDCR_PLS_LEV3
79 #define ANCTL_PVDLevel_4 ANCTL_PVDCR_PLS_LEV4
80 #define ANCTL_PVDLevel_5 ANCTL_PVDCR_PLS_LEV5
81 #define ANCTL_PVDLevel_6 ANCTL_PVDCR_PLS_LEV6
82 #define ANCTL_PVDLevel_7 ANCTL_PVDCR_PLS_LEV7
83 
91 #define ANCTL_USBPHY_DPPU ((uint32_t)0x00000002)
92 #define ANCTL_USBPHY_HIGHRES ((uint32_t)0x00000004)
93 #define ANCTL_USBPHY_DMST ((uint32_t)0x00000008)
94 #define ANCTL_USBPHY_DPST ((uint32_t)0x00000010)
95 
103 #define CMPA_PSEL_PA8 0x00
104 #define CMPA_PSEL_PB4 0x01
105 #define CMPA_PSEL_PB5 0x02
106 #define CMPA_PSEL_PA13 0x03
107 
108 #define CMPA_NSEL_PA9 0x00
109 #define CMPA_NSEL_PB6 0x01
110 #define CMPA_NSEL_PB7 0x02
111 #define CMPA_NSEL_PA14 0x03
112 
120 #define CMPB_PSEL_PD2 0x00
121 #define CMPB_PSEL_PC10 0x01
122 #define CMPB_PSEL_PC11 0x02
123 #define CMPB_PSEL_PA15 0x03
124 
125 #define CMPB_NSEL_PC12 0x00
126 #define CMPB_NSEL_PB8 0x01
127 #define CMPB_NSEL_PB9 0x02
128 #define CMPB_NSEL_PB3 0x03
129 
137 #define ANCTL_IT_MHSI ((uint8_t)0x01)
138 #define ANCTL_IT_FHSI ((uint8_t)0x02)
139 #define ANCTL_IT_LSI ((uint8_t)0x04)
140 #define ANCTL_IT_HSE ((uint8_t)0x08)
141 #define ANCTL_IT_LSE ((uint8_t)0x10)
142 #define ANCTL_IT_PLL ((uint8_t)0x20)
143 #define ANCTL_IT_DCSS ((uint8_t)0x80)
144 
152 /* Exported macro ------------------------------------------------------------*/
153 /* Exported functions --------------------------------------------------------*/
154 
155 void ANCTL_MHSICmd(FunctionalState NewState);
156 void ANCTL_FHSICmd(FunctionalState NewState);
157 void ANCTL_LSICmd(FunctionalState NewState);
158 void ANCTL_HSEConfig(uint32_t ANCTL_HSE);
159 ErrorStatus ANCTL_WaitForHSEStartUp(void);
160 void ANCTL_PLLConfig(uint32_t ANCTL_PLLMul);
161 void ANCTL_PLLCmd(FunctionalState NewState);
162 FlagStatus ANCTL_GetFlagStatus(uint16_t ANCTL_FLAG);
163 void ANCTL_PVDLevelConfig(uint32_t ANCTL_PVDLevel);
164 void ANCTL_PVDCmd(FunctionalState NewState);
165 void ANCTL_SARADCCmd(FunctionalState NewState);
166 void ANCTL_USBPHYDeInit(void);
167 void ANCTL_USBPHYConfig(uint32_t ANCTL_USBPHY, FunctionalState NewState);
168 void ANCTL_USBPHYCmd(FunctionalState NewState);
169 void ANCTL_PORCmd(FunctionalState NewState);
170 void ANCTL_CMPAConfig(uint32_t CMPA_PSEL, uint32_t CMPA_NSEL);
171 void ANCTL_CMPACmd(FunctionalState NewState);
172 uint32_t ANCTL_CMPAGetOutputLevel(void);
173 void ANCTL_CMPBConfig(uint32_t CMPB_PSEL, uint32_t CMPB_NSEL);
174 void ANCTL_CMPBCmd(FunctionalState NewState);
175 uint32_t ANCTL_CMPBGetOutputLevel(void);
176 void ANCTL_ITConfig(uint8_t ANCTL_IT, FunctionalState NewState);
177 ITStatus ANCTL_GetITStatus(uint8_t ANCTL_IT);
178 void ANCTL_ClearITPendingBit(uint8_t ANCTL_IT);
179 void ANCTL_ClockSecuritySystemCmd(FunctionalState NewState);
180 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif /* __MG32F10x_ANCTL_H */
FlagStatus ANCTL_GetFlagStatus(uint16_t ANCTL_FLAG)
Checks whether the specified ANCTL flag is set or not.
Definition: mg32f10x_anctl.c:169
ErrorStatus ANCTL_WaitForHSEStartUp(void)
Waits for HSE start-up.
Definition: mg32f10x_anctl.c:106
void ANCTL_ClearITPendingBit(uint8_t ANCTL_IT)
Clears the ANCTL's interrupt pending bits.
Definition: mg32f10x_anctl.c:442
void ANCTL_CMPBCmd(FunctionalState NewState)
Enables or disables the Comparator B.
Definition: mg32f10x_anctl.c:358
void ANCTL_PLLConfig(uint32_t ANCTL_PLLMul)
Configures the PLL multiplication factor.
Definition: mg32f10x_anctl.c:141
void ANCTL_ITConfig(uint8_t ANCTL_IT, FunctionalState NewState)
Enables or disables the specified ANCTL interrupts.
Definition: mg32f10x_anctl.c:390
void ANCTL_CMPACmd(FunctionalState NewState)
Enables or disables the Comparator A.
Definition: mg32f10x_anctl.c:320
void ANCTL_SARADCCmd(FunctionalState NewState)
Enables or disables the SAR ADC.
Definition: mg32f10x_anctl.c:232
void ANCTL_CMPBConfig(uint32_t CMPB_PSEL, uint32_t CMPB_NSEL)
Configures the Comparator B.
Definition: mg32f10x_anctl.c:344
ITStatus ANCTL_GetITStatus(uint8_t ANCTL_IT)
Checks whether the specified ANCTL interrupt has occurred or not.
Definition: mg32f10x_anctl.c:413
uint32_t ANCTL_CMPAGetOutputLevel(void)
Returns the Comparator A output level.
Definition: mg32f10x_anctl.c:332
void ANCTL_CMPAConfig(uint32_t CMPA_PSEL, uint32_t CMPA_NSEL)
Configures the Comparator A.
Definition: mg32f10x_anctl.c:306
void ANCTL_PLLCmd(FunctionalState NewState)
Enables or disables the PLL.
Definition: mg32f10x_anctl.c:153
void ANCTL_USBPHYDeInit(void)
Deinitializes the USB PHY register to default reset values.
Definition: mg32f10x_anctl.c:242
void ANCTL_PVDCmd(FunctionalState NewState)
Enables or disables the Power Voltage Detector (PVD).
Definition: mg32f10x_anctl.c:220
void ANCTL_PORCmd(FunctionalState NewState)
Enables or disables the Power-on Reset function.
Definition: mg32f10x_anctl.c:289
void ANCTL_USBPHYConfig(uint32_t ANCTL_USBPHY, FunctionalState NewState)
Configures the USB PHY function.
Definition: mg32f10x_anctl.c:260
void ANCTL_FHSICmd(FunctionalState NewState)
Enables or disables the Internal 48MHz oscillator (FHSI).
Definition: mg32f10x_anctl.c:66
void ANCTL_MHSICmd(FunctionalState NewState)
Enables or disables the Internal 8MHz oscillator (MHSI).
Definition: mg32f10x_anctl.c:54
void ANCTL_PVDLevelConfig(uint32_t ANCTL_PVDLevel)
Configures the voltage threshold detected by the Power Voltage Detector(PVD).
Definition: mg32f10x_anctl.c:208
uint32_t ANCTL_CMPBGetOutputLevel(void)
Returns the Comparator B output level.
Definition: mg32f10x_anctl.c:370
void ANCTL_ClockSecuritySystemCmd(FunctionalState NewState)
Enables or disables the Clock Security System.
Definition: mg32f10x_anctl.c:454
void ANCTL_HSEConfig(uint32_t ANCTL_HSE)
Configures the External High Speed oscillator (HSE).
Definition: mg32f10x_anctl.c:93
void ANCTL_USBPHYCmd(FunctionalState NewState)
Enables or disables the USB PHY.
Definition: mg32f10x_anctl.c:277
void ANCTL_LSICmd(FunctionalState NewState)
Enables or disables the Internal Low Speed oscillator (LSI).
Definition: mg32f10x_anctl.c:78