AD7746 Capacitance-to-digital converter with temperature sensor driver. More...

Detailed Description

AD7746 Capacitance-to-digital converter with temperature sensor driver.

Leandro Lanzieri

Definition in file ad7746.h.

#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for ad7746.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ad7746_params
 AD7746 params. More...
struct  ad7746
 AD7746 device descriptor. More...


#define AD7746_ZERO_SCALE_CODE   (0x800000LL)
 0 fF capacitance code
#define AD7746_INTERNAL_VREF   (1170)
 Interval voltage reference expressed in mV.
#define AD7746_DAC_MAX   (0x7F)
 Maximum value that can be configured into the DACs.


typedef struct ad7746_params ad7746_params_t
 AD7746 params.
typedef struct ad7746 ad7746_t
 AD7746 device descriptor.


enum  { AD7746_READ_CAP_CH = 0, AD7746_READ_VT_CH = 1 }
 Channel numbers for reading. More...
enum  { AD7746_OK = 0, AD7746_NOI2C = -1, AD7746_NODEV = -2, AD7746_NODATA = -3 }
 Named return values. More...
enum  ad7746_vt_sample_rate_t { AD7746_VT_SR_498 = 0, AD7746_VT_SR_312 = 1, AD7746_VT_SR_161 = 2, AD7746_VT_SR_082 = 3 }
 Voltage / Temperature channel sample rates. More...
enum  ad7746_vt_mode_t {
  AD7746_VT_MD_DIS = -1, AD7746_VT_MD_TEMP = 0, AD7746_VT_MD_ETEMP = 1, AD7746_VT_MD_VDD = 2,
  AD7746_VT_MD_VIN = 3
 Voltage / Temperature channel modes. More...
enum  ad7746_cap_input_t { AD7746_CAP_IN_1 = 0, AD7746_CAP_IN_2 }
 Capacitance channel input. More...
enum  ad7746_cap_sample_rate_t {
  AD7746_CAP_SR_909 = 0, AD7746_CAP_SR_838 = 1, AD7746_CAP_SR_500 = 2, AD7746_CAP_SR_263 = 3,
  AD7746_CAP_SR_161 = 4, AD7746_CAP_SR_130 = 5, AD7746_CAP_SR_109 = 6, AD7746_CAP_SR_091 = 7
 Capacitive channel sample rate. More...
enum  ad7746_exc_config_t { AD7746_EXC_A = 0x06, AD7746_EXC_B = 0x09, AD7746_EXC_AB = 0x0A }
 Excitation signal output configuration. More...


int ad7746_init (ad7746_t *dev, const ad7746_params_t *params)
 Initializes an AD7746 device. More...
int ad7746_read_capacitance_1 (ad7746_t *dev, int *value)
 Reads the capacitance from the input 1 (CIN1). More...
int ad7746_read_capacitance_2 (ad7746_t *dev, int *value)
 Reads the capacitance from the input 2 (CIN2). More...
int ad7746_read_voltage_in (ad7746_t *dev, int *value)
 Reads the voltage from the external voltage input (VIN). More...
int ad7746_read_voltage_vdd (ad7746_t *dev, int *value)
 Reads the voltage from the VDD pin. More...
int ad7746_read_temperature_int (ad7746_t *dev, int *value)
 Reads the temperature from the internal sensor. More...
int ad7746_read_temperature_ext (ad7746_t *dev, int *value)
 Reads the temperature from the external sensor (see datasheet). More...
int ad7746_set_cap_ch_input (const ad7746_t *dev, ad7746_cap_input_t input)
 Sets the current input for the capacitive measurement.If not configured manually, the driver sets the correct mode within the dedicated read function. More...
int ad7746_set_vt_ch_mode (ad7746_t *dev, ad7746_vt_mode_t mode)
 Sets the mode for the voltage / temperature channel and updates the descriptor with the new configuration. More...
int ad7746_set_vt_sr (const ad7746_t *dev, ad7746_vt_sample_rate_t sr)
 Sets the sample rate for the voltage / temperature channel. More...
int ad7746_set_cap_sr (const ad7746_t *dev, ad7746_cap_sample_rate_t sr)
 Sets the sample rate for the capacitance channel. More...