| NUC472_NUC442_BSP V3.04.000 The Board Support Package for NUC472/NUC442

Macros | Functions
ACMP Exported Functions
NUC472/NUC442 Device Driver » ACMP Driver » ACMP Exported Constants
Collaboration diagram for ACMP Exported Functions:

## Macros
#define | ACMP_SET_NEG_SRC(acmp, u32ChNum, u32Src)
| This macro is used to select ACMP negative input source. More...
#define | ACMP_ENABLE_HYSTERESIS(acmp, u32ChNum)
| This macro is used to enable hysteresis function. More...
#define | ACMP_DISABLE_HYSTERESIS(acmp, u32ChNum)
| This macro is used to disable hysteresis function. More...
#define | ACMP_ENABLE_INT(acmp, u32ChNum)
| This macro is used to enable interrupt. More...
#define | ACMP_DISABLE_INT(acmp, u32ChNum)
| This macro is used to disable interrupt. More...
#define | ACMP_ENABLE(acmp, u32ChNum)
| This macro is used to enable ACMP. More...
#define | ACMP_DISABLE(acmp, u32ChNum)
| This macro is used to disable ACMP. More...
#define | ACMP_GET_OUTPUT(acmp, u32ChNum)
| This macro is used to get ACMP output value. More...
#define | ACMP_GET_INT_FLAG(acmp, u32ChNum)
| This macro is used to get ACMP interrupt flag. More...
#define | ACMP_CLR_INT_FLAG(acmp, u32ChNum)
| This macro is used to clear ACMP interrupt flag. More...
#define | ACMP_SELECT_P(acmp, u32ChNum, u32Pin)
| This macro is used to select the V+ pin of ACMP. More...
#define | ACMP_CRV_SEL(acmp, u32Level)
| This macro is used to set the level of CRV (Comparator Reference Voltage) More...
#define | ACMP_ENABLE_CRV(acmp)
| This macro is used to enable CRV(Comparator Reference Voltage) More...
#define | ACMP_DISABLE_CRV(acmp)
| This macro is used to disable CRV(Comparator Reference Voltage) More...
#define | ACMP_ENABLE_OUTPUT_INVERSE(acmp, u32ChNum)
| This macro is used to enable ACMP output inverse function. More...
#define | ACMP_DISABLE_OUTPUT_INVERSE(acmp, u32ChNum)
| This macro is used to disable ACMP output inverse function. More...

## Functions
void | ACMP_Open (ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
| Configure the specified ACMP module. More...
void | ACMP_Close (ACMP_T *acmp, uint32_t u32ChNum)
| This function close comparator. More...

## Detailed Description

## Macro Definition Documentation

## ◆ ACMP_CLR_INT_FLAG

#define ACMP_CLR_INT_FLAG | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to clear ACMP interrupt flag.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 228 of file acmp.h.

## ◆ ACMP_CRV_SEL

#define ACMP_CRV_SEL | ( |  | acmp,
|  |  | u32Level
| ) |  |

This macro is used to set the level of CRV (Comparator Reference Voltage)

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32Level | CRV level, possible values are ACMP_VNEG_4_OVER_24_VDD ACMP_VNEG_5_OVER_24_VDD ACMP_VNEG_6_OVER_24_VDD ACMP_VNEG_7_OVER_24_VDD ACMP_VNEG_8_OVER_24_VDD ACMP_VNEG_9_OVER_24_VDD ACMP_VNEG_10_OVER_24_VDD ACMP_VNEG_11_OVER_24_VDD ACMP_VNEG_12_OVER_24_VDD ACMP_VNEG_13_OVER_24_VDD ACMP_VNEG_14_OVER_24_VDD ACMP_VNEG_15_OVER_24_VDD ACMP_VNEG_16_OVER_24_VDD ACMP_VNEG_17_OVER_24_VDD ACMP_VNEG_18_OVER_24_VDD ACMP_VNEG_19_OVER_24_VDD ACMP_VNEG_4_OVER_24_IREF ACMP_VNEG_5_OVER_24_IREF ACMP_VNEG_6_OVER_24_IREF ACMP_VNEG_7_OVER_24_IREF ACMP_VNEG_8_OVER_24_IREF ACMP_VNEG_9_OVER_24_IREF ACMP_VNEG_10_OVER_24_IREF ACMP_VNEG_11_OVER_24_IREF ACMP_VNEG_12_OVER_24_IREF ACMP_VNEG_13_OVER_24_IREF ACMP_VNEG_14_OVER_24_IREF ACMP_VNEG_15_OVER_24_IREF ACMP_VNEG_16_OVER_24_IREF ACMP_VNEG_17_OVER_24_IREF ACMP_VNEG_18_OVER_24_IREF ACMP_VNEG_19_OVER_24_IREF

Returns
  None

Note
  This macro does not enable CRV. Please use ACMP_ENABLE_CRV to enable CRV.

Definition at line 284 of file acmp.h.

## ◆ ACMP_DISABLE

#define ACMP_DISABLE | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to disable ACMP.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 201 of file acmp.h.

## ◆ ACMP_DISABLE_CRV

#define ACMP_DISABLE_CRV | ( |  | acmp | ) |

This macro is used to disable CRV(Comparator Reference Voltage)

Parameters

  [in] | acmp | The base address of ACMP module

Returns
  None

Definition at line 298 of file acmp.h.

## ◆ ACMP_DISABLE_HYSTERESIS

#define ACMP_DISABLE_HYSTERESIS | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to disable hysteresis function.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 164 of file acmp.h.

## ◆ ACMP_DISABLE_INT

#define ACMP_DISABLE_INT | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to disable interrupt.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 182 of file acmp.h.

## ◆ ACMP_DISABLE_OUTPUT_INVERSE

#define ACMP_DISABLE_OUTPUT_INVERSE | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to disable ACMP output inverse function.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 316 of file acmp.h.

## ◆ ACMP_ENABLE

#define ACMP_ENABLE | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to enable ACMP.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 192 of file acmp.h.

## ◆ ACMP_ENABLE_CRV

#define ACMP_ENABLE_CRV | ( |  | acmp | ) |

This macro is used to enable CRV(Comparator Reference Voltage)

Parameters

  [in] | acmp | The base address of ACMP module

Returns
  None

Definition at line 291 of file acmp.h.

## ◆ ACMP_ENABLE_HYSTERESIS

#define ACMP_ENABLE_HYSTERESIS | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to enable hysteresis function.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 155 of file acmp.h.

## ◆ ACMP_ENABLE_INT

#define ACMP_ENABLE_INT | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to enable interrupt.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 173 of file acmp.h.

## ◆ ACMP_ENABLE_OUTPUT_INVERSE

#define ACMP_ENABLE_OUTPUT_INVERSE | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to enable ACMP output inverse function.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  None

Definition at line 307 of file acmp.h.

## ◆ ACMP_GET_INT_FLAG

#define ACMP_GET_INT_FLAG | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to get ACMP interrupt flag.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  ACMP interrupt occurred or not

Definition at line 219 of file acmp.h.

## ◆ ACMP_GET_OUTPUT

#define ACMP_GET_OUTPUT | ( |  | acmp,
|  |  | u32ChNum
| ) |  |

This macro is used to get ACMP output value.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2

Returns
  1 or 0

Definition at line 210 of file acmp.h.

## ◆ ACMP_SELECT_P

#define ACMP_SELECT_P | ( |  | acmp,
|  |  | u32ChNum,
|  |  | u32Pin
| ) |  |

This macro is used to select the V+ pin of ACMP.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2
  [in] | u32Pin | The input pin. For channel 0, valid values are ACMP_CH0_POSPIN_P0, ACMP_CH0_POSPIN_P1, ACMP_CH0_POSPIN_P2, ACMP_CH0_POSPIN_P3, and ACMP_CH0_POS_OPA0. For channel 1, valid values are , ACMP_CH1_POSPIN_P0, ACMP_CH1_POSPIN_P1, ACMP_CH1_POSPIN_P2, ACMP_CH1_POSPIN_P3, and ACMP_CH1_POS_OPA1. For channel 2, valid values are , ACMP_CH2_POSPIN_P0, ACMP_CH2_POSPIN_P1, ACMP_CH2_POSPIN_P2, and ACMP_CH2_POSPIN_P3.

Returns
  None

Note
  Except this setting, multi-function pin also needs to be configured

Definition at line 243 of file acmp.h.

## ◆ ACMP_SET_NEG_SRC

#define ACMP_SET_NEG_SRC | ( |  | acmp,
|  |  | u32ChNum,
|  |  | u32Src
| ) |  |

This macro is used to select ACMP negative input source.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | The ACMP number, could 0, 1, or 2
  [in] | u32Src | is comparator negative input selection. Including : ACMP_VNEG_PIN ACMP_VNEG_BANDGAP ACMP_VNEG_4_OVER_24_VDD ACMP_VNEG_5_OVER_24_VDD ACMP_VNEG_6_OVER_24_VDD ACMP_VNEG_7_OVER_24_VDD ACMP_VNEG_8_OVER_24_VDD ACMP_VNEG_9_OVER_24_VDD ACMP_VNEG_10_OVER_24_VDD ACMP_VNEG_11_OVER_24_VDD ACMP_VNEG_12_OVER_24_VDD ACMP_VNEG_13_OVER_24_VDD ACMP_VNEG_14_OVER_24_VDD ACMP_VNEG_15_OVER_24_VDD ACMP_VNEG_16_OVER_24_VDD ACMP_VNEG_17_OVER_24_VDD ACMP_VNEG_18_OVER_24_VDD ACMP_VNEG_19_OVER_24_VDD ACMP_VNEG_4_OVER_24_IREF ACMP_VNEG_5_OVER_24_IREF ACMP_VNEG_6_OVER_24_IREF ACMP_VNEG_7_OVER_24_IREF ACMP_VNEG_8_OVER_24_IREF ACMP_VNEG_9_OVER_24_IREF ACMP_VNEG_10_OVER_24_IREF ACMP_VNEG_11_OVER_24_IREF ACMP_VNEG_12_OVER_24_IREF ACMP_VNEG_13_OVER_24_IREF ACMP_VNEG_14_OVER_24_IREF ACMP_VNEG_15_OVER_24_IREF ACMP_VNEG_16_OVER_24_IREF ACMP_VNEG_17_OVER_24_IREF ACMP_VNEG_18_OVER_24_IREF ACMP_VNEG_19_OVER_24_IREF

Returns
  None

Note
  The V- setting is shared by all comparators if input source is not coming from PIN

Definition at line 139 of file acmp.h.

## Function Documentation

## ◆ ACMP_Close()

void ACMP_Close | ( | ACMP_T * | acmp,
|  | uint32_t | u32ChNum
| ) |  |

This function close comparator.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | comparator number.

Returns
  None

Definition at line 96 of file acmp.c.

## ◆ ACMP_Open()

void ACMP_Open | ( | ACMP_T * | acmp,
|  | uint32_t | u32ChNum,
|  | uint32_t | u32NegSrc,
|  | uint32_t | u32HysteresisEn
| ) |  |

Configure the specified ACMP module.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | comparator number, could be 0, 1, 2
  [in] | u32NegSrc | is comparator negative input selection. Including: ACMP_VNEG_PIN ACMP_VNEG_BANDGAP ACMP_VNEG_4_OVER_24_VDD ACMP_VNEG_5_OVER_24_VDD ACMP_VNEG_6_OVER_24_VDD ACMP_VNEG_7_OVER_24_VDD ACMP_VNEG_8_OVER_24_VDD ACMP_VNEG_9_OVER_24_VDD ACMP_VNEG_10_OVER_24_VDD ACMP_VNEG_11_OVER_24_VDD ACMP_VNEG_12_OVER_24_VDD ACMP_VNEG_13_OVER_24_VDD ACMP_VNEG_14_OVER_24_VDD ACMP_VNEG_15_OVER_24_VDD ACMP_VNEG_16_OVER_24_VDD ACMP_VNEG_17_OVER_24_VDD ACMP_VNEG_18_OVER_24_VDD ACMP_VNEG_19_OVER_24_VDD ACMP_VNEG_4_OVER_24_IREF ACMP_VNEG_5_OVER_24_IREF ACMP_VNEG_6_OVER_24_IREF ACMP_VNEG_7_OVER_24_IREF ACMP_VNEG_8_OVER_24_IREF ACMP_VNEG_9_OVER_24_IREF ACMP_VNEG_10_OVER_24_IREF ACMP_VNEG_11_OVER_24_IREF ACMP_VNEG_12_OVER_24_IREF ACMP_VNEG_13_OVER_24_IREF ACMP_VNEG_14_OVER_24_IREF ACMP_VNEG_15_OVER_24_IREF ACMP_VNEG_16_OVER_24_IREF ACMP_VNEG_17_OVER_24_IREF ACMP_VNEG_18_OVER_24_IREF ACMP_VNEG_19_OVER_24_IREF
  [in] | u32HysteresisEn | is the hysteresis function option. Including: ACMP_HYSTERESIS_ENABLE ACMP_HYSTERESIS_DISABLE

Returns
  None

Definition at line 80 of file acmp.c.