| MINI51DE_BSP V3.02.003 The Board Support Package for Mini51DE Series MCU

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
Mini51Series.h
Mini51 series peripheral access layer header file. This file contains all the peripheral register's d...
ACMP_VNEG_PIN
#define ACMP_VNEG_PIN
Selecting the voltage of ACMP negative input pin as the source of ACMP V-.
Definition: acmp.h:36
ACMP_Open
void ACMP_Open(ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
Configure the specified ACMP module.
Definition: acmp.c:64
ACMP_Close
void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
This function close comparator.
Definition: acmp.c:80
ACMP
#define ACMP
Pointer to ACMP register structure.
Definition: Mini51Series.h:5733
ACMP_CMPCR_NEGSEL_Msk
#define ACMP_CMPCR_NEGSEL_Msk
Definition: Mini51Series.h:249
ACMP_CMPCR_HYSEN_Msk
#define ACMP_CMPCR_HYSEN_Msk
Definition: Mini51Series.h:246
ACMP_CMPCR_ACMPEN_Msk
#define ACMP_CMPCR_ACMPEN_Msk
Definition: Mini51Series.h:240
ACMP_T
Definition: Mini51Series.h:157