blob: 67f119676467ce42dd171b18927f160da976d8b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/**************************************************************************//**
* @file acmp.c
* @version V3.00
* $Revision: 4 $
* $Date: 14/01/28 10:49a $
* @brief M051 series Analog Comparator(ACMP) driver source file
*
* @note
* Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#include "M051Series.h"
#ifdef __cplusplus
extern "C"
{
#endif
/** @addtogroup M051_Device_Driver M051 Device Driver
@{
*/
/** @addtogroup M051_ACMP_Driver ACMP Driver
@{
*/
/** @addtogroup M051_ACMP_EXPORTED_FUNCTIONS ACMP Exported Functions
@{
*/
/**
* @brief Configure the specified ACMP module
*
* @param[in] Acmp The base address of ACMP module
* @param[in] u32ChNum comparator number.
* @param[in] u32NegSrc is comparator negative input selection. Including:
* - \ref ACMP_CR_VNEG_PIN
* - \ref ACMP_CR_VNEG_BANDGAP
*
* @param[in] u32HysteresisEn is the hysteresis function option. Including:
* - \ref ACMP_CR_HYSTERESIS_ENABLE
* - \ref ACMP_CR_HYSTERESIS_DISABLE
* @return None
*/
void ACMP_Open(ACMP_T *Acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
{
Acmp->CR[u32ChNum % 2] = (Acmp->CR[u32ChNum % 2] & (~(ACMP_CR_NEGSEL_Msk | ACMP_CR_HYSEN_Msk))) | (u32NegSrc | u32HysteresisEn | ACMP_CR_ACMPEN_Msk);
}
/**
* @brief This function close comparator
*
* @param[in] Acmp The base address of ACMP module
* @param[in] u32ChNum comparator number.
*
* @return None
*/
void ACMP_Close(ACMP_T *Acmp, uint32_t u32ChNum)
{
Acmp->CR[u32ChNum % 2] &= (~ACMP_CR_ACMPEN_Msk);
}
/*@}*/ /* end of group M051_ACMP_EXPORTED_FUNCTIONS */
/*@}*/ /* end of group M051_ACMP_Driver */
/*@}*/ /* end of group M051_Device_Driver */
#ifdef __cplusplus
}
#endif
/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/
|