HPM SDK
HPMicro Software Development Kit
ACMP driver APIs

ACMP driver APIs. More...

Data Structures

struct  acmp_channel_config
 ACMP channel config. More...
 

Macros

#define ACMP_HYST_LEVEL_0   (0U)
 ACMP hysteresis level. More...
 
#define ACMP_HYST_LEVEL_1   (1U)
 
#define ACMP_HYST_LEVEL_2   (2U)
 
#define ACMP_HYST_LEVEL_3   (3U)
 
#define ACMP_INPUT_DAC_OUT   (0U)
 ACMP input channel number. More...
 
#define ACMP_INPUT_ANALOG_1   (1U)
 
#define ACMP_INPUT_ANALOG_2   (2U)
 
#define ACMP_INPUT_ANALOG_3   (3U)
 
#define ACMP_INPUT_ANALOG_4   (4U)
 
#define ACMP_INPUT_ANALOG_5   (5U)
 
#define ACMP_INPUT_ANALOG_6   (6U)
 
#define ACMP_INPUT_ANALOG_7   (7U)
 
#define ACMP_FILTER_MODE_BYPASS   (0U)
 ACMP output digital filter mode. More...
 
#define ACMP_FILTER_MODE_CHANGE_IMMEDIATELY   (4U)
 
#define ACMP_FILTER_MODE_CHANGE_AFTER_FILTER   (5U)
 
#define ACMP_FILTER_MODE_STABLE_LOW   (6U)
 
#define ACMP_FILTER_MODE_STABLE_HIGH   (7U)
 
#define ACMP_EVENT_RISING_EDGE   (1U)
 ACMP rising/falling flage mask. More...
 
#define ACMP_EVENT_FALLING_EDGE   (2U)
 
#define ACMP_CAP_SEL_LEVEL_0   (0U)
 ACMP cap selection mask. More...
 
#define ACMP_CAP_SEL_LEVEL_1   (1U)
 
#define ACMP_CAP_SEL_LEVEL_2   (2U)
 
#define ACMP_CAP_SEL_LEVEL_3   (3U)
 

Typedefs

typedef struct acmp_channel_config acmp_channel_config_t
 ACMP channel config. More...
 

Functions

static void acmp_channel_config_dac (ACMP_Type *ptr, uint8_t ch, uint32_t value)
 ACMP channel config DAC output value. More...
 
static void acmp_channel_clear_status (ACMP_Type *ptr, uint8_t ch, uint32_t mask)
 ACMP channel clear status. More...
 
static uint32_t acmp_channel_get_status (ACMP_Type *ptr, uint8_t ch)
 ACMP channel get status. More...
 
static void acmp_channel_dma_request_enable (ACMP_Type *ptr, uint8_t ch, uint32_t mask, bool enable)
 ACMP channel enable DMA request. More...
 
static void acmp_channel_enable_irq (ACMP_Type *ptr, uint8_t ch, uint32_t mask, bool enable)
 ACMP channel enable IRQ. More...
 
static void acmp_channel_enable_dac (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel enable DAC. More...
 
static void acmp_channel_enable_hpmode (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel enable high performance mode. More...
 
static void acmp_channel_set_hyst (ACMP_Type *ptr, uint8_t ch, uint8_t level)
 ACMP channel enable hysteresis level. More...
 
static void acmp_channel_enable_cmp (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel enable comparator. More...
 
static void acmp_channel_enable_cmp_output (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel enable comparator output. More...
 
static void acmp_channel_cmp_output_bypass_filter (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel bypass comparator output filter. More...
 
static void acmp_channel_enable_cmp_window_mode (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel enable comparator window mode. More...
 
static void acmp_channel_invert_output (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel invert comparator output. More...
 
static void acmp_channel_set_filter_mode (ACMP_Type *ptr, uint8_t ch, uint8_t filter)
 ACMP channel set comparator output filter mode. More...
 
static void acmp_channel_enable_sync (ACMP_Type *ptr, uint8_t ch, bool enable)
 ACMP channel enable comparator output sync with clock. More...
 
static void acmp_channel_set_filter_length (ACMP_Type *ptr, uint8_t ch, uint16_t filter_length)
 ACMP channel set comparator output filter length. More...
 
hpm_stat_t acmp_channel_config (ACMP_Type *ptr, uint8_t ch, acmp_channel_config_t *config, bool enable)
 ADC channel config. More...
 
void acmp_channel_get_default_config (ACMP_Type *ptr, acmp_channel_config_t *config)
 ADC channel get default config setting. More...
 

Detailed Description

ACMP driver APIs.

Macro Definition Documentation

◆ ACMP_CAP_SEL_LEVEL_0

#define ACMP_CAP_SEL_LEVEL_0   (0U)

#include <drivers/inc/hpm_acmp_drv.h>

ACMP cap selection mask.

◆ ACMP_CAP_SEL_LEVEL_1

#define ACMP_CAP_SEL_LEVEL_1   (1U)

◆ ACMP_CAP_SEL_LEVEL_2

#define ACMP_CAP_SEL_LEVEL_2   (2U)

◆ ACMP_CAP_SEL_LEVEL_3

#define ACMP_CAP_SEL_LEVEL_3   (3U)

◆ ACMP_EVENT_FALLING_EDGE

#define ACMP_EVENT_FALLING_EDGE   (2U)

◆ ACMP_EVENT_RISING_EDGE

#define ACMP_EVENT_RISING_EDGE   (1U)

#include <drivers/inc/hpm_acmp_drv.h>

ACMP rising/falling flage mask.

◆ ACMP_FILTER_MODE_BYPASS

#define ACMP_FILTER_MODE_BYPASS   (0U)

#include <drivers/inc/hpm_acmp_drv.h>

ACMP output digital filter mode.

◆ ACMP_FILTER_MODE_CHANGE_AFTER_FILTER

#define ACMP_FILTER_MODE_CHANGE_AFTER_FILTER   (5U)

◆ ACMP_FILTER_MODE_CHANGE_IMMEDIATELY

#define ACMP_FILTER_MODE_CHANGE_IMMEDIATELY   (4U)

◆ ACMP_FILTER_MODE_STABLE_HIGH

#define ACMP_FILTER_MODE_STABLE_HIGH   (7U)

◆ ACMP_FILTER_MODE_STABLE_LOW

#define ACMP_FILTER_MODE_STABLE_LOW   (6U)

◆ ACMP_HYST_LEVEL_0

#define ACMP_HYST_LEVEL_0   (0U)

#include <drivers/inc/hpm_acmp_drv.h>

ACMP hysteresis level.

◆ ACMP_HYST_LEVEL_1

#define ACMP_HYST_LEVEL_1   (1U)

◆ ACMP_HYST_LEVEL_2

#define ACMP_HYST_LEVEL_2   (2U)

◆ ACMP_HYST_LEVEL_3

#define ACMP_HYST_LEVEL_3   (3U)

◆ ACMP_INPUT_ANALOG_1

#define ACMP_INPUT_ANALOG_1   (1U)

◆ ACMP_INPUT_ANALOG_2

#define ACMP_INPUT_ANALOG_2   (2U)

◆ ACMP_INPUT_ANALOG_3

#define ACMP_INPUT_ANALOG_3   (3U)

◆ ACMP_INPUT_ANALOG_4

#define ACMP_INPUT_ANALOG_4   (4U)

◆ ACMP_INPUT_ANALOG_5

#define ACMP_INPUT_ANALOG_5   (5U)

◆ ACMP_INPUT_ANALOG_6

#define ACMP_INPUT_ANALOG_6   (6U)

◆ ACMP_INPUT_ANALOG_7

#define ACMP_INPUT_ANALOG_7   (7U)

◆ ACMP_INPUT_DAC_OUT

#define ACMP_INPUT_DAC_OUT   (0U)

#include <drivers/inc/hpm_acmp_drv.h>

ACMP input channel number.

Typedef Documentation

◆ acmp_channel_config_t

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel config.

Function Documentation

◆ acmp_channel_clear_status()

static void acmp_channel_clear_status ( ACMP_Type ptr,
uint8_t  ch,
uint32_t  mask 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel clear status.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]mask:
  • ACMP_EVENT_RISING_EDGE: ACMP output rising flag
  • ACMP_EVENT_FALLING_EDGE: ACMP output fall flag

◆ acmp_channel_cmp_output_bypass_filter()

static void acmp_channel_cmp_output_bypass_filter ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel bypass comparator output filter.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: bypass
  • false: not bypass

◆ acmp_channel_config()

hpm_stat_t acmp_channel_config ( ACMP_Type ptr,
uint8_t  ch,
acmp_channel_config_t config,
bool  enable 
)

#include <drivers/inc/hpm_acmp_drv.h>

ADC channel config.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]configacmp_channel_config_t
[in]enable
  • true: enable comparator
  • false: disable comparator
Return values
hpm_stat_t

◆ acmp_channel_config_dac()

static void acmp_channel_config_dac ( ACMP_Type ptr,
uint8_t  ch,
uint32_t  value 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel config DAC output value.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]valueDAC output value

◆ acmp_channel_dma_request_enable()

static void acmp_channel_dma_request_enable ( ACMP_Type ptr,
uint8_t  ch,
uint32_t  mask,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable DMA request.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]mask:
  • ACMP_EVENT_RISING_EDGE: ACMP output rising flag
  • ACMP_EVENT_FALLING_EDGE: ACMP output fall flag
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_cmp()

static void acmp_channel_enable_cmp ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable comparator.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_cmp_output()

static void acmp_channel_enable_cmp_output ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable comparator output.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_cmp_window_mode()

static void acmp_channel_enable_cmp_window_mode ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable comparator window mode.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_dac()

static void acmp_channel_enable_dac ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable DAC.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_hpmode()

static void acmp_channel_enable_hpmode ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable high performance mode.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_irq()

static void acmp_channel_enable_irq ( ACMP_Type ptr,
uint8_t  ch,
uint32_t  mask,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable IRQ.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]mask:
  • ACMP_EVENT_RISING_EDGE: ACMP output rising flag
  • ACMP_EVENT_FALLING_EDGE: ACMP output fall flag
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_enable_sync()

static void acmp_channel_enable_sync ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable comparator output sync with clock.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: enable
  • false: disable

◆ acmp_channel_get_default_config()

void acmp_channel_get_default_config ( ACMP_Type ptr,
acmp_channel_config_t config 
)

#include <drivers/inc/hpm_acmp_drv.h>

ADC channel get default config setting.

Parameters
[in]ptrACMP base address
[out]configacmp_channel_config_t

◆ acmp_channel_get_status()

static uint32_t acmp_channel_get_status ( ACMP_Type ptr,
uint8_t  ch 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel get status.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
Return values
ACMPchannel's status

◆ acmp_channel_invert_output()

static void acmp_channel_invert_output ( ACMP_Type ptr,
uint8_t  ch,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel invert comparator output.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]enable
  • true: invert
  • false: not invert

◆ acmp_channel_set_filter_length()

static void acmp_channel_set_filter_length ( ACMP_Type ptr,
uint8_t  ch,
uint16_t  filter_length 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel set comparator output filter length.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]filter_lengthfilter length in clock cycles

◆ acmp_channel_set_filter_mode()

static void acmp_channel_set_filter_mode ( ACMP_Type ptr,
uint8_t  ch,
uint8_t  filter 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel set comparator output filter mode.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]filterACMP output digital filter mode definition

◆ acmp_channel_set_hyst()

static void acmp_channel_set_hyst ( ACMP_Type ptr,
uint8_t  ch,
uint8_t  level 
)
inlinestatic

#include <drivers/inc/hpm_acmp_drv.h>

ACMP channel enable hysteresis level.

Parameters
[in]ptrACMP base address
[in]chACMP channel number
[in]levelACMP hysteresis level