Nano102_112 Series BSP  V3.03.002
The Board Support Package for Nano102_112 Series
Macros | Functions
ACMP Exported Functions

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...
 
#define ACMP_SELECT_P(acmp, u32ChNum, u32Src)   ((acmp)->CR[(u32ChNum)%2] = ((acmp)->CR[(u32ChNum)%2] & ~ACMP_CR_CPP0SEL_Msk) | (u32Src))
 This macro is used to select ACMP positive input source for ACMP0. More...
 
#define ACMP_START_CONV(acmp)
 This macro is used to start ACMP on sigma-delta mode or slope mode. 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...
 
void ACMP_SetSigmaDeltaConv (uint32_t u32TimerNum, uint32_t u32TriggerPolarity, uint32_t u32PosPin, uint32_t u32ChargePin)
 This function configure ACMP to sigma-delta mode. More...
 
void ACMP_SetSlopeConv (uint32_t u32TimerNum, uint32_t u32TriggerPolarity, uint32_t u32PosPin, uint32_t u32ChargePin)
 This function configure ACMP to slope mode. 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]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 167 of file acmp.h.

◆ ACMP_CRV_SEL

#define ACMP_CRV_SEL (   u32Level)

This macro is used to enable ACMP wake-up.

Parameters
[in]u32Levelcomparator reference voltage setting. The formula is: comparator reference voltage = AVDD x (1/6 +u32Level/24) The range of u32Level is 0 ~ 15.
Returns
None

Definition at line 196 of file acmp.h.

◆ ACMP_DISABLE

#define ACMP_DISABLE (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 140 of file acmp.h.

◆ ACMP_DISABLE_CRV

#define ACMP_DISABLE_CRV (   acmp)

This macro is used to disable CRV(comparator reference voltage)

Parameters
[in]acmpThe base address of ACMP module
Returns
None

Definition at line 212 of file acmp.h.

◆ ACMP_DISABLE_HYSTERESIS

#define ACMP_DISABLE_HYSTERESIS (   acmp,
  u32ChNum 
)

This macro is used to disable hysteresis.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 103 of file acmp.h.

◆ ACMP_DISABLE_INT

#define ACMP_DISABLE_INT (   acmp,
  u32ChNum 
)

This macro is used to disable interrupt.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 121 of file acmp.h.

◆ ACMP_DISABLE_WAKEUP

#define ACMP_DISABLE_WAKEUP (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP wake-up.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 185 of file acmp.h.

◆ ACMP_ENABLE

#define ACMP_ENABLE (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 131 of file acmp.h.

◆ ACMP_ENABLE_CRV

#define ACMP_ENABLE_CRV (   acmp)

This macro is used to enable CRV(comparator reference voltage)

Parameters
[in]acmpThe base address of ACMP module
Returns
None

Definition at line 204 of file acmp.h.

◆ ACMP_ENABLE_HYSTERESIS

#define ACMP_ENABLE_HYSTERESIS (   acmp,
  u32ChNum 
)

This macro is used to enable hysteresis.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 94 of file acmp.h.

◆ ACMP_ENABLE_INT

#define ACMP_ENABLE_INT (   acmp,
  u32ChNum 
)

This macro is used to enable interrupt.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 112 of file acmp.h.

◆ ACMP_ENABLE_WAKEUP

#define ACMP_ENABLE_WAKEUP (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP wake-up.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 176 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]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
ACMP interrupt occurred or not

Definition at line 158 of file acmp.h.

◆ ACMP_GET_OUTPUT

#define ACMP_GET_OUTPUT (   acmp,
  u32ChNum 
)

This macro is used to get ACMP output value.

Parameters
[in]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
Returns
1 or 0

Definition at line 149 of file acmp.h.

◆ ACMP_SELECT_P

#define ACMP_SELECT_P (   acmp,
  u32ChNum,
  u32Src 
)    ((acmp)->CR[(u32ChNum)%2] = ((acmp)->CR[(u32ChNum)%2] & ~ACMP_CR_CPP0SEL_Msk) | (u32Src))

This macro is used to select ACMP positive input source for ACMP0.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
[in]u32SrcComparator positive input selection. Including:
Returns
None

This macro will set CPP0SEL (CR[0]) to determine the comparator positive input source.

Definition at line 226 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]acmpThe base address of ACMP module
[in]u32ChNumThe ACMP number
[in]u32Srcis comparator0 negative input selection. Including :
Returns
None

Definition at line 85 of file acmp.h.

◆ ACMP_START_CONV

#define ACMP_START_CONV (   acmp)

This macro is used to start ACMP on sigma-delta mode or slope mode.

Parameters
[in]acmpThe base address of ACMP module
Returns
None

Definition at line 234 of file acmp.h.

Function Documentation

◆ ACMP_Close()

void ACMP_Close ( ACMP_T Acmp,
uint32_t  u32ChNum 
)

This function close comparator.

Parameters
[in]AcmpThe base address of ACMP module
[in]u32ChNumcomparator number.

Definition at line 71 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]AcmpThe base address of ACMP module
[in]u32ChNumcomparator number.
[in]u32NegSrcis comparator0 negative input selection. Including :
[in]u32HysteresisEnis charge or discharge pin selection. Including :
Returns
None

Definition at line 55 of file acmp.c.

◆ ACMP_SetSigmaDeltaConv()

void ACMP_SetSigmaDeltaConv ( uint32_t  u32TimerNum,
uint32_t  u32TriggerPolarity,
uint32_t  u32PosPin,
uint32_t  u32ChargePin 
)

This function configure ACMP to sigma-delta mode.

Parameters
[in]u32TimerNumis set to 0 to use timer0 and timer1, set to 1 to use timer0 and timer1. Including :
[in]u32TriggerPolarityis set rising trigger or falling trigger. Including :
[in]u32PosPinis comparator0 positive input selection. Including :
[in]u32ChargePinis charge or discharge pin selection. Including :
Returns
None

Definition at line 102 of file acmp.c.

◆ ACMP_SetSlopeConv()

void ACMP_SetSlopeConv ( uint32_t  u32TimerNum,
uint32_t  u32TriggerPolarity,
uint32_t  u32PosPin,
uint32_t  u32ChargePin 
)

This function configure ACMP to slope mode.

Parameters
[in]u32TimerNumis set to 0 to use timer0 and timer1, set to 1 to use timer0 and timer1. Including :
[in]u32TriggerPolarityis set rising trigger or falling trigger. Including :
[in]u32PosPinis comparator0 positive input selection. Including :
[in]u32ChargePinis charge or discharge pin selection. Including :
Returns
None

Definition at line 142 of file acmp.c.