| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
IP: Comparator register block and driver
IP drivers: Common drivers used on multiple NXP devices

## Detailed Description

Comparator

## Data Structures
struct | IP_CMP_001_T
| Comparator (CMP) register block structure. More...

## Macros
#define | CMP_NUM 2
#define | CMP_CTRL_BITMASK (0xF30F)
#define | CMP_CTRL_PD_IREF_BITMASK (0x03)
#define | CMP_CTRL_PD_IREF(n) ((((uint32_t) (n)) & 0x03))
#define | CMP_CTRL_PD_VBG_BITMASK (((uint32_t) 0x03) << 2)
#define | CMP_CTRL_PD_VBG(n) ((((uint32_t) (n)) & 0x03) << 2)
#define | CMP_CTRL_ROSC_BITMASK ((uint32_t) 0x300)
#define | CMP_CTRL_ROSCCTL_CMP1 (0x00)
#define | CMP_CTRL_ROSCCTL_CMP0 (((uint32_t) 0x01) << 8)
#define | CMP_CTRL_EXT_RESET_INTERNAL (0x00)
#define | CMP_CTRL_EXT_RESET_CMPRESET (((uint32_t) 0x01) << 9)
#define | CMP_CTRL_TIMERCAPTURE_BITMASK ((uint32_t) 0xF000)
#define | CMP_CTRL_T0CAP2_0LEVEL (0x00)
#define | CMP_CTRL_T0CAP2_1LEVEL (((uint32_t) 0x01) << 12)
#define | CMP_CTRL_T0CAP3_0EDGE (0x00)
#define | CMP_CTRL_T0CAP3_1EDGE (((uint32_t) 0x01) << 13)
#define | CMP_CTRL_T1CAP2_1EDGE (0x00)
#define | CMP_CTRL_T1CAP2_0LEVEL (((uint32_t) 0x01) << 14)
#define | CMP_CTRL_T1CAP3_1LEVEL (0x00)
#define | CMP_CTRL_T1CAP3_0EDGE (((uint32_t) 0x01) << 15)
#define | CMP_CTRLx_BITMASK ((uint32_t) 0x1F7FF77F)
#define | CMP_CTRLx_EN_BITMASK (0x03)
#define | CMP_CTRLx_EN(n) ((((uint32_t) (n)) & 0x03))
#define | CMP_CTRLx_OE (((uint32_t) 0x01) << 2)
#define | CMP_CTRLx_STAT (((uint32_t) 0x01) << 3)
#define | CMP_CTRLx_VM_BITMASK (((uint32_t) 0x07) << 4)
#define | CMP_CTRLx_VM(n) ((((uint32_t) (n)) & 0x07) << 4)
#define | CMP_CTRLx_VP_BITMASK (((uint32_t) 0x07) << 8)
#define | CMP_CTRLx_VP(n) ((((uint32_t) (n)) & 0x07) << 8)
#define | CMP_CTRLx_SYNC (((uint32_t) 0x01) << 12)
#define | CMP_CTRLx_HYS_BITMASK (((uint32_t) 0x03) << 13)
#define | CMP_CTRLx_HYS(n) ((((uint32_t) (n)) & 0x03) << 13)
#define | CMP_CTRLx_INTCTRL_BITMASK ((uint32_t) 0x78000)
#define | CMP_CTRLx_INTPOL_NORMAL (0x00)
#define | CMP_CTRLx_INTPOL_INV (((uint32_t) 0x01) << 15)
#define | CMP_CTRLx_INTTYPE_EDGE (0x00)
#define | CMP_CTRLx_INTTYPE_LEVEL (((uint32_t) 0x01) << 16)
#define | CMP_CTRLx_INTEDGE_BITMASK (((uint32_t) 0x03) << 17)
#define | CMP_CTRLx_INTEDGE(n) ((((uint32_t) (n)) & 0x03) << 17)
#define | CMP_CTRLx_INTFLAG (((uint32_t) 0x01) << 19)
#define | CMP_CTRLx_VLADEN_BITMASK (((uint32_t) 0x03) << 20)
#define | CMP_CTRLx_VLADEN(n) ((((uint32_t) (n)) & 0x03) << 20)
#define | CMP_CTRLx_VLADREF_VREFCMP (0x00)
#define | CMP_CTRLx_VLADREF_VDDA (((uint32_t) 0x01) << 22)
#define | CMP_CTRLx_VSEL_BITMASK ((uint32_t) ((0x1F) << 24))
#define | CMP_CTRLx_VSEL(n) ((((uint32_t) (n)) & 0x1F) << 24)

## Enumerations
enum | IP_CMP_ENCTRL_T { CMP_ENCTRL_DISABLE, CMP_ENCTRL_DIS_IN_DS_PWD, CMP_ENCTRL_DIS_IN_PWD, CMP_ENCTRL_ENABLE }
| Comparator control definition. More...
enum | IP_CMP_INPUT_T { CMP_INPUT_VREF_DIV, CMP_INPUT_CMPx_IN0, CMP_INPUT_CMPx_IN1, CMP_INPUT_CMPx_IN2, CMP_INPUT_CMPx_IN3, CMP_INPUT_CMP_OTHER_IN0, CMP_INPUT_INTERNAL_09VBG }
| Comparator VM/VP input definitions. More...
enum | IP_CMP_HYS_T { CMP_HYS_NONE = CMP_CTRLx_HYS(0), CMP_HYS_5MV = CMP_CTRLx_HYS(1), CMP_HYS_10MV = CMP_CTRLx_HYS(2), CMP_HYS_15MV = CMP_CTRLx_HYS(3) }
| Comparator hysteresis selection definitions. More...
enum | IP_CMP_INTEDGE_T { CMP_INTEDGE_FALLING = CMP_CTRLx_INTEDGE(0), CMP_INTEDGE_RISING = CMP_CTRLx_INTEDGE(1), CMP_INTEDGE_BOTH = CMP_CTRLx_INTEDGE(2) }
| Comparator interrupt edge selection definitions. More...

## Functions
STATIC INLINE void | IP_CMP_Init (IP_CMP_001_T *pCMP)
| Initializes the CMP.
STATIC INLINE void | IP_CMP_DeInit (IP_CMP_001_T *pCMP)
| De-initializes the CMP.
STATIC INLINE void | IP_CMP_EnableCurrentSrc (IP_CMP_001_T *pCMP, IP_CMP_ENCTRL_T en)
| Enables comparator current source.
STATIC INLINE void | IP_CMP_EnableBandGap (IP_CMP_001_T *pCMP, IP_CMP_ENCTRL_T en)
| Enables comparator bandgap reference.
STATIC INLINE void | IP_CMP_ControlROSC (IP_CMP_001_T *pCMP, uint32_t flag)
| Control CMP_ROSC.
STATIC INLINE void | IP_CMP_SetTimerCapInput (IP_CMP_001_T *pCMP, uint32_t flag)
| Control CMP_ROSC.
STATIC INLINE void | IP_CMP_SetupVoltLadder (IP_CMP_001_T *pCMP, uint8_t id, uint16_t ladSel, uint32_t flag)
| Sets up voltage ladder.
STATIC INLINE void | IP_CMP_EnableVoltLadder (IP_CMP_001_T *pCMP, uint8_t id, IP_CMP_ENCTRL_T en)
| Enables voltage ladder.
STATIC INLINE void | IP_CMP_SetPosVoltRef (IP_CMP_001_T *pCMP, uint8_t id, IP_CMP_INPUT_T input)
| Selects positive voltage input.
STATIC INLINE void | IP_CMP_SetNegVoltRef (IP_CMP_001_T *pCMP, uint8_t id, IP_CMP_INPUT_T input)
| Selects negative voltage input.
STATIC INLINE void | IP_CMP_SetHysteresis (IP_CMP_001_T *pCMP, uint8_t id, IP_CMP_HYS_T hys)
| Selects hysteresis level.
STATIC INLINE void | IP_CMP_Enable (IP_CMP_001_T *pCMP, uint8_t id, IP_CMP_ENCTRL_T en)
| Enables specified comparator.
STATIC INLINE FlagStatus | IP_CMP_GetCmpStatus (IP_CMP_001_T *pCMP, uint8_t id)
| Returns the current comparator status.
STATIC INLINE void | IP_CMP_EnableOuput (IP_CMP_001_T *pCMP, uint8_t id)
| Enable comparator output.
STATIC INLINE void | IP_CMP_DisableOutput (IP_CMP_001_T *pCMP, uint8_t id)
| Disable comparator output.
STATIC INLINE void | IP_CMP_EnableSyncCmpOut (IP_CMP_001_T *pCMP, uint8_t id)
| Synchronizes Comparator output to bus clock.
STATIC INLINE void | IP_CMP_DisableSyncCmpOut (IP_CMP_001_T *pCMP, uint8_t id)
| Sets comparator output to be used directly (no sync)
STATIC INLINE void | IP_CMP_ConfigInt (IP_CMP_001_T *pCMP, uint8_t id, uint32_t intFlag, IP_CMP_INTEDGE_T edgeSel)
| Sets up comparator interrupt.
STATIC INLINE FlagStatus | IP_CMP_GetIntStatus (IP_CMP_001_T *pCMP, uint8_t id)
| Get the CMP interrupt status.
STATIC INLINE void | IP_CMP_CMP_ClearIntStatus (IP_CMP_001_T *pCMP, uint8_t id)
| Clears the CMP interrupt status.

## Macro Definition Documentation

#define CMP_CTRL_BITMASK (0xF30F)

The comparator current source control bitmask

Definition at line 69 of file cmp_001.h.

#define CMP_CTRL_EXT_RESET_CMPRESET (((uint32_t) 0x01) << 9)

Timer Capture input control bitmask

Definition at line 89 of file cmp_001.h.

#define CMP_CTRL_EXT_RESET_INTERNAL (0x00)

The CMP_ROSC output is reset by the CMP_RESET input

Definition at line 87 of file cmp_001.h.

#define CMP_CTRL_PD_IREF | ( |  | n | ) | ((((uint32_t) (n)) & 0x03))

The comparator bandgap reference control bitmask

Definition at line 73 of file cmp_001.h.

#define CMP_CTRL_PD_IREF_BITMASK (0x03)

Control the comparator current source (n is IP_CMP_ENCTRL_T value)

Definition at line 71 of file cmp_001.h.

#define CMP_CTRL_PD_VBG | ( |  | n | ) | ((((uint32_t) (n)) & 0x03) << 2)

The CMP_ROSC ouput control bitmask

Definition at line 78 of file cmp_001.h.

#define CMP_CTRL_PD_VBG_BITMASK (((uint32_t) 0x03) << 2)

Control the comparator bandgap reference (n is IP_CMP_ENCTRL_T value)

Definition at line 76 of file cmp_001.h.

#define CMP_CTRL_ROSC_BITMASK ((uint32_t) 0x300)

The CMP_ROSC output is set by CMP1, reset by CMP0

Definition at line 81 of file cmp_001.h.

#define CMP_CTRL_ROSCCTL_CMP0 (((uint32_t) 0x01) << 8)

The CMP_ROSC output is reset by the internal chip reset

Definition at line 85 of file cmp_001.h.

#define CMP_CTRL_ROSCCTL_CMP1 (0x00)

The CMP_ROSC output is set by CMP0, reset by CMP1

Definition at line 83 of file cmp_001.h.

#define CMP_CTRL_T0CAP2_0LEVEL (0x00)

Selects the comparator 1 level output as the input for Timer0 capture input 2

Definition at line 93 of file cmp_001.h.

#define CMP_CTRL_T0CAP2_1LEVEL (((uint32_t) 0x01) << 12)

Selects the comparator 0 edge output as the input for Timer0 capture input 3

Definition at line 95 of file cmp_001.h.

#define CMP_CTRL_T0CAP3_0EDGE (0x00)

Selects the comparator 1 edge output as the input for Timer0 capture input 3

Definition at line 97 of file cmp_001.h.

#define CMP_CTRL_T0CAP3_1EDGE (((uint32_t) 0x01) << 13)

Selects the comparator 1 edge output as the input for Timer1 capture input 2

Definition at line 99 of file cmp_001.h.

#define CMP_CTRL_T1CAP2_0LEVEL (((uint32_t) 0x01) << 14)

Selects the comparator 1 level output as the input for Timer1 capture input 3

Definition at line 103 of file cmp_001.h.

#define CMP_CTRL_T1CAP2_1EDGE (0x00)

Selects the comparator 0 level output as the input for Timer1 capture input 2

Definition at line 101 of file cmp_001.h.

#define CMP_CTRL_T1CAP3_0EDGE (((uint32_t) 0x01) << 15)

The comparator x control register Bitmask

Definition at line 107 of file cmp_001.h.

#define CMP_CTRL_T1CAP3_1LEVEL (0x00)

Selects the comparator 0 edge output as the input for Timer1 capture input 3

Definition at line 105 of file cmp_001.h.

#define CMP_CTRL_TIMERCAPTURE_BITMASK ((uint32_t) 0xF000)

Selects the comparator 0 level output as the input for Timer0 capture input 2

Definition at line 91 of file cmp_001.h.

#define CMP_CTRLx_BITMASK ((uint32_t) 0x1F7FF77F)

The comparator x enable bitmask

Definition at line 110 of file cmp_001.h.

#define CMP_CTRLx_EN | ( |  | n | ) | ((((uint32_t) (n)) & 0x03))

Enable the output of compartor x

Definition at line 114 of file cmp_001.h.

#define CMP_CTRLx_EN_BITMASK (0x03)

Control the comparator x (n is IP_CMP_ENCTRL_T value)

Definition at line 112 of file cmp_001.h.

#define CMP_CTRLx_HYS | ( |  | n | ) | ((((uint32_t) (n)) & 0x03) << 13)

Interrupt control bitmask

Definition at line 135 of file cmp_001.h.

#define CMP_CTRLx_HYS_BITMASK (((uint32_t) 0x03) << 13)

Determine the difference required between the comparator inputs before the comparator output switch

Definition at line 133 of file cmp_001.h.

#define CMP_CTRLx_INTCTRL_BITMASK ((uint32_t) 0x78000)

Comparator output is used as-is for generating interrupts.

Definition at line 138 of file cmp_001.h.

#define CMP_CTRLx_INTEDGE | ( |  | n | ) | ((((uint32_t) (n)) & 0x03) << 17)

Comparator interrupt flag

Definition at line 150 of file cmp_001.h.

#define CMP_CTRLx_INTEDGE_BITMASK (((uint32_t) 0x03) << 17)

Select edge on which triggered interrupt is active

Definition at line 148 of file cmp_001.h.

#define CMP_CTRLx_INTFLAG (((uint32_t) 0x01) << 19)

The VLAD Enable bitmask

Definition at line 153 of file cmp_001.h.

#define CMP_CTRLx_INTPOL_INV (((uint32_t) 0x01) << 15)

Comparator x interrupt is edge triggered.

Definition at line 142 of file cmp_001.h.

#define CMP_CTRLx_INTPOL_NORMAL (0x00)

Comparator output is used inverted for generating interrupts.

Definition at line 140 of file cmp_001.h.

#define CMP_CTRLx_INTTYPE_EDGE (0x00)

Comparator x interrupt is level triggered.

Definition at line 144 of file cmp_001.h.

#define CMP_CTRLx_INTTYPE_LEVEL (((uint32_t) 0x01) << 16)

Comparator x interrupt edge control bitmask

Definition at line 146 of file cmp_001.h.

#define CMP_CTRLx_OE (((uint32_t) 0x01) << 2)

The status of compartor x, reflects the comparator x output

Definition at line 117 of file cmp_001.h.

#define CMP_CTRLx_STAT (((uint32_t) 0x01) << 3)

Comparator VM input control bitmask

Definition at line 119 of file cmp_001.h.

#define CMP_CTRLx_SYNC (((uint32_t) 0x01) << 12)

Comparator Hysteresis control bitmask

Definition at line 131 of file cmp_001.h.

#define CMP_CTRLx_VLADEN | ( |  | n | ) | ((((uint32_t) (n)) & 0x03) << 20)

Select VREF_CMP pin as voltage reference for comparator voltage ladder

Definition at line 157 of file cmp_001.h.

#define CMP_CTRLx_VLADEN_BITMASK (((uint32_t) 0x03) << 20)

Control the comparator x (n is IP_CMP_ENCTRL_T value)

Definition at line 155 of file cmp_001.h.

#define CMP_CTRLx_VLADREF_VDDA (((uint32_t) 0x01) << 22)

Volatge ladder value bitmask

Definition at line 162 of file cmp_001.h.

#define CMP_CTRLx_VLADREF_VREFCMP (0x00)

Select VDDA pin as voltage reference for comparator voltage ladder

Definition at line 160 of file cmp_001.h.

#define CMP_CTRLx_VM | ( |  | n | ) | ((((uint32_t) (n)) & 0x07) << 4)

Comparator VP input control bitmask

Definition at line 123 of file cmp_001.h.

#define CMP_CTRLx_VM_BITMASK (((uint32_t) 0x07) << 4)

Select the VM input

Definition at line 121 of file cmp_001.h.

#define CMP_CTRLx_VP | ( |  | n | ) | ((((uint32_t) (n)) & 0x07) << 8)

Synchronize the Comparator x output with the internal bus clock for outpur to other peripherals

Definition at line 128 of file cmp_001.h.

#define CMP_CTRLx_VP_BITMASK (((uint32_t) 0x07) << 8)

Select the VP input

Definition at line 126 of file cmp_001.h.

#define CMP_CTRLx_VSEL | ( |  | n | ) | ((((uint32_t) (n)) & 0x1F) << 24)

Definition at line 166 of file cmp_001.h.

#define CMP_CTRLx_VSEL_BITMASK ((uint32_t) ((0x1F) << 24))

Voltage ladder value for Comparator

Definition at line 164 of file cmp_001.h.

#define CMP_NUM 2

The number of embeded comparators supported

Definition at line 48 of file cmp_001.h.

## Enumeration Type Documentation

enum IP_CMP_ENCTRL_T

Comparator control definition.

Enumerator:

  CMP_ENCTRL_DISABLE | Disable
  CMP_ENCTRL_DIS_IN_DS_PWD | Disable in deep sleep mode and power down mode
  CMP_ENCTRL_DIS_IN_PWD | Disable in power down mode
  CMP_ENCTRL_ENABLE | Enable/Power-up

Definition at line 61 of file cmp_001.h.

enum IP_CMP_HYS_T

Comparator hysteresis selection definitions.

Enumerator:

  CMP_HYS_NONE | No hysteresis (the output will switch as the voltages cross)
  CMP_HYS_5MV | 5mV hysteresis
  CMP_HYS_10MV | 10mV hysteresis
  CMP_HYS_15MV | 15mV hysteresis

Definition at line 184 of file cmp_001.h.

enum IP_CMP_INPUT_T

Comparator VM/VP input definitions.

Enumerator:

  CMP_INPUT_VREF_DIV | Vref divider.
  CMP_INPUT_CMPx_IN0 | Use the input 0 of the comparator
  CMP_INPUT_CMPx_IN1 | Use the input 1 of the comparator
  CMP_INPUT_CMPx_IN2 | Use the input 2 of the comparator
  CMP_INPUT_CMPx_IN3 | Use the input 3 of the comparator
  CMP_INPUT_CMP_OTHER_IN0 | Use the input 0 of the other comparator.
  CMP_INPUT_INTERNAL_09VBG | internal 0.9 V band gap reference.

Definition at line 171 of file cmp_001.h.

enum IP_CMP_INTEDGE_T

Comparator interrupt edge selection definitions.

Enumerator:

  CMP_INTEDGE_FALLING | Interrupt is active on falling edge
  CMP_INTEDGE_RISING | Interrupt is active on rising edge
  CMP_INTEDGE_BOTH | Interrupt is active on falling and rising edges

Definition at line 194 of file cmp_001.h.

## Function Documentation

STATIC INLINE void IP_CMP_CMP_ClearIntStatus | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Clears the CMP interrupt status.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID

Returns
  Nothing

Definition at line 421 of file cmp_001.h.

STATIC INLINE void IP_CMP_ConfigInt | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | uint32_t | intFlag,
|  | IP_CMP_INTEDGE_T | edgeSel
| ) |  |

Sets up comparator interrupt.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  intFlag | : Or-ed value of CMP_CTRLx_INTTYPE_*, CMP_CTRLx_INTPOL_*
  edgeSel | : the edge on which interrupt occurs.

Returns
  Nothing

Definition at line 397 of file cmp_001.h.

STATIC INLINE void IP_CMP_ControlROSC | ( | IP_CMP_001_T * | pCMP,
|  | uint32_t | flag
| ) |  |

Control CMP_ROSC.

Parameters

  pCMP | : Pointer to Comparator Register block
  flag | : Or-ed bit value of CMP_CTRL_ROSCCTL_* and CMP_CTRL_EXT_RESET_*

Returns
  Nothing

Definition at line 242 of file cmp_001.h.

STATIC INLINE void IP_CMP_DeInit | ( | IP_CMP_001_T * | pCMP | ) |

De-initializes the CMP.

Parameters

  pCMP | : Pointer to Comparator Register block

Returns
  Nothing

Definition at line 212 of file cmp_001.h.

STATIC INLINE void IP_CMP_DisableOutput | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Disable comparator output.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID

Returns
  Nothing

Definition at line 362 of file cmp_001.h.

STATIC INLINE void IP_CMP_DisableSyncCmpOut | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Sets comparator output to be used directly (no sync)

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID

Returns
  Nothing

Definition at line 384 of file cmp_001.h.

STATIC INLINE void IP_CMP_Enable | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | IP_CMP_ENCTRL_T | en
| ) |  |

Enables specified comparator.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  en | : Enable mode

Returns
  Nothing

Definition at line 329 of file cmp_001.h.

STATIC INLINE void IP_CMP_EnableBandGap | ( | IP_CMP_001_T * | pCMP,
|  | IP_CMP_ENCTRL_T | en
| ) |  |

Enables comparator bandgap reference.

Parameters

  pCMP | : Pointer to Comparator Register block
  en | : Enable mode

Returns
  Nothing

Definition at line 231 of file cmp_001.h.

STATIC INLINE void IP_CMP_EnableCurrentSrc | ( | IP_CMP_001_T * | pCMP,
|  | IP_CMP_ENCTRL_T | en
| ) |  |

Enables comparator current source.

Parameters

  pCMP | : Pointer to Comparator Register block
  en | : Enable mode

Returns
  Nothing

Definition at line 220 of file cmp_001.h.

STATIC INLINE void IP_CMP_EnableOuput | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Enable comparator output.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID

Returns
  Nothing

Definition at line 351 of file cmp_001.h.

STATIC INLINE void IP_CMP_EnableSyncCmpOut | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Synchronizes Comparator output to bus clock.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID

Returns
  Nothing

Definition at line 373 of file cmp_001.h.

STATIC INLINE void IP_CMP_EnableVoltLadder | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | IP_CMP_ENCTRL_T | en
| ) |  |

Enables voltage ladder.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  en | : Enable mode

Returns
  Nothing

Definition at line 281 of file cmp_001.h.

STATIC INLINE FlagStatus IP_CMP_GetCmpStatus | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Returns the current comparator status.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator Id (0/1)

Returns
  SET/RESET

Definition at line 340 of file cmp_001.h.

STATIC INLINE FlagStatus IP_CMP_GetIntStatus | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id
| ) |  |

Get the CMP interrupt status.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID

Returns
  SET/RESET

Definition at line 410 of file cmp_001.h.

STATIC INLINE void IP_CMP_Init | ( | IP_CMP_001_T * | pCMP | ) |

Initializes the CMP.

Parameters

  pCMP | : Pointer to Comparator Register block

Returns
  Nothing

Definition at line 205 of file cmp_001.h.

STATIC INLINE void IP_CMP_SetHysteresis | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | IP_CMP_HYS_T | hys
| ) |  |

Selects hysteresis level.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  hys | : Selected Hysteresis level

Returns
  Nothing

Definition at line 317 of file cmp_001.h.

STATIC INLINE void IP_CMP_SetNegVoltRef | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | IP_CMP_INPUT_T | input
| ) |  |

Selects negative voltage input.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  input | : Selected input

Returns
  Nothing

Definition at line 305 of file cmp_001.h.

STATIC INLINE void IP_CMP_SetPosVoltRef | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | IP_CMP_INPUT_T | input
| ) |  |

Selects positive voltage input.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  input | : Selected input

Returns
  Nothing

Definition at line 293 of file cmp_001.h.

STATIC INLINE void IP_CMP_SetTimerCapInput | ( | IP_CMP_001_T * | pCMP,
|  | uint32_t | flag
| ) |  |

Control CMP_ROSC.

Parameters

  pCMP | : Pointer to Comparator Register block
  flag | : Or-ed bit value of CMP_CTRL_T*CAP*

Returns
  Nothing

Definition at line 253 of file cmp_001.h.

STATIC INLINE void IP_CMP_SetupVoltLadder | ( | IP_CMP_001_T * | pCMP,
|  | uint8_t | id,
|  | uint16_t | ladSel,
|  | uint32_t | flag
| ) |  |

Sets up voltage ladder.

Parameters

  pCMP | : Pointer to Comparator Register block
  id | : Comparator ID
  ladSel | : Voltage ladder value (0~31).
  flag | :0(CMP_VREF used)/CMP_CTRLx_VLADREF_VDDA (VDDA used)

Returns
  Nothing

Note
  VREF divider 0 = ladSel*VRef0/31

Definition at line 267 of file cmp_001.h.