MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
CMP: Niobe4 cmp driver

Overview

The MCUXpresso SDK provides a peripheral driver for the cmp driver module of MCUXpresso SDK devices.

Data Structures

struct  cmp_config_t
 cmp configurataions More...
 

Enumerations

enum  _cmp_vref_select {
  KCMP_VREFSelectVDDA = 1U,
  KCMP_VREFSelectInternalVREF = 0U
}
 VREF select. More...
 
enum  cmp_interrupt_type_t {
  kCMP_EdgeDisable = 0U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_EdgeRising = 2U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_EdgeFalling = 4U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_EdgeRisingFalling = 6U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_LevelDisable = 1U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_LevelHigh = 3U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_LevelLow = 5U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT,
  kCMP_LevelDisable1 = 7U << SYSCON_COMP_INT_CTRL_INT_CTRL_SHIFT
}
 cmp interrupt type More...
 
enum  cmp_pmux_input_t {
  kCMP_PInputVREF = 0U << PMC_COMP_PMUX_SHIFT,
  kCMP_PInputP0_0 = 1U << PMC_COMP_PMUX_SHIFT,
  kCMP_PInputP0_9 = 2U << PMC_COMP_PMUX_SHIFT,
  kCMP_PInputP0_18 = 3U << PMC_COMP_PMUX_SHIFT,
  kCMP_PInputP1_14 = 4U << PMC_COMP_PMUX_SHIFT,
  kCMP_PInputP2_23 = 5U << PMC_COMP_PMUX_SHIFT
}
 cmp Pmux input source More...
 
enum  cmp_nmux_input_t {
  kCMP_NInputVREF = 0U << PMC_COMP_NMUX_SHIFT,
  kCMP_NInputP0_0 = 1U << PMC_COMP_NMUX_SHIFT,
  kCMP_NInputP0_9 = 2U << PMC_COMP_NMUX_SHIFT,
  kCMP_NInputP0_18 = 3U << PMC_COMP_NMUX_SHIFT,
  kCMP_NInputP1_14 = 4U << PMC_COMP_NMUX_SHIFT,
  kCMP_NInputP2_23 = 5U << PMC_COMP_NMUX_SHIFT
}
 cmp Nmux input source More...
 

Driver version

#define FSL_CMP_DRIVER_VERSION   (MAKE_VERSION(2U, 0U, 0U))
 Driver version 2.0.0. More...
 

Cmp Initialization and deinitialization

void CMP_Init (cmp_config_t *config)
 CMP intialization. More...
 
void CMP_Deinit (void)
 CMP deintialization. More...
 

cmp functionality

static void CMP_PmuxSelect (cmp_pmux_input_t pmux_select_source)
 select input source for pmux. More...
 
static void CMP_NmuxSelect (cmp_nmux_input_t nmux_select_source)
 select input source for nmux. More...
 
static void CMP_EnableLowePowerMode (bool enable)
 switch cmp work mode. More...
 
static void CMP_SetRefStep (uint32_t step)
 Control reference voltage step, per steps of (VREFINPUT/31). More...
 
static void CMP_EnableHysteresis (bool enable)
 cmp enable hysteresis.
 
static void CMP_VREFSelect (uint32_t select)
 VREF select between internal VREF and VDDA (for the resistive ladder). More...
 
static uint32_t CMP_GetOutput (void)
 comparator analog output. More...
 

cmp interrupt

static void CMP_EnableInterrupt (void)
 cmp enable interrupt.
 
static void CMP_DisableInterrupt (void)
 cmp disable interrupt.
 
static void CMP_InterruptSourceSelect (bool enable)
 Select which Analog comparator output (filtered or un-filtered) is used for interrupt detection. More...
 
static bool CMP_GetStatus (void)
 cmp get status. More...
 
static void CMP_ClearStatus (void)
 cmp clear interrupt status.
 
static void CMP_InterruptTypeSelect (cmp_interrupt_type_t cmp_interrupt_type)
 Comparator interrupt type select. More...
 
static bool CMP_GetInterruptStatus (void)
 cmp get interrupt status. More...
 

Data Structure Documentation

struct cmp_config_t

Data Fields

bool enHysteris
 low hysteresis
 
bool enLowPower
 low power mode
 
cmp_nmux_input_t nmuxInput
 Nmux input select.
 
cmp_pmux_input_t pmuxInput
 Pmux input select.
 

Macro Definition Documentation

#define FSL_CMP_DRIVER_VERSION   (MAKE_VERSION(2U, 0U, 0U))

Enumeration Type Documentation

Enumerator
KCMP_VREFSelectVDDA 

Select VDDA as VREF.

KCMP_VREFSelectInternalVREF 

select internal VREF as VREF

Enumerator
kCMP_EdgeDisable 

disable edge sensitive

kCMP_EdgeRising 

Edge sensitive, falling edge.

kCMP_EdgeFalling 

Edge sensitive, rising edge.

kCMP_EdgeRisingFalling 

Edge sensitive, rising and falling edge.

kCMP_LevelDisable 

disable level sensitive

kCMP_LevelHigh 

Level sensitive, high level.

kCMP_LevelLow 

Level sensitive, low level.

kCMP_LevelDisable1 

disable level sensitive

Enumerator
kCMP_PInputVREF 

Cmp Pmux input from VREF.

kCMP_PInputP0_0 

Cmp Pmux input from P0_0.

kCMP_PInputP0_9 

Cmp Pmux input from P0_9.

kCMP_PInputP0_18 

Cmp Pmux input from P0_18.

kCMP_PInputP1_14 

Cmp Pmux input from P1_14.

kCMP_PInputP2_23 

Cmp Pmux input from P2_23.

Enumerator
kCMP_NInputVREF 

Cmp Nmux input from VREF.

kCMP_NInputP0_0 

Cmp Nmux input from P0_0.

kCMP_NInputP0_9 

Cmp Nmux input from P0_9.

kCMP_NInputP0_18 

Cmp Nmux input from P0_18.

kCMP_NInputP1_14 

Cmp Nmux input from P1_14.

kCMP_NInputP2_23 

Cmp Nmux input from P2_23.

Function Documentation

void CMP_Init ( cmp_config_t config)

Note: The cmp initial function not responsible for cmp power, application shall handle it.

Parameters
configinit configurations.
void CMP_Deinit ( void  )

Note: The cmp deinit function not responsible for cmp power, application shall handle it.

static void CMP_PmuxSelect ( cmp_pmux_input_t  pmux_select_source)
inlinestatic
Parameters
pmux_select_sourcereference cmp_pmux_input_t above.
static void CMP_NmuxSelect ( cmp_nmux_input_t  nmux_select_source)
inlinestatic
Parameters
nmux_select_sourcereference cmp_nmux_input_t above.
static void CMP_EnableLowePowerMode ( bool  enable)
inlinestatic
Parameters
enabletrue is enter low power mode, false is enter fast mode
static void CMP_SetRefStep ( uint32_t  step)
inlinestatic
Parameters
stepreference voltage step, per steps of (VREFINPUT/31).
static void CMP_VREFSelect ( uint32_t  select)
inlinestatic
Parameters
select1 is Select VDDA, 0 is Select internal VREF.
static uint32_t CMP_GetOutput ( void  )
inlinestatic
Returns
1 indicates p is greater than n, 0 indicates n is greater than p.
static void CMP_InterruptSourceSelect ( bool  enable)
inlinestatic
Parameters
enabletrue is Select Analog Comparator raw output (unfiltered) as input for interrupt detection. false is Select Analog Comparator filtered output as input for interrupt detection.
static bool CMP_GetStatus ( void  )
inlinestatic
Returns
true is interrupt pending, false is no interrupt pending.
static void CMP_InterruptTypeSelect ( cmp_interrupt_type_t  cmp_interrupt_type)
inlinestatic
Parameters
typereference cmp_interrupt_type_t.
static bool CMP_GetInterruptStatus ( void  )
inlinestatic
Returns
true is interrupt pending, false is no interrupt pending.