HPM SDK
HPMicro Software Development Kit
OPAMP driver APIs

OPMAP driver APIs. More...

Data Structures

union  opamp_cfg_preset0
 opamp configuration preset0 More...
 
union  opamp_cfg_preset1
 opamp configuration preset1 More...
 
struct  opamp_cfg
 

Macros

#define OPAMP_MODE_FOLLOW_KEY   (0x06)
 
#define OPAMP_MODE_INVERT_INDEX0_KEY   (0x08)
 
#define OPAMP_MODE_INVERT_INDEX1_KEY   (0x18)
 
#define OPAMP_MODE_NON_INVERT_INDEX0_KEY   (0x01)
 
#define OPAMP_MODE_NON_INVERT_INDEX1_KEY   (0x09)
 
#define OPAMP_MODE_NON_INVERT_INDEX2_KEY   (0x11)
 
#define OPAMP_MODE_NON_INVERT_INDEX3_KEY   (0x19)
 
#define OPAMP_MODE_NON_INVERT_INDEX4_KEY   (0x09)
 
#define OPAMP_MODE_USER_DEFINE_KEY   (0x04)
 

Typedefs

typedef union opamp_cfg_preset0 opamp_ctrl_cfg_preset0_t
 opamp configuration preset0 More...
 
typedef union opamp_cfg_preset1 opamp_ctrl_cfg_preset1_t
 opamp configuration preset1 More...
 
typedef struct opamp_cfg opamp_cfg_t
 

Enumerations

enum  opamp_inm_pad_t {
  inm_pad_vim0 = 0 , inm_pad_vim1 = 1 , inm_pad_vim2 = 2 , inm_pad_vim3 = 3 ,
  inm_pad_floating = 4
}
 Reverse Input Pin Selection. More...
 
enum  opamp_gain_t {
  gain_x_2 = 0 , gain_x_4 = 1 , gain_x_8 = 2 , gain_x_16 = 3 ,
  gain_x_32 = 4 , gain_x_64 = 5 , gain_x_128 = 6
}
 Gain multiplier selection. More...
 
enum  opamp_miller_cap_t {
  miller_cap_x_7 = 0 , miller_cap_x_8 = 1 , miller_cap_x_10 = 2 , miller_cap_x_13 = 3 ,
  miller_cap_x_15 = 4 , miller_cap_x_18 = 5 , miller_cap_x_5 = 6 , miller_cap_x_6 = 7
}
 Miller Capacitor Selection. More...
 
enum  opamp_inp_pad_t {
  inp_pad_vip0 = 0 , inp_pad_vip1 = 1 , inp_pad_vip2 = 2 , inp_pad_vip3 = 3 ,
  inp_pad_vsupply_x_0_25 = 4 , inp_pad_vsupply_x_0_5 = 5 , inp_pad_vsupply_x_0_75 = 6 , inp_pad_floating = 7
}
 Positive Input Pin Selection. More...
 
enum  opamp_cfg_preset_chn_t {
  cfg_preset_0 = OPAMP_CFG_PRESET0 , cfg_preset_1 = OPAMP_CFG_PRESET1 , cfg_preset_2 = OPAMP_CFG_PRESET2 , cfg_preset_3 = OPAMP_CFG_PRESET3 ,
  cfg_preset_4 = OPAMP_CFG_PRESET4 , cfg_preset_5 = OPAMP_CFG_PRESET5 , cfg_preset_6 = OPAMP_CFG_PRESET6 , cfg_preset_7 = OPAMP_CFG_PRESET7
}
 opamp preset channel More...
 
enum  opamp_mode_t {
  mode_follow = 0 , mode_invert_intern_vol = 1 , mode_invert_extern_vol = 2 , mode_invert_dac_vol = 3 ,
  mode_non_invert_gnd_vol = 4 , mode_non_invert_extern_vol = 5 , mode_non_invert_dac_vol = 6 , mode_user = 7
}
 operational amplifier More...
 

Functions

hpm_stat_t opamp_init (OPAMP_Type *opamp, opamp_cfg_t *cfg)
 opamp initialisation functions Use this function to initialise the op-amp to different modes More...
 
static void opamp_enable (OPAMP_Type *opamp)
 enable opamp function More...
 
static void opamp_preset_opamp_enable (OPAMP_Type *opamp, uint8_t preset_chn)
 preset enable opamp function More...
 
static void opamp_disable (OPAMP_Type *opamp)
 disable opamp function More...
 
static void opamp_preset_opamp_disable (OPAMP_Type *opamp, uint8_t preset_chn)
 preset disable opamp function More...
 
static void opamp_miller_cap_select (OPAMP_Type *opamp, opamp_miller_cap_t select)
 opamp miller cap selection More...
 
static void opamp_preset_miller_cap_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_miller_cap_t select)
 opamp miller cap selection preset More...
 
static void opamp_phase_margin_cap_enable (OPAMP_Type *opamp)
 enable phase margin compensation cap More...
 
static void opamp_preset_phase_margin_cap_enable (OPAMP_Type *opamp, uint8_t preset_chn)
 enable phase margin compensation cap preset More...
 
static void opamp_phase_margin_cap_disable (OPAMP_Type *opamp)
 disable phase margin compensation cap More...
 
static void opamp_preset_phase_margin_cap_disable (OPAMP_Type *opamp, uint8_t preset_chn)
 disable phase margin compensation cap preset More...
 
static void opamp_inn_pad_select (OPAMP_Type *opamp, opamp_inm_pad_t select)
 opamp core inm connect pad More...
 
static void opamp_preset_inn_pad_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_inm_pad_t select)
 opamp core inm connect pad preset More...
 
static void opamp_gain_select (OPAMP_Type *opamp, opamp_gain_t select)
 main string resistor selection More...
 
static void opamp_preset_gain_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_gain_t select)
 main string resistor selection preset More...
 
static void opamp_disconnect_vssa (OPAMP_Type *opamp)
 disconnect the main series resistor and VSSA More...
 
static void opamp_preset_disconnect_vssa (OPAMP_Type *opamp, uint8_t preset_chn)
 disconnect the main series resistor and VSSA preset More...
 
static void opamp_connect_vssa (OPAMP_Type *opamp)
 connect the main series resistor and VSSA More...
 
static void opamp_preset_connect_vssa (OPAMP_Type *opamp, uint8_t preset_chn)
 connect the main series resistor and VSSA preset More...
 
static void opamp_inp_pad_select (OPAMP_Type *opamp, opamp_inp_pad_t select)
 opamp inp select More...
 
static void opamp_preset_inp_pad_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_inp_pad_t select)
 opamp inp select preset More...
 
static uint8_t opamp_get_cur_preset (OPAMP_Type *opamp)
 opamp get current preset More...
 
static bool opamp_get_is_preset (OPAMP_Type *opamp)
 get the current preset value More...
 
static uint8_t opamp_get_trig_conflict_status (OPAMP_Type *opamp)
 Get the trigger conflict status. More...
 
static void opamp_clear_conflict_status (OPAMP_Type *opamp)
 Clear the trigger conflict status. More...
 
static void opamp_set_sw_preset_val (OPAMP_Type *opamp, opamp_cfg_preset_chn_t val)
 Set opamp preset value. More...
 
static void opamp_enable_sw_preset (OPAMP_Type *opamp)
 Enable software preset. More...
 
static void opamp_disable_sw_preset (OPAMP_Type *opamp)
 Disable software preset. More...
 
static void opamp_set_preset_x_chn (OPAMP_Type *opamp, uint8_t preset_chn, uint8_t chn)
 Set preset x channel value. More...
 
hpm_stat_t opamp_set_preset_cfg (OPAMP_Type *opamp, uint8_t preset_chn, opamp_cfg_t *cfg)
 Set preset cfg. More...
 
static void opamp_preset_enable_hw_trig (OPAMP_Type *opamp, uint8_t preset_chn)
 opamp enable preset hardware trig More...
 
static void opamp_preset_disable_hw_trig (OPAMP_Type *opamp, uint8_t preset_chn)
 opamp disable preset hardware trig More...
 
static void opamp_mode_set (OPAMP_Type *opamp, uint8_t mode)
 opamp set mode More...
 
static void opamp_preset_mode_set (OPAMP_Type *opamp, uint8_t preset_chn, uint8_t mode)
 opamp preset set mode More...
 

Detailed Description

OPMAP driver APIs.

Macro Definition Documentation

◆ OPAMP_MODE_FOLLOW_KEY

#define OPAMP_MODE_FOLLOW_KEY   (0x06)

◆ OPAMP_MODE_INVERT_INDEX0_KEY

#define OPAMP_MODE_INVERT_INDEX0_KEY   (0x08)

◆ OPAMP_MODE_INVERT_INDEX1_KEY

#define OPAMP_MODE_INVERT_INDEX1_KEY   (0x18)

◆ OPAMP_MODE_NON_INVERT_INDEX0_KEY

#define OPAMP_MODE_NON_INVERT_INDEX0_KEY   (0x01)

◆ OPAMP_MODE_NON_INVERT_INDEX1_KEY

#define OPAMP_MODE_NON_INVERT_INDEX1_KEY   (0x09)

◆ OPAMP_MODE_NON_INVERT_INDEX2_KEY

#define OPAMP_MODE_NON_INVERT_INDEX2_KEY   (0x11)

◆ OPAMP_MODE_NON_INVERT_INDEX3_KEY

#define OPAMP_MODE_NON_INVERT_INDEX3_KEY   (0x19)

◆ OPAMP_MODE_NON_INVERT_INDEX4_KEY

#define OPAMP_MODE_NON_INVERT_INDEX4_KEY   (0x09)

◆ OPAMP_MODE_USER_DEFINE_KEY

#define OPAMP_MODE_USER_DEFINE_KEY   (0x04)

Typedef Documentation

◆ opamp_cfg_t

◆ opamp_ctrl_cfg_preset0_t

#include <drivers/inc/hpm_opamp_drv.h>

opamp configuration preset0

◆ opamp_ctrl_cfg_preset1_t

#include <drivers/inc/hpm_opamp_drv.h>

opamp configuration preset1

Enumeration Type Documentation

◆ opamp_cfg_preset_chn_t

#include <drivers/inc/hpm_opamp_drv.h>

opamp preset channel

Enumerator
cfg_preset_0 
cfg_preset_1 
cfg_preset_2 
cfg_preset_3 
cfg_preset_4 
cfg_preset_5 
cfg_preset_6 
cfg_preset_7 

◆ opamp_gain_t

#include <drivers/inc/hpm_opamp_drv.h>

Gain multiplier selection.

Enumerator
gain_x_2 

gain x2

gain_x_4 
gain_x_8 
gain_x_16 
gain_x_32 
gain_x_64 
gain_x_128 

gain x128

◆ opamp_inm_pad_t

#include <drivers/inc/hpm_opamp_drv.h>

Reverse Input Pin Selection.

Enumerator
inm_pad_vim0 

Connect pad vim0

inm_pad_vim1 

Connect pad vim1

inm_pad_vim2 

Connect pad vim2 or dac pin

inm_pad_vim3 

Connect pad vim3

inm_pad_floating 

Connect inm floating

◆ opamp_inp_pad_t

#include <drivers/inc/hpm_opamp_drv.h>

Positive Input Pin Selection.

Enumerator
inp_pad_vip0 

Connect pad vip0

inp_pad_vip1 

Connect pad vip1

inp_pad_vip2 

Connect pad vip2 or dac pin

inp_pad_vip3 

Connect pad vip3

inp_pad_vsupply_x_0_25 

Connect reference = 0.25 * vsupply

inp_pad_vsupply_x_0_5 

Connect reference = 0.5 * vsupply

inp_pad_vsupply_x_0_75 

Connect reference = 0.75 * vsupply

inp_pad_floating 

Connect inp floating

◆ opamp_miller_cap_t

#include <drivers/inc/hpm_opamp_drv.h>

Miller Capacitor Selection.

Enumerator
miller_cap_x_7 

7 unit cap

miller_cap_x_8 
miller_cap_x_10 
miller_cap_x_13 
miller_cap_x_15 

15 unit cap

miller_cap_x_18 
miller_cap_x_5 
miller_cap_x_6 

6 unit cap

◆ opamp_mode_t

#include <drivers/inc/hpm_opamp_drv.h>

operational amplifier

Enumerator
mode_follow 

opamp follow mode

mode_invert_intern_vol 

inverting opamp

mode_invert_extern_vol 

inverted amplification mode, external reference voltage

mode_invert_dac_vol 

inverted amplification mode, DAC output reference voltage

mode_non_invert_gnd_vol 

forward amplification mode, GND is the reference voltage

mode_non_invert_extern_vol 

forward amplification mode, external reference voltage

mode_non_invert_dac_vol 

forward amplification mode, DAC output reference voltage

mode_user 

custom Mode

Function Documentation

◆ opamp_clear_conflict_status()

static void opamp_clear_conflict_status ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

Clear the trigger conflict status.

Parameters
opampOPAMP_Type

◆ opamp_connect_vssa()

static void opamp_connect_vssa ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

connect the main series resistor and VSSA

Parameters
opampOPAMP_Type

◆ opamp_disable()

static void opamp_disable ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

disable opamp function

Parameters
opampOPAMP_Type

◆ opamp_disable_sw_preset()

static void opamp_disable_sw_preset ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

Disable software preset.

Parameters
opampOPAMP_Type

◆ opamp_disconnect_vssa()

static void opamp_disconnect_vssa ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

disconnect the main series resistor and VSSA

Parameters
opampOPAMP_Type

◆ opamp_enable()

static void opamp_enable ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

enable opamp function

Parameters
opampOPAMP_Type

◆ opamp_enable_sw_preset()

static void opamp_enable_sw_preset ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

Enable software preset.

Parameters
opampOPAMP_Type

◆ opamp_gain_select()

static void opamp_gain_select ( OPAMP_Type opamp,
opamp_gain_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

main string resistor selection

Parameters
opampOPAMP_Type
selectopamp_gain_t

◆ opamp_get_cur_preset()

static uint8_t opamp_get_cur_preset ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp get current preset

Parameters
opampOPAMP_Type
Returns
value

◆ opamp_get_is_preset()

static bool opamp_get_is_preset ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

get the current preset value

Parameters
opampOPAMP_Type
Returns
true one of cur_preset is selected for opamp
false opamp use cfg0 parameters

◆ opamp_get_trig_conflict_status()

static uint8_t opamp_get_trig_conflict_status ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

Get the trigger conflict status.

Parameters
opampOPAMP_Type
Returns
if more than one hardware trigger is set, will put all trigger input there.

◆ opamp_init()

hpm_stat_t opamp_init ( OPAMP_Type opamp,
opamp_cfg_t cfg 
)

#include <drivers/inc/hpm_opamp_drv.h>

opamp initialisation functions Use this function to initialise the op-amp to different modes

Parameters
opampOPAMP_Type
cfgopamp_cfg_t
Returns
hpm_stat_t

◆ opamp_inn_pad_select()

static void opamp_inn_pad_select ( OPAMP_Type opamp,
opamp_inm_pad_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp core inm connect pad

Parameters
opampOPAMP_Type
selectopamp_inm_pad_t

◆ opamp_inp_pad_select()

static void opamp_inp_pad_select ( OPAMP_Type opamp,
opamp_inp_pad_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp inp select

Parameters
opampOPAMP_Type
selectopamp_inp_pad_t

◆ opamp_miller_cap_select()

static void opamp_miller_cap_select ( OPAMP_Type opamp,
opamp_miller_cap_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp miller cap selection

Parameters
opampOPAMP_Type
selectopamp_miller_cap_t

◆ opamp_mode_set()

static void opamp_mode_set ( OPAMP_Type opamp,
uint8_t  mode 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp set mode

Parameters
opampOPAMP_Type
modeOPAMP_MODE_XX

◆ opamp_phase_margin_cap_disable()

static void opamp_phase_margin_cap_disable ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

disable phase margin compensation cap

Parameters
opampOPAMP_Type

◆ opamp_phase_margin_cap_enable()

static void opamp_phase_margin_cap_enable ( OPAMP_Type opamp)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

enable phase margin compensation cap

Parameters
opampOPAMP_Type

◆ opamp_preset_connect_vssa()

static void opamp_preset_connect_vssa ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

connect the main series resistor and VSSA preset

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_disable_hw_trig()

static void opamp_preset_disable_hw_trig ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp disable preset hardware trig

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_disconnect_vssa()

static void opamp_preset_disconnect_vssa ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

disconnect the main series resistor and VSSA preset

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_enable_hw_trig()

static void opamp_preset_enable_hw_trig ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp enable preset hardware trig

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_gain_select()

static void opamp_preset_gain_select ( OPAMP_Type opamp,
uint8_t  preset_chn,
opamp_gain_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

main string resistor selection preset

Parameters
opampOPAMP_Type
preset_chnpreset channel
selectopamp_gain_t

◆ opamp_preset_inn_pad_select()

static void opamp_preset_inn_pad_select ( OPAMP_Type opamp,
uint8_t  preset_chn,
opamp_inm_pad_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp core inm connect pad preset

Parameters
opampOPAMP_Type
preset_chnpreset channel
selectopamp_inm_pad_t

◆ opamp_preset_inp_pad_select()

static void opamp_preset_inp_pad_select ( OPAMP_Type opamp,
uint8_t  preset_chn,
opamp_inp_pad_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp inp select preset

Parameters
opampOPAMP_Type
preset_chnpreset channel
selectopamp_inp_pad_t

◆ opamp_preset_miller_cap_select()

static void opamp_preset_miller_cap_select ( OPAMP_Type opamp,
uint8_t  preset_chn,
opamp_miller_cap_t  select 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp miller cap selection preset

Parameters
opampOPAMP_Type
preset_chnpreset channel
selectopamp_miller_cap_t

◆ opamp_preset_mode_set()

static void opamp_preset_mode_set ( OPAMP_Type opamp,
uint8_t  preset_chn,
uint8_t  mode 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

opamp preset set mode

Parameters
opampOPAMP_Type
preset_chnpreset channel
modeOPAMP_MODE_XX

◆ opamp_preset_opamp_disable()

static void opamp_preset_opamp_disable ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

preset disable opamp function

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_opamp_enable()

static void opamp_preset_opamp_enable ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

preset enable opamp function

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_phase_margin_cap_disable()

static void opamp_preset_phase_margin_cap_disable ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

disable phase margin compensation cap preset

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_preset_phase_margin_cap_enable()

static void opamp_preset_phase_margin_cap_enable ( OPAMP_Type opamp,
uint8_t  preset_chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

enable phase margin compensation cap preset

Parameters
opampOPAMP_Type
preset_chnpreset channel

◆ opamp_set_preset_cfg()

hpm_stat_t opamp_set_preset_cfg ( OPAMP_Type opamp,
uint8_t  preset_chn,
opamp_cfg_t cfg 
)

#include <drivers/inc/hpm_opamp_drv.h>

Set preset cfg.

Parameters
opampOPAMP_Type
preset_chnpreset channel
cfgopamp_cfg_t
Returns
hpm_stat_t

◆ opamp_set_preset_x_chn()

static void opamp_set_preset_x_chn ( OPAMP_Type opamp,
uint8_t  preset_chn,
uint8_t  chn 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

Set preset x channel value.

Parameters
opampOPAMP_Type
preset_chnpreset channel
chnchannel

◆ opamp_set_sw_preset_val()

static void opamp_set_sw_preset_val ( OPAMP_Type opamp,
opamp_cfg_preset_chn_t  val 
)
inlinestatic

#include <drivers/inc/hpm_opamp_drv.h>

Set opamp preset value.

Parameters
opampOPAMP_Type
valopamp_cfg_preset_chn_t