LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CHIP: LPC8xx ACMP Driver

Detailed Description

This driver provides Analog comparator driver support for the device. The driver requires the following IP drivers:
IP: Analog comparator driver

Enumerations

enum  CHIP_ACMP_POS_INPUT_T { ACMP_POSIN_VLO = (0 << 8), ACMP_POSIN_ACMP_I1 = (1 << 8), ACMP_POSIN_ACMP_I2 = (2 << 8), ACMP_POSIN_INT_REF = (6 << 8) }
 
enum  CHIP_ACMP_NEG_INPUT_T { ACMP_NEGIN_VLO = (0 << 11), ACMP_NEGIN_ACMP_I1 = (1 << 11), ACMP_NEGIN_ACMP_I2 = (2 << 11), ACMP_NEGIN_INT_REF = (6 << 11) }
 

Functions

void Chip_ACMP_Init (LPC_CMP_T *pACMP)
 Initializes the ACMP.
 
void Chip_ACMP_Deinit (LPC_CMP_T *pACMP)
 Deinitializes the ACMP.
 
STATIC INLINE uint32_t Chip_ACMP_GetCompStatus (LPC_CMP_T *pACMP)
 Returns the current comparator status.
 
STATIC INLINE void Chip_ACMP_EdgeClear (LPC_CMP_T *pACMP)
 Clears the ACMP interrupt (EDGECLR bit)
 
STATIC INLINE void Chip_ACMP_SetEdgeSelection (LPC_CMP_T *pACMP, IP_ACMP_001_EDGESEL_T edgeSel)
 Sets up ACMP edge selection.
 
STATIC INLINE void Chip_ACMP_EnableSyncCompOut (LPC_CMP_T *pACMP)
 Synchronizes Comparator output to bus clock.
 
STATIC INLINE void Chip_ACMP_DisableSyncCompOut (LPC_CMP_T *pACMP)
 Sets comparator output to be used directly (no sync)
 
STATIC INLINE void Chip_ACMP_SetPosVoltRef (LPC_CMP_T *pACMP, CHIP_ACMP_POS_INPUT_T Posinput)
 Selects positive voltage input.
 
STATIC INLINE void Chip_ACMP_SetNegVoltRef (LPC_CMP_T *pACMP, CHIP_ACMP_NEG_INPUT_T Neginput)
 Selects negative voltage input.
 
STATIC INLINE void Chip_ACMP_SetHysteresis (LPC_CMP_T *pACMP, IP_ACMP_HYS_001_T hys)
 Selects hysteresis level.
 
STATIC INLINE void Chip_ACMP_SetupAMCPRefs (LPC_CMP_T *pACMP, IP_ACMP_001_EDGESEL_T edgeSel, CHIP_ACMP_POS_INPUT_T Posinput, CHIP_ACMP_NEG_INPUT_T Neginput, IP_ACMP_HYS_001_T hys)
 Helper function for setting up ACMP control.
 
STATIC INLINE void Chip_ACMP_SetupVoltLadder (LPC_CMP_T *pACMP, uint32_t ladsel, bool ladrefVDDCMP)
 Sets up voltage ladder.
 
STATIC INLINE void Chip_ACMP_EnableVoltLadder (LPC_CMP_T *pACMP)
 Enables voltage ladder.
 
STATIC INLINE void Chip_ACMP_DisableVoltLadder (LPC_CMP_T *pACMP)
 Disables voltage ladder.
 

Enumeration Type Documentation

Analog Comparator negative input values

Enumerator:
ACMP_NEGIN_VLO 
ACMP_NEGIN_ACMP_I1 
ACMP_NEGIN_ACMP_I2 
ACMP_NEGIN_INT_REF 

Definition at line 60 of file acmp_8xx.h.

Analog Comparator positive input values

Enumerator:
ACMP_POSIN_VLO 
ACMP_POSIN_ACMP_I1 
ACMP_POSIN_ACMP_I2 
ACMP_POSIN_INT_REF 

Definition at line 50 of file acmp_8xx.h.

Function Documentation

void Chip_ACMP_Deinit ( LPC_CMP_T pACMP)

Deinitializes the ACMP.

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 63 of file acmp_8xx.c.

STATIC INLINE void Chip_ACMP_DisableSyncCompOut ( LPC_CMP_T pACMP)

Sets comparator output to be used directly (no sync)

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 127 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_DisableVoltLadder ( LPC_CMP_T pACMP)

Disables voltage ladder.

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 210 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_EdgeClear ( LPC_CMP_T pACMP)

Clears the ACMP interrupt (EDGECLR bit)

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 96 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_EnableSyncCompOut ( LPC_CMP_T pACMP)

Synchronizes Comparator output to bus clock.

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 117 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_EnableVoltLadder ( LPC_CMP_T pACMP)

Enables voltage ladder.

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 200 of file acmp_8xx.h.

STATIC INLINE uint32_t Chip_ACMP_GetCompStatus ( LPC_CMP_T pACMP)

Returns the current comparator status.

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Status is an Or'ed value of ACMP_COMPSTAT_BIT or ACMP_COMPEDGE_BIT

Definition at line 86 of file acmp_8xx.h.

void Chip_ACMP_Init ( LPC_CMP_T pACMP)

Initializes the ACMP.

Parameters
pACMP: Pointer to Analog Comparator block
Returns
Nothing

Definition at line 51 of file acmp_8xx.c.

STATIC INLINE void Chip_ACMP_SetEdgeSelection ( LPC_CMP_T pACMP,
IP_ACMP_001_EDGESEL_T  edgeSel 
)

Sets up ACMP edge selection.

Parameters
pACMP: Pointer to Analog Comparator block
edgeSel: Edge selection value
Returns
Nothing

Definition at line 107 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_SetHysteresis ( LPC_CMP_T pACMP,
IP_ACMP_HYS_001_T  hys 
)

Selects hysteresis level.

Parameters
pACMP: Pointer to Analog Comparator block
hys: Selected Hysteresis level
Returns
Nothing

Definition at line 160 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_SetNegVoltRef ( LPC_CMP_T pACMP,
CHIP_ACMP_NEG_INPUT_T  Neginput 
)

Selects negative voltage input.

Parameters
pACMP: Pointer to Analog Comparator block
Neginput: one of the negative input voltage sources
Returns
Nothing

Definition at line 149 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_SetPosVoltRef ( LPC_CMP_T pACMP,
CHIP_ACMP_POS_INPUT_T  Posinput 
)

Selects positive voltage input.

Parameters
pACMP: Pointer to Analog Comparator block
Posinput: one of the positive input voltage sources
Returns
Nothing

Definition at line 138 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_SetupAMCPRefs ( LPC_CMP_T pACMP,
IP_ACMP_001_EDGESEL_T  edgeSel,
CHIP_ACMP_POS_INPUT_T  Posinput,
CHIP_ACMP_NEG_INPUT_T  Neginput,
IP_ACMP_HYS_001_T  hys 
)

Helper function for setting up ACMP control.

Parameters
pACMP: Pointer to Analog Comparator block
edgeSel: Edge selection value
Posinput: one of the positive input voltage sources
Neginput: one of the negative input voltage sources
hys: Selected Hysteresis level
Returns
Nothing

Definition at line 174 of file acmp_8xx.h.

STATIC INLINE void Chip_ACMP_SetupVoltLadder ( LPC_CMP_T pACMP,
uint32_t  ladsel,
bool  ladrefVDDCMP 
)

Sets up voltage ladder.

Parameters
pACMP: Pointer to Analog Comparator block
ladsel: Voltage ladder value (0 .. 31)
ladrefVDDCMP: Selects the reference voltage Vref for the voltage ladder : false for VDD, true for VDDCMP pin
Returns
Nothing

Definition at line 190 of file acmp_8xx.h.