NUC472_NUC442_BSP V3.03.005
The Board Support Package for NUC472/NUC442
acmp.c
Go to the documentation of this file.
1/**************************************************************************/
13#include "NUC472_442.h"
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
80void ACMP_Open(ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
81{
82 if((u32NegSrc != ACMP_VNEG_PIN) && (u32NegSrc != ACMP_VNEG_BANDGAP))
83 ACMP->VREF = u32NegSrc | ACMP_VREF_IREFSEL_Msk;
84 ACMP->CTL[u32ChNum] = (ACMP->CTL[u32ChNum] & (~(ACMP_CTL_NEGSEL_Msk | ACMP_CTL_HYSEN_Msk))) |
85 ((u32NegSrc != ACMP_VNEG_PIN ? ACMP_CTL_NEGSEL_Msk : 0) | u32HysteresisEn | ACMP_CTL_ACMPEN_Msk);
86}
87
96void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
97{
98 ACMP->CTL[u32ChNum] &= (~ACMP_CTL_ACMPEN_Msk);
99}
100
101
102 /* end of group NUC472_442_ACMP_EXPORTED_FUNCTIONS */
104 /* end of group NUC472_442_ACMP_Driver */
106 /* end of group NUC472_442_Device_Driver */
108
109#ifdef __cplusplus
110}
111#endif
112
113/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
114
NUC472/NUC442 peripheral access layer header file. This file contains all the peripheral register's d...
#define ACMP_VNEG_BANDGAP
Selecting band-gap voltage as the source of ACMP V-.
Definition: acmp.h:37
#define ACMP_VNEG_PIN
Selecting the voltage of ACMP negative input pin as the source of ACMP V-.
Definition: acmp.h:36
void ACMP_Open(ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
Configure the specified ACMP module.
Definition: acmp.c:80
void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
This function close comparator.
Definition: acmp.c:96
#define ACMP
Definition: NUC472_442.h:28831
#define ACMP_VREF_IREFSEL_Msk
Definition: NUC472_442.h:358
#define ACMP_CTL_NEGSEL_Msk
Definition: NUC472_442.h:328
#define ACMP_CTL_HYSEN_Msk
Definition: NUC472_442.h:322
#define ACMP_CTL_ACMPEN_Msk
Definition: NUC472_442.h:316