CC23x0R5DriverLibrary
[lpcmp.h] Low-Power Comparator
Collaboration diagram for [lpcmp.h] Low-Power Comparator:

Macros

#define LPCMP_DIVISION_PATH_N   SYS0_LPCMPCFG_DIVPATH_NSIDE
 Apply voltage divider to the negative input. More...
 
#define LPCMP_DIVISION_PATH_P   SYS0_LPCMPCFG_DIVPATH_PSIDE
 Apply voltage divider to the positive input. More...
 
#define LPCMP_DIVISION_FACTOR_1_1   SYS0_LPCMPCFG_DIV_VAL0
 Apply a 1/1 voltage division ratio. More...
 
#define LPCMP_DIVISION_FACTOR_3_4   SYS0_LPCMPCFG_DIV_VAL1
 Apply a 3/4 voltage division ratio. More...
 
#define LPCMP_DIVISION_FACTOR_1_2   SYS0_LPCMPCFG_DIV_VAL2
 Apply a 1/2 voltage division ratio. More...
 
#define LPCMP_DIVISION_FACTOR_1_3   SYS0_LPCMPCFG_DIV_VAL3
 Apply a 1/3 voltage division ratio. More...
 
#define LPCMP_DIVISION_FACTOR_1_4   SYS0_LPCMPCFG_DIV_VAL4
 Apply a 1/4 voltage division ratio. More...
 
#define LPCMP_POLARITY_FALL   SYS0_LPCMPCFG_EDGCFG_FALL
 Select falling edge for event generation. More...
 
#define LPCMP_POLARITY_RISE   SYS0_LPCMPCFG_EDGCFG_RISE
 Select rising edge for event generation. More...
 
#define LPCMP_NEG_INPUT_VDDD   SYS0_LPCMPCFG_NSEL_VDDD
 Select VDDD as negative input. More...
 
#define LPCMP_NEG_INPUT_VDDS   SYS0_LPCMPCFG_NSEL_VDDA
 Select VDDS(VDDA) as negative input. More...
 
#define LPCMP_NEG_INPUT_A2   SYS0_LPCMPCFG_NSEL_VA_PAD_A2
 Select PAD_A2 as negative input. More...
 
#define LPCMP_NEG_INPUT_A3   SYS0_LPCMPCFG_NSEL_VA_PAD_A3
 Select PAD_A3 as negative input. More...
 
#define LPCMP_NEG_INPUT_OPEN   SYS0_LPCMPCFG_NSEL_OPEN
 Leave negative input floating. More...
 
#define LPCMP_POS_INPUT_A1   SYS0_LPCMPCFG_PSEL_VA_PAD_A1
 Select PAD_A1 as positive input. More...
 
#define LPCMP_POS_INPUT_A2   SYS0_LPCMPCFG_PSEL_VA_PAD_A2
 Select PAD_A2 as positive input. More...
 
#define LPCMP_POS_INPUT_A3   SYS0_LPCMPCFG_PSEL_VA_PAD_A3
 Select PAD_A3 as positive input. More...
 
#define LPCMP_POS_INPUT_VDDS   SYS0_LPCMPCFG_PSEL_VDDA
 Selects VDDS(VDDA) as positive input. More...
 
#define LPCMP_POS_INPUT_OPEN   SYS0_LPCMPCFG_PSEL_OPEN
 Leave negative positive floating. More...
 

Functions

__STATIC_INLINE void LPCMPEnable (void)
 Enables LPCMP. More...
 
__STATIC_INLINE void LPCMPDisable (void)
 Disables LPCMP. More...
 
__STATIC_INLINE void LPCMPEnableEvent (void)
 Enables LPCMP event generation. More...
 
__STATIC_INLINE void LPCMPDisableEvent (void)
 Disables LPCMP event generation. More...
 
__STATIC_INLINE void LPCMPClearEvent (void)
 Clear LPCMP event flag. More...
 
__STATIC_INLINE void LPCMPEnableWakeup (void)
 Enables LPCMP as wakeup source from standby. More...
 
__STATIC_INLINE void LPCMPDisableWakeup (void)
 Disables LPCMP as wakeup source from standby. More...
 
__STATIC_INLINE void LPCMPSelectNegativeInput (uint32_t input)
 Selects the negative input of LPCMP. More...
 
__STATIC_INLINE bool LPCMPIsOutputHigh (void)
 Verifies if the raw output of LPCMP is high. More...
 
__STATIC_INLINE void LPCMPSelectPositiveInput (uint32_t input)
 Selects the positive input of LPCMP. More...
 
__STATIC_INLINE void LPCMPSetPolarity (uint32_t polarity)
 Selects the edge polarity of LPCMP output on which an event is triggered. More...
 
__STATIC_INLINE void LPCMPSetDividerRatio (uint32_t divider)
 Selects the ratio used by LPCMP voltage divider. More...
 
__STATIC_INLINE void LPCMPSetDividerPath (uint32_t path)
 Selects the input path on which the LPCMP voltage divider is applied. More...
 

Detailed Description

Macro Definition Documentation

§ LPCMP_DIVISION_PATH_N

#define LPCMP_DIVISION_PATH_N   SYS0_LPCMPCFG_DIVPATH_NSIDE

Apply voltage divider to the negative input.

§ LPCMP_DIVISION_PATH_P

#define LPCMP_DIVISION_PATH_P   SYS0_LPCMPCFG_DIVPATH_PSIDE

Apply voltage divider to the positive input.

Referenced by LPCMPSetDividerPath().

§ LPCMP_DIVISION_FACTOR_1_1

#define LPCMP_DIVISION_FACTOR_1_1   SYS0_LPCMPCFG_DIV_VAL0

Apply a 1/1 voltage division ratio.

§ LPCMP_DIVISION_FACTOR_3_4

#define LPCMP_DIVISION_FACTOR_3_4   SYS0_LPCMPCFG_DIV_VAL1

Apply a 3/4 voltage division ratio.

§ LPCMP_DIVISION_FACTOR_1_2

#define LPCMP_DIVISION_FACTOR_1_2   SYS0_LPCMPCFG_DIV_VAL2

Apply a 1/2 voltage division ratio.

§ LPCMP_DIVISION_FACTOR_1_3

#define LPCMP_DIVISION_FACTOR_1_3   SYS0_LPCMPCFG_DIV_VAL3

Apply a 1/3 voltage division ratio.

§ LPCMP_DIVISION_FACTOR_1_4

#define LPCMP_DIVISION_FACTOR_1_4   SYS0_LPCMPCFG_DIV_VAL4

Apply a 1/4 voltage division ratio.

§ LPCMP_POLARITY_FALL

#define LPCMP_POLARITY_FALL   SYS0_LPCMPCFG_EDGCFG_FALL

Select falling edge for event generation.

Referenced by LPCMPSetPolarity().

§ LPCMP_POLARITY_RISE

#define LPCMP_POLARITY_RISE   SYS0_LPCMPCFG_EDGCFG_RISE

Select rising edge for event generation.

§ LPCMP_NEG_INPUT_VDDD

#define LPCMP_NEG_INPUT_VDDD   SYS0_LPCMPCFG_NSEL_VDDD

Select VDDD as negative input.

§ LPCMP_NEG_INPUT_VDDS

#define LPCMP_NEG_INPUT_VDDS   SYS0_LPCMPCFG_NSEL_VDDA

Select VDDS(VDDA) as negative input.

§ LPCMP_NEG_INPUT_A2

#define LPCMP_NEG_INPUT_A2   SYS0_LPCMPCFG_NSEL_VA_PAD_A2

Select PAD_A2 as negative input.

§ LPCMP_NEG_INPUT_A3

#define LPCMP_NEG_INPUT_A3   SYS0_LPCMPCFG_NSEL_VA_PAD_A3

Select PAD_A3 as negative input.

§ LPCMP_NEG_INPUT_OPEN

#define LPCMP_NEG_INPUT_OPEN   SYS0_LPCMPCFG_NSEL_OPEN

Leave negative input floating.

§ LPCMP_POS_INPUT_A1

#define LPCMP_POS_INPUT_A1   SYS0_LPCMPCFG_PSEL_VA_PAD_A1

Select PAD_A1 as positive input.

§ LPCMP_POS_INPUT_A2

#define LPCMP_POS_INPUT_A2   SYS0_LPCMPCFG_PSEL_VA_PAD_A2

Select PAD_A2 as positive input.

§ LPCMP_POS_INPUT_A3

#define LPCMP_POS_INPUT_A3   SYS0_LPCMPCFG_PSEL_VA_PAD_A3

Select PAD_A3 as positive input.

§ LPCMP_POS_INPUT_VDDS

#define LPCMP_POS_INPUT_VDDS   SYS0_LPCMPCFG_PSEL_VDDA

Selects VDDS(VDDA) as positive input.

§ LPCMP_POS_INPUT_OPEN

#define LPCMP_POS_INPUT_OPEN   SYS0_LPCMPCFG_PSEL_OPEN

Leave negative positive floating.

Function Documentation

§ LPCMPEnable()

__STATIC_INLINE void LPCMPEnable ( void  )

Enables LPCMP.

This function enables LPCMP and it must be called after having configured the peripheral's inputs, voltage divider and event generation logic.

§ LPCMPDisable()

__STATIC_INLINE void LPCMPDisable ( void  )

Disables LPCMP.

This function disables LPCMP after it has been enabled using LPCMPEnable().

§ LPCMPEnableEvent()

__STATIC_INLINE void LPCMPEnableEvent ( void  )

Enables LPCMP event generation.

This function enables LPCMP event generation to the event fabric. Polarity must be selected using LPCMPSetPolarity() to determine on which edge type of LPCMP output an event should be generated. LPCMP doesn't have a dedicated interrupt line, therefore a configurable interrupt line must be configured to propagate LPCMP events.

§ LPCMPDisableEvent()

__STATIC_INLINE void LPCMPDisableEvent ( void  )

Disables LPCMP event generation.

This function disables LPCMP event generation to the event fabric.

§ LPCMPClearEvent()

__STATIC_INLINE void LPCMPClearEvent ( void  )

Clear LPCMP event flag.

This function clears LPCMP event flag and should be called from the ISR registered to service LPCMP interrupts.

§ LPCMPEnableWakeup()

__STATIC_INLINE void LPCMPEnableWakeup ( void  )

Enables LPCMP as wakeup source from standby.

This function enables LPCMP as one of the sources that can wakeup the device from standby.

§ LPCMPDisableWakeup()

__STATIC_INLINE void LPCMPDisableWakeup ( void  )

Disables LPCMP as wakeup source from standby.

This function disables LPCMP as one of the sources that can wakeup the device from standby.

§ LPCMPSelectNegativeInput()

__STATIC_INLINE void LPCMPSelectNegativeInput ( uint32_t  input)

Selects the negative input of LPCMP.

This function selects one of the available sources as the negative input of LPCMP. This function must be called before enabling LPCMP using LPCMPEnable().

Parameters
inputLPCMP negative input source:

§ LPCMPIsOutputHigh()

__STATIC_INLINE bool LPCMPIsOutputHigh ( void  )

Verifies if the raw output of LPCMP is high.

This function returns a boolean value indicating whether the raw output of LPCMP is high or low

Returns
status of LPCMP raw output:
  • true : LPCMP raw output is high.
  • false : LPCMP raw output is low.

§ LPCMPSelectPositiveInput()

__STATIC_INLINE void LPCMPSelectPositiveInput ( uint32_t  input)

Selects the positive input of LPCMP.

This function selects one of the available sources as the positive input of LPCMP. This function must be called before enabling LPCMP using LPCMPEnable().

Parameters
inputLPCMP positive input source:

§ LPCMPSetPolarity()

__STATIC_INLINE void LPCMPSetPolarity ( uint32_t  polarity)

Selects the edge polarity of LPCMP output on which an event is triggered.

This function selects whether a rising or falling edge of LPCMP output will trigger an event propagated through the event fabric.

Parameters
polarityEdge polarity of LPCMP output on which the event is triggered:

References LPCMP_POLARITY_FALL.

§ LPCMPSetDividerRatio()

__STATIC_INLINE void LPCMPSetDividerRatio ( uint32_t  divider)

Selects the ratio used by LPCMP voltage divider.

This function selects the ratio used by LPCMP voltage divider to divide one of the two comparator inputs. Use LPCMPSetDividerPath() to select if the ratio should be applied to the negative or positive input of LPCMP.

Parameters
dividerDivider ratio used by LPCMP voltage divider:

§ LPCMPSetDividerPath()

__STATIC_INLINE void LPCMPSetDividerPath ( uint32_t  path)

Selects the input path on which the LPCMP voltage divider is applied.

This function selects the input path on which the LPCMP voltage divider is applied. Use LPCMPSetDividerRatio() to set the division ratio applied by the LPCMP voltage divider on the selected path.

Parameters
pathInput path the LPCMP voltage divider is applied to:

References LPCMP_DIVISION_PATH_P.