Loading...
Searching...
No Matches
ad7746.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 HAW Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#include "periph/i2c.h"
48#include "periph/gpio.h"
49
53#define AD7746_ZERO_SCALE_CODE (0x800000LL)
54
58#define AD7746_INTERNAL_VREF (1170)
59
63#define AD7746_DAC_MAX (0x7F)
64
68enum {
71};
72
76enum {
81};
82
92
103
111
125
129typedef enum {
134
149
156
167int ad7746_init(ad7746_t *dev, const ad7746_params_t *params);
168
186
204
222int ad7746_read_voltage_in(ad7746_t *dev, int *value);
223
240int ad7746_read_voltage_vdd(ad7746_t *dev, int *value);
241
259
277
290
303
314
325
326#ifdef __cplusplus
327}
328#endif
329
Low-level GPIO peripheral driver interface definitions.
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...
struct ad7746 ad7746_t
AD7746 device descriptor.
ad7746_exc_config_t
Excitation signal output configuration.
Definition ad7746.h:129
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 configura...
ad7746_cap_input_t
Capacitance channel input.
Definition ad7746.h:107
int ad7746_read_capacitance_2(ad7746_t *dev, int *value)
Reads the capacitance from the input 2 (CIN2).
int ad7746_init(ad7746_t *dev, const ad7746_params_t *params)
Initializes an AD7746 device.
ad7746_vt_mode_t
Voltage / Temperature channel modes.
Definition ad7746.h:96
int ad7746_read_voltage_in(ad7746_t *dev, int *value)
Reads the voltage from the external voltage input (VIN).
int ad7746_set_vt_sr(const ad7746_t *dev, ad7746_vt_sample_rate_t sr)
Sets the sample rate for the voltage / temperature channel.
int ad7746_read_capacitance_1(ad7746_t *dev, int *value)
Reads the capacitance from the input 1 (CIN1).
int ad7746_read_temperature_ext(ad7746_t *dev, int *value)
Reads the temperature from the external sensor (see datasheet).
struct ad7746_params ad7746_params_t
AD7746 params.
ad7746_vt_sample_rate_t
Voltage / Temperature channel sample rates.
Definition ad7746.h:86
int ad7746_read_voltage_vdd(ad7746_t *dev, int *value)
Reads the voltage from the VDD pin.
int ad7746_set_cap_sr(const ad7746_t *dev, ad7746_cap_sample_rate_t sr)
Sets the sample rate for the capacitance channel.
ad7746_cap_sample_rate_t
Capacitive channel sample rate.
Definition ad7746.h:115
int ad7746_read_temperature_int(ad7746_t *dev, int *value)
Reads the temperature from the internal sensor.
@ AD7746_EXC_B
enable only exc B output
Definition ad7746.h:131
@ AD7746_EXC_AB
enable exc A and B outputs
Definition ad7746.h:132
@ AD7746_EXC_A
enable only exc A output
Definition ad7746.h:130
@ AD7746_CAP_IN_1
CIN1 input.
Definition ad7746.h:108
@ AD7746_CAP_IN_2
CIN2 input.
Definition ad7746.h:109
@ AD7746_VT_MD_TEMP
internal temperature sensor
Definition ad7746.h:98
@ AD7746_VT_MD_DIS
channel disabled
Definition ad7746.h:97
@ AD7746_VT_MD_VDD
Vdd voltage monitor.
Definition ad7746.h:100
@ AD7746_VT_MD_ETEMP
external temperature sensor (see datasheet)
Definition ad7746.h:99
@ AD7746_VT_MD_VIN
external voltage input (Vin)
Definition ad7746.h:101
@ AD7746_VT_SR_082
8.2 Hz
Definition ad7746.h:90
@ AD7746_VT_SR_312
31.2 Hz
Definition ad7746.h:88
@ AD7746_VT_SR_498
49.8 Hz
Definition ad7746.h:87
@ AD7746_VT_SR_161
16.1 Hz
Definition ad7746.h:89
@ AD7746_READ_VT_CH
read voltage / temperature channel
Definition ad7746.h:70
@ AD7746_READ_CAP_CH
read capacitive channel
Definition ad7746.h:69
@ AD7746_CAP_SR_109
10.9 Hz
Definition ad7746.h:122
@ AD7746_CAP_SR_130
13.0 Hz
Definition ad7746.h:121
@ AD7746_CAP_SR_263
26.3 Hz
Definition ad7746.h:119
@ AD7746_CAP_SR_500
50.0 Hz
Definition ad7746.h:118
@ AD7746_CAP_SR_161
16.1 Hz
Definition ad7746.h:120
@ AD7746_CAP_SR_091
9.1 Hz
Definition ad7746.h:123
@ AD7746_CAP_SR_909
90.9 Hz
Definition ad7746.h:116
@ AD7746_CAP_SR_838
83.8 Hz
Definition ad7746.h:117
@ AD7746_NOI2C
I2C communication failed.
Definition ad7746.h:78
@ AD7746_OK
everything was fine
Definition ad7746.h:77
@ AD7746_NODEV
no AD7746 device found on the bus
Definition ad7746.h:79
@ AD7746_NODATA
no data available
Definition ad7746.h:80
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
AD7746 params.
Definition ad7746.h:138
uint8_t addr
i2c address
Definition ad7746.h:140
i2c_t i2c
i2c device
Definition ad7746.h:139
ad7746_exc_config_t exc_config
excitation signal config
Definition ad7746.h:143
ad7746_vt_mode_t vt_mode
mode of the voltage/temp ch
Definition ad7746.h:146
ad7746_cap_sample_rate_t cap_sample_rate
capacitance sample rate
Definition ad7746.h:144
uint8_t dac_b_cap
DAC B capacitance.
Definition ad7746.h:142
ad7746_cap_input_t cap_input
selected capacitance input
Definition ad7746.h:147
uint8_t dac_a_cap
DAC A capacitance.
Definition ad7746.h:141
ad7746_vt_sample_rate_t vt_sample_rate
voltage/temp sample rate
Definition ad7746.h:145
AD7746 device descriptor.
Definition ad7746.h:153
ad7746_params_t params
device driver configuration
Definition ad7746.h:154