| 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: Analog comparator driver
IP drivers: Common drivers used on multiple NXP devices

## Detailed Description

## Data Structures
struct | ACMP_001_T
| Analog Comparator register block structure. More...

## Macros
#define | ACMP_COMPSA_BIT (1 << 6) /* Comparator output control bit */
#define | ACMP_COMPSTAT_BIT (1 << 21) /* Comparator status, reflects the state of the comparator output */
#define | ACMP_COMPEDGE_BIT (1 << 23) /* Comparator edge-detect status */
#define | ACMP_LADENAB_BIT (1 << 0) /* Voltage ladder enable bit */

## Enumerations
enum | IP_ACMP_001_EDGESEL_T { ACMP_EDGESEL_FALLING = (0 << 3), ACMP_EDGESEL_RISING = (1 << 3), ACMP_EDGESEL_BOTH = (2 << 3) }
enum | IP_ACMP_HYS_001_T { ACMP_HYS_NONE = (0 << 25), ACMP_HYS_5MV = (1 << 25), ACMP_HYS_10MV = (2 << 25), ACMP_HYS_20MV = (3 << 25) }

## Functions
STATIC INLINE void | IP_ACMP_Init (ACMP_001_T *pACMP)
| Initializes the ACMP.
STATIC INLINE void | IP_ACMP_Deinit (ACMP_001_T *pACMP)
| De-initializes the ACMP.
STATIC INLINE uint32_t | IP_ACMP_GetCompStatus (ACMP_001_T *pACMP)
| Returns the current comparator status.
void | IP_ACMP_EdgeClear (ACMP_001_T *pACMP)
| Clears the ACMP interrupt (EDGECLR bit)
void | IP_ACMP_SetEdgeSelection (ACMP_001_T *pACMP, IP_ACMP_001_EDGESEL_T edgeSel)
| Sets up ACMP edge selection.
STATIC INLINE void | IP_ACMP_EnableSyncCompOut (ACMP_001_T *pACMP)
| Synchronizes Comparator output to bus clock.
STATIC INLINE void | IP_ACMP_DisableSyncCompOut (ACMP_001_T *pACMP)
| Sets comparator output to be used directly (no sync)
void | IP_ACMP_SetPosVoltRef (ACMP_001_T *pACMP, uint32_t Posinput)
| Selects positive voltage input.
void | IP_ACMP_SetNegVoltRef (ACMP_001_T *pACMP, uint32_t Neginput)
| Selects negative voltage input.
void | IP_ACMP_SetHysteresis (ACMP_001_T *pACMP, IP_ACMP_HYS_001_T hys)
| Selects hysteresis level.
void | IP_ACMP_SetupAMCPRefs (ACMP_001_T *pACMP, IP_ACMP_001_EDGESEL_T edgeSel, uint32_t Posinput, uint32_t Neginput, IP_ACMP_HYS_001_T hys)
| Helper function for setting up ACMP control.
void | IP_ACMP_SetupVoltLadder (ACMP_001_T *pACMP, uint32_t ladsel, bool ladrefVDDCMP)
| Sets up voltage ladder.
STATIC INLINE void | IP_ACMP_EnableVoltLadder (ACMP_001_T *pACMP)
| Enables voltage ladder.
STATIC INLINE void | IP_ACMP_DisableVoltLadder (ACMP_001_T *pACMP)
| Disables voltage ladder.

## Macro Definition Documentation

#define ACMP_COMPEDGE_BIT (1 << 23) /* Comparator edge-detect status */

Definition at line 57 of file acmp_001.h.

#define ACMP_COMPSA_BIT (1 << 6) /* Comparator output control bit */

Definition at line 55 of file acmp_001.h.

#define ACMP_COMPSTAT_BIT (1 << 21) /* Comparator status, reflects the state of the comparator output */

Definition at line 56 of file acmp_001.h.

#define ACMP_LADENAB_BIT (1 << 0) /* Voltage ladder enable bit */

Definition at line 58 of file acmp_001.h.

## Enumeration Type Documentation

enum IP_ACMP_001_EDGESEL_T

Edge selection for comparator

Enumerator:

  ACMP_EDGESEL_FALLING |
  ACMP_EDGESEL_RISING |
  ACMP_EDGESEL_BOTH |

Definition at line 61 of file acmp_001.h.

enum IP_ACMP_HYS_001_T

Hysteresis selection for comparator

Enumerator:

  ACMP_HYS_NONE |
  ACMP_HYS_5MV |
  ACMP_HYS_10MV |
  ACMP_HYS_20MV |

Definition at line 68 of file acmp_001.h.

## Function Documentation

STATIC INLINE void IP_ACMP_Deinit | ( | ACMP_001_T * | pACMP | ) |

De-initializes the ACMP.

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 87 of file acmp_001.h.

STATIC INLINE void IP_ACMP_DisableSyncCompOut | ( | ACMP_001_T * | pACMP | ) |

Sets comparator output to be used directly (no sync)

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 129 of file acmp_001.h.

STATIC INLINE void IP_ACMP_DisableVoltLadder | ( | ACMP_001_T * | pACMP | ) |

Disables voltage ladder.

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 203 of file acmp_001.h.

void IP_ACMP_EdgeClear | ( | ACMP_001_T * | pACMP | ) |

Clears the ACMP interrupt (EDGECLR bit)

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 56 of file acmp_001.c.

STATIC INLINE void IP_ACMP_EnableSyncCompOut | ( | ACMP_001_T * | pACMP | ) |

Synchronizes Comparator output to bus clock.

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 119 of file acmp_001.h.

STATIC INLINE void IP_ACMP_EnableVoltLadder | ( | ACMP_001_T * | pACMP | ) |

Enables voltage ladder.

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 193 of file acmp_001.h.

STATIC INLINE uint32_t IP_ACMP_GetCompStatus | ( | ACMP_001_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 94 of file acmp_001.h.

STATIC INLINE void IP_ACMP_Init | ( | ACMP_001_T * | pACMP | ) |

Initializes the ACMP.

Parameters

  pACMP | : Pointer to Analog Comparator block

Returns
  Nothing

Definition at line 80 of file acmp_001.h.

void IP_ACMP_SetEdgeSelection | ( | ACMP_001_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 66 of file acmp_001.c.

void IP_ACMP_SetHysteresis | ( | ACMP_001_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 93 of file acmp_001.c.

void IP_ACMP_SetNegVoltRef | ( | ACMP_001_T * | pACMP,
|  | uint32_t | Neginput
| ) |  |

Selects negative voltage input.

Parameters

  pACMP | : Pointer to Analog Comparator block
  Neginput | : one of the negative input voltage sources

Returns
  Nothing

Note
  The caller must pre-shift the Neginput value to the correct bitfield location in the CTRL register.

Definition at line 84 of file acmp_001.c.

void IP_ACMP_SetPosVoltRef | ( | ACMP_001_T * | pACMP,
|  | uint32_t | Posinput
| ) |  |

Selects positive voltage input.

Parameters

  pACMP | : Pointer to Analog Comparator block
  Posinput | : one of the positive input voltage sources

Returns
  Nothing

Note
  The caller must pre-shift the Posinput value to the correct bitfield location in the CTRL register.

Definition at line 75 of file acmp_001.c.

void IP_ACMP_SetupAMCPRefs | ( | ACMP_001_T * | pACMP,
|  | IP_ACMP_001_EDGESEL_T | edgeSel,
|  | uint32_t | Posinput,
|  | uint32_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

Note
  The caller must pre-shift the Posinput and Neginput values to the correct bitfield location in the CTRL register.

Definition at line 102 of file acmp_001.c.

void IP_ACMP_SetupVoltLadder | ( | ACMP_001_T * | pACMP,
|  | uint32_t | ladsel,
|  | bool | ladrefVDDCMP
| ) |  |

Sets up voltage ladder.

Parameters

  pACMP | : Pointer to Analog Comparator block
  ladsel | : Voltage ladder value
  ladrefVDDCMP | : Selects the reference voltage Vref for the voltage ladder : false for VDD, true for VDDCMP pin

Returns
  Nothing

Note
  The caller must pre-shift the ladsel value to the correct bitfield location in the LAD register.

Definition at line 114 of file acmp_001.c.