| Nano103 BSP V3.01.002 The Board Support Package for Nano103 Series

Macros | Functions
ACMP Exported Functions
NANO103 Device Driver » ACMP Driver

## Macros
#define | ACMP_SET_NEG_SRC(acmp, u32ChNum, u32Src)
| This macro is used to enable output inverse. More...
#define | ACMP_ENABLE_HYSTERESIS(acmp, u32ChNum)
| This macro is used to enable hysteresis. More...
#define | ACMP_DISABLE_HYSTERESIS(acmp, u32ChNum)
| This macro is used to disable hysteresis. 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_ENABLE_WAKEUP(acmp, u32ChNum)
| This macro is used to enable ACMP wake-up. More...
#define | ACMP_DISABLE_WAKEUP(acmp, u32ChNum)
| This macro is used to disable ACMP wake-up. More...
#define | ACMP_CRV_SEL(u32Level)
| This macro is used to enable ACMP wake-up. 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...

## Functions
void | ACMP_Open (ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysteresisEn)
| This function open and configure comparator parameters. 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 | This parameter is not used in Nano103

Returns
  None

Definition at line 214 of file acmp.h.

## ◆ ACMP_CRV_SEL

#define ACMP_CRV_SEL | ( |  | u32Level | ) |

This macro is used to enable ACMP wake-up.

Parameters

  [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 only set CVR level, and does not enable/disable CRV

Definition at line 273 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 | This parameter is not used in Nano103

Returns
  None

Definition at line 187 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 289 of file acmp.h.

## ◆ ACMP_DISABLE_HYSTERESIS

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

This macro is used to disable hysteresis.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | This parameter is not used in Nano103

Returns
  None

Definition at line 150 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 | This parameter is not used in Nano103

Returns
  None

Definition at line 168 of file acmp.h.

## ◆ ACMP_DISABLE_WAKEUP

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

This macro is used to disable ACMP wake-up.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | This parameter is not used in Nano103

Returns
  None

Definition at line 232 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 | This parameter is not used in Nano103

Returns
  None

Definition at line 178 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 281 of file acmp.h.

## ◆ ACMP_ENABLE_HYSTERESIS

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

This macro is used to enable hysteresis.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | This parameter is not used in Nano103

Returns
  None

Definition at line 141 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 | This parameter is not used in Nano103

Returns
  None

Definition at line 159 of file acmp.h.

## ◆ ACMP_ENABLE_WAKEUP

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

This macro is used to enable ACMP wake-up.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | This parameter is not used in Nano103

Returns
  None

Definition at line 223 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 | This parameter is not used in Nano103

Returns
  ACMP interrupt occurred or not

Definition at line 205 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 | This parameter is not used in Nano103

Returns
  1 or 0

Definition at line 196 of file acmp.h.

## ◆ ACMP_SET_NEG_SRC

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

This macro is used to enable output inverse.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | This parameter is not used in Nano103
  [in] | u32Src | is comparator0 negative input selection. Including : ACMP_VNEG_PIN ACMP_VNEG_IREF ACMP_VNEG_AVSS 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

Definition at line 121 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 | This parameter is not used in Nano103

Definition at line 98 of file acmp.c.

## ◆ ACMP_Open()

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

This function open and configure comparator parameters.

Parameters

  [in] | acmp | The base address of ACMP module
  [in] | u32ChNum | This parameter is not used in Nano103
  [in] | u32NegSrc | is comparator0 negative input selection. Including : ACMP_VNEG_PIN ACMP_VNEG_IREF ACMP_VNEG_AVSS 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 charge or discharge pin selection. Including : ACMP_HYSTERESIS_ENABLE ACMP_HYSTERESIS_DISABLE

Returns
  None

Definition at line 80 of file acmp.c.