M480 BSP V3.05.006
The Board Support Package for M480 Series
Macros | Functions

Macros

#define ACMP_ENABLE_OUTPUT_INVERSE(acmp, u32ChNum)
 This macro is used to enable output inverse function. More...
 
#define ACMP_DISABLE_OUTPUT_INVERSE(acmp, u32ChNum)
 This macro is used to disable output inverse function. More...
 
#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 and set hysteresis to 30mV. More...
 
#define ACMP_DISABLE_HYSTERESIS(acmp, u32ChNum)
 This macro is used to disable hysteresis function. More...
 
#define ACMP_CONFIG_HYSTERESIS(acmp, u32ChNum, u32HysSel)
 This macro is used to select hysteresis level. 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_CLR_WAKEUP_INT_FLAG(acmp, u32ChNum)
 This macro is used to clear ACMP wake-up interrupt flag. More...
 
#define ACMP_ENABLE_WAKEUP(acmp, u32ChNum)
 This macro is used to enable ACMP wake-up function. More...
 
#define ACMP_DISABLE_WAKEUP(acmp, u32ChNum)
 This macro is used to disable ACMP wake-up function. More...
 
#define ACMP_SELECT_P(acmp, u32ChNum, u32Pin)
 This macro is used to select ACMP positive input pin. More...
 
#define ACMP_ENABLE_FILTER(acmp, u32ChNum)
 This macro is used to enable ACMP filter function. More...
 
#define ACMP_DISABLE_FILTER(acmp, u32ChNum)
 This macro is used to disable ACMP filter function. More...
 
#define ACMP_SET_FILTER(acmp, u32ChNum, u32Cnt)
 This macro is used to set ACMP filter function. More...
 
#define ACMP_CRV_SEL(acmp, u32Level)
 This macro is used to select comparator reference voltage. More...
 
#define ACMP_SELECT_CRV_SRC(acmp, u32Src)
 This macro is used to select the source of CRV. More...
 
#define ACMP_SELECT_INT_COND(acmp, u32ChNum, u32Cond)
 This macro is used to select ACMP interrupt condition. More...
 
#define ACMP_ENABLE_WINDOW_LATCH(acmp, u32ChNum)
 This macro is used to enable ACMP window latch mode. More...
 
#define ACMP_DISABLE_WINDOW_LATCH(acmp, u32ChNum)
 This macro is used to disable ACMP window latch mode. More...
 
#define ACMP_ENABLE_WINDOW_COMPARE(acmp, u32ChNum)
 This macro is used to enable ACMP window compare mode. More...
 
#define ACMP_DISABLE_WINDOW_COMPARE(acmp, u32ChNum)
 This macro is used to disable ACMP window compare mode. More...
 

Functions

void ACMP_Open (ACMP_T *acmp, uint32_t u32ChNum, uint32_t u32NegSrc, uint32_t u32HysSel)
 Configure the specified ACMP module. More...
 
void ACMP_Close (ACMP_T *acmp, uint32_t u32ChNum)
 Close analog 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]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will write 1 to ACMPIFn bit of ACMP_STATUS register to clear interrupt flag.

Definition at line 218 of file acmp.h.

◆ ACMP_CLR_WAKEUP_INT_FLAG

#define ACMP_CLR_WAKEUP_INT_FLAG (   acmp,
  u32ChNum 
)

This macro is used to clear ACMP wake-up interrupt flag.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will write 1 to WKIFn bit of ACMP_STATUS register to clear interrupt flag.

Definition at line 228 of file acmp.h.

◆ ACMP_CONFIG_HYSTERESIS

#define ACMP_CONFIG_HYSTERESIS (   acmp,
  u32ChNum,
  u32HysSel 
)

This macro is used to select hysteresis level.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
[in]u32HysSelThe hysteresis function option. Including:
Returns
None

Definition at line 147 of file acmp.h.

◆ ACMP_CRV_SEL

#define ACMP_CRV_SEL (   acmp,
  u32Level 
)

This macro is used to select comparator reference voltage.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32LevelThe comparator reference voltage setting. The formula is: comparator reference voltage = CRV source voltage x (1/6 + u32Level/24) The range of u32Level is 0 ~ 15.
Returns
None

When CRV is selected as ACMP negative input source, the CRV level is determined by CRVCTL (ACMP_VREF[3:0]).

Definition at line 315 of file acmp.h.

◆ ACMP_DISABLE

#define ACMP_DISABLE (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear ACMPEN bit of ACMP_CTL register to disable analog comparator.

Definition at line 188 of file acmp.h.

◆ ACMP_DISABLE_FILTER

#define ACMP_DISABLE_FILTER (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP filter function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear OUTSEL (ACMP_CTL[12]) to disable output filter function.

Definition at line 283 of file acmp.h.

◆ ACMP_DISABLE_HYSTERESIS

#define ACMP_DISABLE_HYSTERESIS (   acmp,
  u32ChNum 
)

This macro is used to disable hysteresis function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear HYSEL bits of ACMP_CTL register to disable hysteresis function.

Definition at line 133 of file acmp.h.

◆ ACMP_DISABLE_INT

#define ACMP_DISABLE_INT (   acmp,
  u32ChNum 
)

This macro is used to disable interrupt.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear ACMPIE bit of ACMP_CTL register to disable interrupt function.

Definition at line 168 of file acmp.h.

◆ ACMP_DISABLE_OUTPUT_INVERSE

#define ACMP_DISABLE_OUTPUT_INVERSE (   acmp,
  u32ChNum 
)

This macro is used to disable output inverse function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear ACMPOINV bit of ACMP_CTL register to disable output inverse function.

Definition at line 99 of file acmp.h.

◆ ACMP_DISABLE_WAKEUP

#define ACMP_DISABLE_WAKEUP (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP wake-up function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear WKEN (ACMP_CTL[16]) to disable ACMP wake-up function.

Definition at line 248 of file acmp.h.

◆ ACMP_DISABLE_WINDOW_COMPARE

#define ACMP_DISABLE_WINDOW_COMPARE (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP window compare mode.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear WCMPSEL (ACMP_CTL[18]) to disable ACMP window compare mode.

Definition at line 391 of file acmp.h.

◆ ACMP_DISABLE_WINDOW_LATCH

#define ACMP_DISABLE_WINDOW_LATCH (   acmp,
  u32ChNum 
)

This macro is used to disable ACMP window latch mode.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will clear WLATEN (ACMP_CTL[17]) to disable ACMP window latch mode.

Definition at line 364 of file acmp.h.

◆ ACMP_ENABLE

#define ACMP_ENABLE (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set ACMPEN bit of ACMP_CTL register to enable analog comparator.

Definition at line 178 of file acmp.h.

◆ ACMP_ENABLE_FILTER

#define ACMP_ENABLE_FILTER (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP filter function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set OUTSEL (ACMP_CTL[12]) to enable output filter function.

Definition at line 273 of file acmp.h.

◆ ACMP_ENABLE_HYSTERESIS

#define ACMP_ENABLE_HYSTERESIS (   acmp,
  u32ChNum 
)

This macro is used to enable hysteresis function and set hysteresis to 30mV.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

Definition at line 123 of file acmp.h.

◆ ACMP_ENABLE_INT

#define ACMP_ENABLE_INT (   acmp,
  u32ChNum 
)

This macro is used to enable interrupt.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set ACMPIE bit of ACMP_CTL register to enable interrupt function. If wake-up function is enabled, the wake-up interrupt will be enabled as well.

Definition at line 158 of file acmp.h.

◆ ACMP_ENABLE_OUTPUT_INVERSE

#define ACMP_ENABLE_OUTPUT_INVERSE (   acmp,
  u32ChNum 
)

This macro is used to enable output inverse function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set ACMPOINV bit of ACMP_CTL register to enable output inverse function.

Definition at line 89 of file acmp.h.

◆ ACMP_ENABLE_WAKEUP

#define ACMP_ENABLE_WAKEUP (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP wake-up function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set WKEN (ACMP_CTL[16]) to enable ACMP wake-up function.

Definition at line 238 of file acmp.h.

◆ ACMP_ENABLE_WINDOW_COMPARE

#define ACMP_ENABLE_WINDOW_COMPARE (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP window compare mode.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set WCMPSEL (ACMP_CTL[18]) to enable ACMP window compare mode. When window compare mode is enabled, user can connect the specific analog voltage source to either the positive inputs of both comparators or the negative inputs of both comparators. The upper bound and lower bound of the designated range are determined by the voltages applied to the other inputs of both comparators. If the output of a comparator is low and the other comparator outputs high, which means two comparators implies the upper and lower bound. User can directly monitor a specific analog voltage source via ACMPWO (ACMP_STATUS[16]).

Definition at line 381 of file acmp.h.

◆ ACMP_ENABLE_WINDOW_LATCH

#define ACMP_ENABLE_WINDOW_LATCH (   acmp,
  u32ChNum 
)

This macro is used to enable ACMP window latch mode.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
None

This macro will set WLATEN (ACMP_CTL[17]) to enable ACMP window latch mode. When ACMP0/1_WLAT pin is at high level, ACMPO0/1 passes through window latch block; when ACMP0/1_WLAT pin is at low level, the output of window latch block, WLATOUT, is frozen.

Definition at line 354 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 pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
ACMP interrupt occurred (1) or not (0)

This macro will return the ACMP interrupt flag.

Definition at line 208 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 pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
Returns
ACMP output value

This macro will return the ACMP output value.

Definition at line 198 of file acmp.h.

◆ ACMP_SELECT_CRV_SRC

#define ACMP_SELECT_CRV_SRC (   acmp,
  u32Src 
)

This macro is used to select the source of CRV.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32Srcis the source of CRV. Including:
Returns
None

The source of CRV can be VDDA or internal reference voltage. The internal reference voltage level is determined by SYS_VREFCTL register.

Definition at line 327 of file acmp.h.

◆ ACMP_SELECT_INT_COND

#define ACMP_SELECT_INT_COND (   acmp,
  u32ChNum,
  u32Cond 
)

This macro is used to select ACMP interrupt condition.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
[in]u32CondComparator interrupt condition selection. Including:
Returns
None

The ACMP output interrupt condition can be rising edge, falling edge or any edge.

Definition at line 341 of file acmp.h.

◆ ACMP_SELECT_P

#define ACMP_SELECT_P (   acmp,
  u32ChNum,
  u32Pin 
)

This macro is used to select ACMP positive input pin.

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

This macro will set POSSEL (ACMP_CTL[7:6]) to determine the comparator positive input pin.

Definition at line 263 of file acmp.h.

◆ ACMP_SET_FILTER

#define ACMP_SET_FILTER (   acmp,
  u32ChNum,
  u32Cnt 
)

This macro is used to set ACMP filter function.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
[in]u32Cntis comparator filter count setting.
Returns
None

When ACMP output filter function is enabled, the output sampling count is determined by FILTSEL (ACMP_CTL[15:13]).

Definition at line 302 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]acmpThe pointer of the specified ACMP module
[in]u32ChNumThe ACMP number
[in]u32Srcis comparator negative input selection. Including:
Returns
None

This macro will set NEGSEL (ACMP_CTL[5:4]) to determine the source of negative input.

Definition at line 114 of file acmp.h.

Function Documentation

◆ ACMP_Close()

void ACMP_Close ( ACMP_T acmp,
uint32_t  u32ChNum 
)

Close analog comparator.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumComparator number.
Returns
None

This function will clear ACMPEN bit of ACMP_CTL register to disable analog comparator.

Definition at line 61 of file acmp.c.

◆ ACMP_Open()

void ACMP_Open ( ACMP_T acmp,
uint32_t  u32ChNum,
uint32_t  u32NegSrc,
uint32_t  u32HysSel 
)

Configure the specified ACMP module.

Parameters
[in]acmpThe pointer of the specified ACMP module
[in]u32ChNumComparator number.
[in]u32NegSrcComparator negative input selection. Including:
[in]u32HysSelThe hysteresis function option. Including:
Returns
None

Configure hysteresis function, select the source of negative input and enable analog comparator.

Definition at line 46 of file acmp.c.