| MINI58_BSP V3.01.003 The Board Support Package for Mini58 Series MCU

acmp.c
Go to the documentation of this file.
1/**************************************************************************/
13#include "Mini58Series.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->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
80 void ACMP_Close(ACMP_T *acmp, uint32_t u32ChNum)
81{
82 ACMP->CTL[u32ChNum] &= (~ACMP_CTL_ACMPEN_Msk);
83}
84
85
86 /* end of group Mini58_ACMP_EXPORTED_FUNCTIONS */
88 /* end of group Mini58_ACMP_Driver */
90 /* end of group Mini58_Device_Driver */
92
93#ifdef __cplusplus
94}
95#endif
96
97/*** (C) COPYRIGHT 2022 Nuvoton Technology Corp. ***/
98
Mini58Series.h
Mini58 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:34
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: Mini58Series.h:11727
ACMP_CTL_HYSSEL_Msk
#define ACMP_CTL_HYSSEL_Msk
Definition: Mini58Series.h:276
ACMP_CTL_NEGSEL_Msk
#define ACMP_CTL_NEGSEL_Msk
Definition: Mini58Series.h:279
ACMP_CTL_ACMPEN_Msk
#define ACMP_CTL_ACMPEN_Msk
Definition: Mini58Series.h:270
ACMP_T
Definition: Mini58Series.h:163