Mini51 BSP  V3.02.002
The Board Support Package for Mini51 Series
acmp.c
Go to the documentation of this file.
1 /**************************************************************************/
13 #include "Mini51Series.h"
14 
15 #ifdef __cplusplus
16 extern "C"
17 {
18 #endif
19 
64 void ACMP_Open(ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
65 {
66  if(u32NegSrc != ACMP_VNEG_PIN)
67  ACMP->CMPRVCR = u32NegSrc;
68  ACMP->CMPCR[u32ChNum] = (ACMP->CMPCR[u32ChNum] & (~(ACMP_CMPCR_NEGSEL_Msk | ACMP_CMPCR_HYSEN_Msk))) |
69  ((u32NegSrc != ACMP_VNEG_PIN ? ACMP_CMPCR_NEGSEL_Msk : 0) | u32HysteresisEn | ACMP_CMPCR_ACMPEN_Msk);
70 }
71 
80 void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
81 {
82  ACMP->CMPCR[u32ChNum] &= (~ACMP_CMPCR_ACMPEN_Msk);
83 }
84 
85 
86  /* end of group MINI51_ACMP_EXPORTED_FUNCTIONS */
88  /* end of group MINI51_ACMP_Driver */
90  /* end of group MINI51_Device_Driver */
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 /*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
98 
#define ACMP_CMPCR_HYSEN_Msk
Definition: Mini51Series.h:333
Mini51 series peripheral access layer header file. This file contains all the peripheral register's d...
void ACMP_Open(ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
Configure the specified ACMP module.
Definition: acmp.c:64
#define ACMP_CMPCR_NEGSEL_Msk
Definition: Mini51Series.h:336
#define ACMP_VNEG_PIN
Selecting the voltage of ACMP negative input pin as the source of ACMP V-.
Definition: acmp.h:36
void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
This function close comparator.
Definition: acmp.c:80
#define ACMP_CMPCR_ACMPEN_Msk
Definition: Mini51Series.h:327
#define ACMP
Pointer to ACMP register structure.