MINI55_BSP V3.02.004
The Board Support Package for Mini55 Series MCU
acmp.c
Go to the documentation of this file.
1/**************************************************************************/
13#include "Mini55Series.h"
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
64void ACMP_Open(ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
65{
66 if(u32NegSrc != ACMP_VNEG_PIN)
67 ACMP->VREF = u32NegSrc;
68 ACMP->CTL[u32ChNum] = (ACMP->CTL[u32ChNum] & (~(ACMP_CTL_NEGSEL_Msk | ACMP_CTL_HYSSEL_Msk))) |
69 ((u32NegSrc != ACMP_VNEG_PIN ? ACMP_CTL_NEGSEL_Msk : 0) | u32HysteresisEn | ACMP_CTL_ACMPEN_Msk);
70}
71
80void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
81{
82 ACMP->CTL[u32ChNum] &= (~ACMP_CTL_ACMPEN_Msk);
83}
84
85
86 /* end of group MINI55_ACMP_EXPORTED_FUNCTIONS */
88 /* end of group MINI55_ACMP_Driver */
90 /* end of group MINI55_Device_Driver */
92
93#ifdef __cplusplus
94}
95#endif
96
97/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
98
Mini55 series peripheral access layer header file. This file contains all the peripheral register's d...
#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:64
void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
This function close comparator.
Definition: acmp.c:80
#define ACMP
Pointer to ACMP register structure.
#define ACMP_CTL_HYSSEL_Msk
Definition: Mini55Series.h:268
#define ACMP_CTL_NEGSEL_Msk
Definition: Mini55Series.h:271
#define ACMP_CTL_ACMPEN_Msk
Definition: Mini55Series.h:262