MSPM0G1X0X_G3X0X Driver Library  1.10.01.05
Data Structures | Macros | Enumerations | Functions
dl_comp.h File Reference

Detailed Description

Comparator (COMP)


#include <stdbool.h>
#include <stdint.h>
#include <ti/devices/msp/msp.h>
#include <ti/driverlib/dl_common.h>
Include dependency graph for dl_comp.h:

Go to the source code of this file.

Data Structures

struct  DL_COMP_Config
 Configuration struct for DL_COMP_init. More...
 
struct  DL_COMP_RefVoltageConfig
 Configuration struct for DL_COMP_refVoltageInit. More...
 

Macros

#define DL_COMP_INTERRUPT_OUTPUT_READY   (COMP_CPU_INT_IMASK_OUTRDYIFG_SET)
 Comparator output ready interrupt.
 
#define DL_COMP_INTERRUPT_OUTPUT_EDGE   (COMP_CPU_INT_IMASK_COMPIFG_SET)
 Rising or falling edge of comparator output (selected by IES bit) interrupt.
 
#define DL_COMP_INTERRUPT_OUTPUT_EDGE_INV   (COMP_CPU_INT_IMASK_COMPINVIFG_SET)
 Rising or falling edge of comparator inverted output (selected by IES bit) interrupt.
 
#define DL_COMP_EVENT_OUTPUT_READY   (COMP_GEN_EVENT_IMASK_OUTRDYIFG_SET)
 Comparator output ready event.
 
#define DL_COMP_EVENT_OUTPUT_EDGE   (COMP_GEN_EVENT_IMASK_COMPIFG_SET)
 Rising or falling edge of comparator output (selected by IES bit) event.
 
#define DL_COMP_EVENT_OUTPUT_EDGE_INV   (COMP_GEN_EVENT_IMASK_COMPINVIFG_SET)
 Rising or falling edge of comparator inverted output (selected by IES bit) event.
 

Enumerations

enum  DL_COMP_IIDX {
  DL_COMP_IIDX_NO_INTERRUPT = COMP_CPU_INT_IIDX_STAT_NO_INTR,
  DL_COMP_IIDX_OUTPUT_READY = COMP_CPU_INT_IIDX_STAT_OUTRDYIFG,
  DL_COMP_IIDX_OUTPUT_EDGE = COMP_CPU_INT_IIDX_STAT_COMPIFG,
  DL_COMP_IIDX_OUTPUT_EDGE_INV = COMP_CPU_INT_IIDX_STAT_COMPINVIFG
}
 
enum  DL_COMP_MODE {
  DL_COMP_MODE_FAST = COMP_CTL1_MODE_FAST,
  DL_COMP_MODE_ULP = COMP_CTL1_MODE_ULP
}
 
enum  DL_COMP_OUTPUT_INT_EDGE {
  DL_COMP_OUTPUT_INT_EDGE_RISING = COMP_CTL1_IES_RISING,
  DL_COMP_OUTPUT_INT_EDGE_FALLING = COMP_CTL1_IES_FALLING
}
 
enum  DL_COMP_HYSTERESIS {
  DL_COMP_HYSTERESIS_NONE = COMP_CTL1_HYST_NO_HYS,
  DL_COMP_HYSTERESIS_10 = COMP_CTL1_HYST_LOW_HYS,
  DL_COMP_HYSTERESIS_20 = COMP_CTL1_HYST_MED_HYS,
  DL_COMP_HYSTERESIS_30 = COMP_CTL1_HYST_HIGH_HYS
}
 
enum  DL_COMP_POLARITY {
  DL_COMP_POLARITY_NON_INV = COMP_CTL1_OUTPOL_NON_INV,
  DL_COMP_POLARITY_INV = COMP_CTL1_OUTPOL_INV
}
 
enum  DL_COMP_FILTER_DELAY {
  DL_COMP_FILTER_DELAY_70 = COMP_CTL1_FLTDLY_DLY_0,
  DL_COMP_FILTER_DELAY_500 = COMP_CTL1_FLTDLY_DLY_1,
  DL_COMP_FILTER_DELAY_1200 = COMP_CTL1_FLTDLY_DLY_2,
  DL_COMP_FILTER_DELAY_2700 = COMP_CTL1_FLTDLY_DLY_3
}
 
enum  DL_COMP_IPSEL_CHANNEL {
  DL_COMP_IPSEL_CHANNEL_0 = COMP_CTL0_IPSEL_CH_0,
  DL_COMP_IPSEL_CHANNEL_1 = COMP_CTL0_IPSEL_CH_1,
  DL_COMP_IPSEL_CHANNEL_2 = COMP_CTL0_IPSEL_CH_2,
  DL_COMP_IPSEL_CHANNEL_3 = COMP_CTL0_IPSEL_CH_3,
  DL_COMP_IPSEL_CHANNEL_4 = COMP_CTL0_IPSEL_CH_4,
  DL_COMP_IPSEL_CHANNEL_5 = COMP_CTL0_IPSEL_CH_5,
  DL_COMP_IPSEL_CHANNEL_6 = COMP_CTL0_IPSEL_CH_6,
  DL_COMP_IPSEL_CHANNEL_7 = COMP_CTL0_IPSEL_CH_7
}
 
enum  DL_COMP_IMSEL_CHANNEL {
  DL_COMP_IMSEL_CHANNEL_0 = COMP_CTL0_IMSEL_CH_0,
  DL_COMP_IMSEL_CHANNEL_1 = COMP_CTL0_IMSEL_CH_1,
  DL_COMP_IMSEL_CHANNEL_2 = COMP_CTL0_IMSEL_CH_2,
  DL_COMP_IMSEL_CHANNEL_3 = COMP_CTL0_IMSEL_CH_3,
  DL_COMP_IMSEL_CHANNEL_4 = COMP_CTL0_IMSEL_CH_4,
  DL_COMP_IMSEL_CHANNEL_5 = COMP_CTL0_IMSEL_CH_5,
  DL_COMP_IMSEL_CHANNEL_6 = COMP_CTL0_IMSEL_CH_6,
  DL_COMP_IMSEL_CHANNEL_7 = COMP_CTL0_IMSEL_CH_7
}
 
enum  DL_COMP_ENABLE_CHANNEL {
  DL_COMP_ENABLE_CHANNEL_NONE,
  DL_COMP_ENABLE_CHANNEL_POS = COMP_CTL0_IPEN_ENABLE,
  DL_COMP_ENABLE_CHANNEL_NEG = COMP_CTL0_IMEN_ENABLE,
  DL_COMP_ENABLE_CHANNEL_POS_NEG
}
 
enum  DL_COMP_REF_MODE {
  DL_COMP_REF_MODE_STATIC = COMP_CTL2_REFMODE_STATIC,
  DL_COMP_REF_MODE_SAMPLED = COMP_CTL2_REFMODE_SAMPLED
}
 
enum  DL_COMP_REF_SOURCE {
  DL_COMP_REF_SOURCE_NONE = COMP_CTL2_REFSRC_OFF,
  DL_COMP_REF_SOURCE_VDDA_DAC = COMP_CTL2_REFSRC_VDDA_DAC,
  DL_COMP_REF_SOURCE_VREF_DAC = COMP_CTL2_REFSRC_VREF_DAC,
  DL_COMP_REF_SOURCE_VREF = COMP_CTL2_REFSRC_VREF
}
 
enum  DL_COMP_REF_TERMINAL_SELECT {
  DL_COMP_REF_TERMINAL_SELECT_POS = COMP_CTL2_REFSEL_POSITIVE,
  DL_COMP_REF_TERMINAL_SELECT_NEG = COMP_CTL2_REFSEL_NEGATIVE
}
 
enum  DL_COMP_BLANKING_SOURCE {
  DL_COMP_BLANKING_SOURCE_DISABLE = COMP_CTL2_BLANKSRC_DISABLE,
  DL_COMP_BLANKING_SOURCE_1 = COMP_CTL2_BLANKSRC_BLANKSRC1,
  DL_COMP_BLANKING_SOURCE_2 = COMP_CTL2_BLANKSRC_BLANKSRC2,
  DL_COMP_BLANKING_SOURCE_3 = COMP_CTL2_BLANKSRC_BLANKSRC3,
  DL_COMP_BLANKING_SOURCE_4 = COMP_CTL2_BLANKSRC_BLANKSRC4,
  DL_COMP_BLANKING_SOURCE_5 = COMP_CTL2_BLANKSRC_BLANKSRC5,
  DL_COMP_BLANKING_SOURCE_6 = COMP_CTL2_BLANKSRC_BLANKSRC6
}
 
enum  DL_COMP_DAC_CONTROL {
  DL_COMP_DAC_CONTROL_COMP_OUT = COMP_CTL2_DACCTL_COMPOUT_SEL,
  DL_COMP_DAC_CONTROL_SW = COMP_CTL2_DACCTL_DACSW_SEL
}
 
enum  DL_COMP_DAC_INPUT {
  DL_COMP_DAC_INPUT_DACCODE0 = COMP_CTL2_DACSW_DACCODE0_SEL,
  DL_COMP_DAC_INPUT_DACCODE1 = COMP_CTL2_DACSW_DACCODE1_SEL
}
 
enum  DL_COMP_OUTPUT {
  DL_COMP_OUTPUT_HIGH = COMP_STAT_OUT_LOW,
  DL_COMP_OUTPUT_LOW = COMP_STAT_OUT_HIGH
}
 
enum  DL_COMP_SUBSCRIBER_INDEX {
  DL_COMP_SUBSCRIBER_INDEX_0 = 0,
  DL_COMP_SUBSCRIBER_INDEX_1 = 1
}
 

Functions

__STATIC_INLINE void DL_COMP_enablePower (COMP_Regs *comp)
 Enables power on the comparator module. More...
 
__STATIC_INLINE void DL_COMP_disablePower (COMP_Regs *comp)
 Disables power on the comparator module. More...
 
__STATIC_INLINE bool DL_COMP_isPowerEnabled (COMP_Regs *comp)
 Returns if power is on for the comparator module. More...
 
__STATIC_INLINE void DL_COMP_reset (COMP_Regs *comp)
 Resets comparator peripheral. More...
 
__STATIC_INLINE bool DL_COMP_isReset (COMP_Regs *comp)
 Returns if comparator was reset. More...
 
__STATIC_INLINE void DL_COMP_init (COMP_Regs *comp, DL_COMP_Config *config)
 Initialize the COMP peripheral. More...
 
__STATIC_INLINE void DL_COMP_refVoltageInit (COMP_Regs *comp, DL_COMP_RefVoltageConfig *config)
 Initialize the comparator reference voltage generator. More...
 
__STATIC_INLINE void DL_COMP_enable (COMP_Regs *comp)
 Enable the comparator peripheral. More...
 
__STATIC_INLINE bool DL_COMP_isEnabled (COMP_Regs *comp)
 Checks if the comparator peripheral is enabled. More...
 
__STATIC_INLINE void DL_COMP_disable (COMP_Regs *comp)
 Disable the comparator peripheral. More...
 
__STATIC_INLINE void DL_COMP_setCompMode (COMP_Regs *comp, DL_COMP_MODE mode)
 Set the comparator operating mode. More...
 
__STATIC_INLINE DL_COMP_MODE DL_COMP_getCompMode (COMP_Regs *comp)
 Get the mode the comparator is set to. More...
 
__STATIC_INLINE void DL_COMP_enableExchangeInputs (COMP_Regs *comp)
 Enable exchange of the comparator inputs, and invert output. More...
 
__STATIC_INLINE bool DL_COMP_isExchangeInputsEnabled (COMP_Regs *comp)
 Checks if the inputs are exchanged and if output is inverted. More...
 
__STATIC_INLINE void DL_COMP_disableExchangeInputs (COMP_Regs *comp)
 Disable input exchange and invert output. More...
 
__STATIC_INLINE void DL_COMP_enableShortInputTerminals (COMP_Regs *comp)
 Enable shorting of the comparator inputs. More...
 
__STATIC_INLINE bool DL_COMP_isInputTerminalsShorted (COMP_Regs *comp)
 Checks if the comparator inputs are shorted. More...
 
__STATIC_INLINE void DL_COMP_disableShortInputTerminals (COMP_Regs *comp)
 Disable shorting the comparator inputs. More...
 
__STATIC_INLINE void DL_COMP_setOutputInterruptEdge (COMP_Regs *comp, DL_COMP_OUTPUT_INT_EDGE edge)
 Set the interrupt edge for the comparator output. More...
 
__STATIC_INLINE DL_COMP_OUTPUT_INT_EDGE DL_COMP_getOutputInterruptEdge (COMP_Regs *comp)
 Get the interrupt edge for the comparator output. More...
 
__STATIC_INLINE void DL_COMP_setHysteresis (COMP_Regs *comp, DL_COMP_HYSTERESIS voltage)
 Set the hysteresis voltage. More...
 
__STATIC_INLINE DL_COMP_HYSTERESIS DL_COMP_getHysteresis (COMP_Regs *comp)
 Get the hysteresis voltage. More...
 
__STATIC_INLINE void DL_COMP_setOutputPolarity (COMP_Regs *comp, DL_COMP_POLARITY polarity)
 Set the output polarity. More...
 
__STATIC_INLINE DL_COMP_POLARITY DL_COMP_getOutputPolarity (COMP_Regs *comp)
 Get the output polarity. More...
 
__STATIC_INLINE void DL_COMP_enableOutputFilter (COMP_Regs *comp, DL_COMP_FILTER_DELAY delay)
 Enable output filter. More...
 
__STATIC_INLINE bool DL_COMP_isOutputFilterEnabled (COMP_Regs *comp)
 Checks if output filter is enabled. More...
 
__STATIC_INLINE void DL_COMP_disableOutputFilter (COMP_Regs *comp)
 Disable output filter using on-chip analog filter. More...
 
__STATIC_INLINE DL_COMP_FILTER_DELAY DL_COMP_getOutputFilterDelay (COMP_Regs *comp)
 Get the output filter delay. More...
 
__STATIC_INLINE void DL_COMP_enableWindowComparator (COMP_Regs *comp)
 Enable the window comparator. More...
 
__STATIC_INLINE bool DL_COMP_isWindowComparatorEnabled (COMP_Regs *comp)
 Checks if the window comparator is enabled. More...
 
__STATIC_INLINE void DL_COMP_disableWindowComparator (COMP_Regs *comp)
 Disable the window comparator. More...
 
__STATIC_INLINE void DL_COMP_setEnabledInputChannels (COMP_Regs *comp, DL_COMP_ENABLE_CHANNEL channels)
 Set the enabled channels for the comparator terminals. More...
 
__STATIC_INLINE DL_COMP_ENABLE_CHANNEL DL_COMP_getEnabledInputChannels (COMP_Regs *comp)
 Get the enabled input channels. More...
 
__STATIC_INLINE void DL_COMP_setPositiveChannelInput (COMP_Regs *comp, DL_COMP_IPSEL_CHANNEL input)
 Set the channel input for the positive terminal. More...
 
__STATIC_INLINE DL_COMP_IPSEL_CHANNEL DL_COMP_getPositiveChannelInput (COMP_Regs *comp)
 Get the channel input for the positive terminal. More...
 
__STATIC_INLINE void DL_COMP_setNegativeChannelInput (COMP_Regs *comp, DL_COMP_IMSEL_CHANNEL input)
 Set the channel input for the negative terminal. More...
 
__STATIC_INLINE DL_COMP_IMSEL_CHANNEL DL_COMP_getNegativeChannelInput (COMP_Regs *comp)
 Get the channel input for the negative terminal. More...
 
__STATIC_INLINE void DL_COMP_setReferenceMode (COMP_Regs *comp, DL_COMP_REF_MODE mode)
 Set the mode for the reference voltage. More...
 
__STATIC_INLINE DL_COMP_REF_MODE DL_COMP_getReferenceMode (COMP_Regs *comp)
 Get the mode for the reference voltage. More...
 
__STATIC_INLINE void DL_COMP_setReferenceSource (COMP_Regs *comp, DL_COMP_REF_SOURCE source)
 Set the reference source for the comparator. More...
 
__STATIC_INLINE DL_COMP_REF_SOURCE DL_COMP_getReferenceSource (COMP_Regs *comp)
 Get the reference source for the comparator. More...
 
__STATIC_INLINE void DL_COMP_setReferenceCompTerminal (COMP_Regs *comp, DL_COMP_REF_TERMINAL_SELECT terminal)
 Set the comparator terminal the reference voltage is applied to. More...
 
__STATIC_INLINE DL_COMP_REF_TERMINAL_SELECT DL_COMP_getReferenceCompTerminal (COMP_Regs *comp)
 Get the comparator terminal the reference voltage is applied to. More...
 
__STATIC_INLINE void DL_COMP_setBlankingSource (COMP_Regs *comp, DL_COMP_BLANKING_SOURCE source)
 Set the blanking source for the comparator. More...
 
__STATIC_INLINE DL_COMP_BLANKING_SOURCE DL_COMP_getBlankingSource (COMP_Regs *comp)
 Get the blanking source for the comparator. More...
 
__STATIC_INLINE void DL_COMP_setDACControl (COMP_Regs *comp, DL_COMP_DAC_CONTROL control)
 Select the source for COMP control. More...
 
__STATIC_INLINE DL_COMP_DAC_CONTROL DL_COMP_getDACControl (COMP_Regs *comp)
 Get what controls the input to the COMP. More...
 
__STATIC_INLINE void DL_COMP_setDACInput (COMP_Regs *comp, DL_COMP_DAC_INPUT input)
 Set whether DACCODE0 or DACCODE1 is the input to the COMP. More...
 
__STATIC_INLINE DL_COMP_DAC_INPUT DL_COMP_getDACInput (COMP_Regs *comp)
 Get whether DACCODE0 or DACCODE1 is the input to the COMP. More...
 
__STATIC_INLINE void DL_COMP_setDACCode0 (COMP_Regs *comp, uint32_t value)
 Set the 8-bit COMP input code through DACCODE0. More...
 
__STATIC_INLINE uint32_t DL_COMP_getDACCode0 (COMP_Regs *comp)
 Get the code value of DACCODE0. More...
 
__STATIC_INLINE void DL_COMP_setDACCode1 (COMP_Regs *comp, uint32_t value)
 Set the 8-bit COMP input code through DACCODE1. More...
 
__STATIC_INLINE uint32_t DL_COMP_getDACCode1 (COMP_Regs *comp)
 Get the code value of DACCODE1. More...
 
__STATIC_INLINE DL_COMP_OUTPUT DL_COMP_getComparatorOutput (COMP_Regs *comp)
 Gets the comparator output. More...
 
__STATIC_INLINE void DL_COMP_enableSampledMode (COMP_Regs *comp)
 Enable sampled mode of the comparator. More...
 
__STATIC_INLINE bool DL_COMP_isSampledModeEnabled (COMP_Regs *comp)
 Checks if sampled mode is enabled. More...
 
__STATIC_INLINE void DL_COMP_disableSampledMode (COMP_Regs *comp)
 Disable sampled mode. More...
 
__STATIC_INLINE void DL_COMP_setSubscriberChanID (COMP_Regs *comp, DL_COMP_SUBSCRIBER_INDEX index, uint8_t chanID)
 Sets the event subscriber channel id. More...
 
__STATIC_INLINE uint8_t DL_COMP_getSubscriberChanID (COMP_Regs *comp, DL_COMP_SUBSCRIBER_INDEX index)
 Gets the event subscriber channel id. More...
 
__STATIC_INLINE void DL_COMP_enableInterrupt (COMP_Regs *comp, uint32_t interruptMask)
 Enable COMP interrupts. More...
 
__STATIC_INLINE void DL_COMP_disableInterrupt (COMP_Regs *comp, uint32_t interruptMask)
 Disable COMP interrupts. More...
 
__STATIC_INLINE uint32_t DL_COMP_getEnabledInterrupts (COMP_Regs *comp, uint32_t interruptMask)
 Check which COMP interrupts are enabled. More...
 
__STATIC_INLINE uint32_t DL_COMP_getEnabledInterruptStatus (COMP_Regs *comp, uint32_t interruptMask)
 Check interrupt flag of enabled COMP interrupts. More...
 
__STATIC_INLINE uint32_t DL_COMP_getRawInterruptStatus (COMP_Regs *comp, uint32_t interruptMask)
 Check interrupt flag of any COMP interrupt. More...
 
__STATIC_INLINE DL_COMP_IIDX DL_COMP_getPendingInterrupt (COMP_Regs *comp)
 Get highest priority pending COMP interrupt. More...
 
__STATIC_INLINE void DL_COMP_clearInterruptStatus (COMP_Regs *comp, uint32_t interruptMask)
 Clear pending COMP interrupts. More...
 
__STATIC_INLINE void DL_COMP_setPublisherChanID (COMP_Regs *comp, uint8_t chanID)
 Sets the COMP event publisher channel ID. More...
 
__STATIC_INLINE uint8_t DL_COMP_getPublisherChanID (COMP_Regs *comp)
 Gets the event publisher channel ID. More...
 
__STATIC_INLINE void DL_COMP_enableEvent (COMP_Regs *comp, uint32_t eventMask)
 Enable COMP event. More...
 
__STATIC_INLINE void DL_COMP_disableEvent (COMP_Regs *comp, uint32_t eventMask)
 Disable COMP event. More...
 
__STATIC_INLINE uint32_t DL_COMP_getEnabledEvents (COMP_Regs *comp, uint32_t eventMask)
 Check which COMP events are enabled. More...
 
__STATIC_INLINE uint32_t DL_COMP_getEnabledEventStatus (COMP_Regs *comp, uint32_t eventMask)
 Check event flag of enabled COMP event. More...
 
__STATIC_INLINE uint32_t DL_COMP_getRawEventsStatus (COMP_Regs *comp, uint32_t eventMask)
 Check interrupt flag of any COMP event. More...
 
__STATIC_INLINE void DL_COMP_clearEventsStatus (COMP_Regs *comp, uint32_t eventMask)
 Clear pending COMP events. More...
 
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale