Microchip® Advanced Software Framework

opamp.h File Reference

SAM Operational Amplifier Controller (OPAMP) Driver.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <system.h>

Data Structures

struct  opamp0_config
 OPAMP 0 configuration structure. More...
 
struct  opamp1_config
 OPAMP 1 configuration structure. More...
 
struct  opamp2_config
 OPAMP 2 configuration structure. More...
 
struct  opamp_config_common
 OPAMP 0 to 2 common configuration structure. More...
 

Enumerations

enum  opamp0_neg_mux {
  OPAMP0_NEG_MUX_PIN0 = OPAMP_OPAMPCTRL_MUXNEG(0),
  OPAMP0_NEG_MUX_TAP0 = OPAMP_OPAMPCTRL_MUXNEG(1),
  OPAMP0_NEG_MUX_OUT0 = OPAMP_OPAMPCTRL_MUXNEG(2),
  OPAMP0_NEG_MUX_DAC = OPAMP_OPAMPCTRL_MUXNEG(3)
}
 Negative input MUX selection configuration enum. More...
 
enum  opamp0_pos_mux {
  OPAMP0_POS_MUX_PIN0 = OPAMP_OPAMPCTRL_MUXPOS(0),
  OPAMP0_POS_MUX_TAP0 = OPAMP_OPAMPCTRL_MUXPOS(1),
  OPAMP0_POS_MUX_DAC = OPAMP_OPAMPCTRL_MUXPOS(2),
  OPAMP0_POS_MUX_GND = OPAMP_OPAMPCTRL_MUXPOS(3)
}
 Positive input MUX selection configuration enum. More...
 
enum  opamp0_res1_mux {
  OPAMP0_RES1_MUX_POS_PIN0 = OPAMP_OPAMPCTRL_RES1MUX(0),
  OPAMP0_RES1_MUX_NEG_PIN0 = OPAMP_OPAMPCTRL_RES1MUX(1),
  OPAMP0_RES1_MUX_DAC = OPAMP_OPAMPCTRL_RES1MUX(2),
  OPAMP0_RES1_MUX_GND = OPAMP_OPAMPCTRL_RES1MUX(3)
}
 Resistor 1 MUX selection configuration enum. More...
 
enum  opamp1_neg_mux {
  OPAMP1_NEG_MUX_PIN1 = OPAMP_OPAMPCTRL_MUXNEG(0),
  OPAMP1_NEG_MUX_TAP1 = OPAMP_OPAMPCTRL_MUXNEG(1),
  OPAMP1_NEG_MUX_OUT1 = OPAMP_OPAMPCTRL_MUXNEG(2),
  OPAMP1_NEG_MUX_DAC = OPAMP_OPAMPCTRL_MUXNEG(3)
}
 Negative input MUX selection configuration enum. More...
 
enum  opamp1_pos_mux {
  OPAMP1_POS_MUX_PIN1 = OPAMP_OPAMPCTRL_MUXPOS(0),
  OPAMP1_POS_MUX_TAP1 = OPAMP_OPAMPCTRL_MUXPOS(1),
  OPAMP1_POS_MUX_OUT0 = OPAMP_OPAMPCTRL_MUXPOS(2),
  OPAMP1_POS_MUX_GND = OPAMP_OPAMPCTRL_MUXPOS(3)
}
 Positive input MUX selection configuration enum. More...
 
enum  opamp1_res1_mux {
  OPAMP1_RES1_MUX_POS_PIN0 = OPAMP_OPAMPCTRL_RES1MUX(0),
  OPAMP1_RES1_MUX_NEG_PIN0 = OPAMP_OPAMPCTRL_RES1MUX(1),
  OPAMP1_RES1_MUX_OUT0 = OPAMP_OPAMPCTRL_RES1MUX(2),
  OPAMP1_RES1_MUX_GND = OPAMP_OPAMPCTRL_RES1MUX(3)
}
 Resistor 1 MUX selection configuration enum. More...
 
enum  opamp2_neg_mux {
  OPAMP2_NEG_MUX_PIN2 = OPAMP_OPAMPCTRL_MUXNEG(0),
  OPAMP2_NEG_MUX_TAP2 = OPAMP_OPAMPCTRL_MUXNEG(1),
  OPAMP2_NEG_MUX_OUT2 = OPAMP_OPAMPCTRL_MUXNEG(2),
  OPAMP2_NEG_MUX_PIN0 = OPAMP_OPAMPCTRL_MUXNEG(3),
  OPAMP2_NEG_MUX_PIN1 = OPAMP_OPAMPCTRL_MUXNEG(4),
  OPAMP2_NEG_MUX_DAC = OPAMP_OPAMPCTRL_MUXNEG(5)
}
 Negative input MUX selection configuration enum. More...
 
enum  opamp2_pos_mux {
  OPAMP2_POS_MUX_PIN2 = OPAMP_OPAMPCTRL_MUXPOS(0),
  OPAMP2_POS_MUX_TAP2 = OPAMP_OPAMPCTRL_MUXPOS(1),
  OPAMP2_POS_MUX_OUT1 = OPAMP_OPAMPCTRL_MUXPOS(2),
  OPAMP2_POS_MUX_GND = OPAMP_OPAMPCTRL_MUXPOS(3),
  OPAMP2_POS_MUX_PIN0 = OPAMP_OPAMPCTRL_MUXPOS(4),
  OPAMP2_POS_MUX_PIN1 = OPAMP_OPAMPCTRL_MUXPOS(5),
  OPAMP2_POS_MUX_TAP0 = OPAMP_OPAMPCTRL_MUXPOS(6)
}
 Positive input MUX selection configuration enum. More...
 
enum  opamp2_res1_mux {
  OPAMP2_RES1_MUX_POS_PIN0 = OPAMP_OPAMPCTRL_RES1MUX(0),
  OPAMP2_RES1_MUX_NEG_PIN0 = OPAMP_OPAMPCTRL_RES1MUX(1),
  OPAMP2_RES1_MUX_OUT1 = OPAMP_OPAMPCTRL_RES1MUX(2),
  OPAMP2_RES1_MUX_GND = OPAMP_OPAMPCTRL_RES1MUX(3)
}
 Resistor 1 MUX selection configuration enum. More...
 
enum  opamp_bias_selection {
  OPAMP_BIAS_MODE_0 = OPAMP_OPAMPCTRL_BIAS(0),
  OPAMP_BIAS_MODE_1 = OPAMP_OPAMPCTRL_BIAS(1),
  OPAMP_BIAS_MODE_2 = OPAMP_OPAMPCTRL_BIAS(2),
  OPAMP_BIAS_MODE_3 = OPAMP_OPAMPCTRL_BIAS(3)
}
 Bias mode selection MUX configuration enum. More...
 
enum  opamp_id {
  OPAMP_0 = 0,
  OPAMP_1 = 1,
  OPAMP_2 = 2,
  OPAMP_NUM
}
 OPAMP ID number enum. More...
 
enum  opamp_pot_mux {
  OPAMP_POT_MUX_14R_2R = OPAMP_OPAMPCTRL_POTMUX(0),
  OPAMP_POT_MUX_12R_4R = OPAMP_OPAMPCTRL_POTMUX(1),
  OPAMP_POT_MUX_8R_8R = OPAMP_OPAMPCTRL_POTMUX(2),
  OPAMP_POT_MUX_6R_10R = OPAMP_OPAMPCTRL_POTMUX(3),
  OPAMP_POT_MUX_4R_12R = OPAMP_OPAMPCTRL_POTMUX(4),
  OPAMP_POT_MUX_3R_13R = OPAMP_OPAMPCTRL_POTMUX(5),
  OPAMP_POT_MUX_2R_14R = OPAMP_OPAMPCTRL_POTMUX(6),
  OPAMP_POT_MUX_R_15R = OPAMP_OPAMPCTRL_POTMUX(7)
}
 Potentiometer selection MUX configuration enum. More...
 

Functions

void opamp0_get_config_defaults (struct opamp0_config *const config)
 Initializes all members of OPAMP0 configuration structure to safe defaults. More...
 
void opamp0_set_config (struct opamp0_config *const config)
 Writes OPAMP0 configuration to the hardware module. More...
 
void opamp1_get_config_defaults (struct opamp1_config *const config)
 Initializes all members of OPAMP1 configuration structure to safe defaults. More...
 
void opamp1_set_config (struct opamp1_config *const config)
 Writes OPAMP1 configuration to the hardware module. More...
 
void opamp2_get_config_defaults (struct opamp2_config *const config)
 Initializes all members of OPAMP2 configuration structure to safe defaults. More...
 
void opamp2_set_config (struct opamp2_config *const config)
 Writes OPAMP2 configuration to the hardware module. More...
 
void opamp_disable (const enum opamp_id number)
 Disables an OPAMP that was previously enabled. More...
 
void opamp_enable (const enum opamp_id number)
 Enables an OPAMP that was previously configured. More...
 
bool opamp_is_ready (const enum opamp_id number)
 Checks an OPAMP output ready status. More...
 
static void opamp_module_disable (void)
 Disables OPAMP module. More...
 
static void opamp_module_enable (void)
 Enables OPAMP module. More...
 
void opamp_module_init (void)
 Initializes OPAMP module. More...
 
static void opamp_module_reset (void)
 Resets OPAMP module. More...
 
static void opamp_voltage_doubler_disable (void)
 Disables OPAMP voltage doubler. More...
 
static void opamp_voltage_doubler_enable (void)
 Enables OPAMP voltage doubler. More...