| NUC029FAE_BSP V3.02.000 The Board Support Package for NUC029FAE MCU

acmp.c
Go to the documentation of this file.
1/**************************************************************************/
13#include "NUC029FAE.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 NUC029FAE_ACMP_EXPORTED_FUNCTIONS */
88 /* end of group NUC029FAE_ACMP_Driver */
90 /* end of group NUC029FAE_Device_Driver */
92
93#ifdef __cplusplus
94}
95#endif
96
97/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
98
NUC029FAE.h
NUC029FAE peripheral access layer header file. This file contains all the peripheral register's defin...
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: NUC029FAE.h:3225
ACMP_T
Definition: NUC029FAE.h:147