Go to the documentation of this file.
49 #define AD7746_ADDRESS 0x48
52 #define AD7746_RESET_CMD 0xBF
55 #define AD7746_REG_STATUS 0u
56 #define AD7746_REG_CAP_DATA_HIGH 1u
57 #define AD7746_REG_CAP_DATA_MID 2u
58 #define AD7746_REG_CAP_DATA_LOW 3u
59 #define AD7746_REG_VT_DATA_HIGH 4u
60 #define AD7746_REG_VT_DATA_MID 5u
61 #define AD7746_REG_VT_DATA_LOW 6u
62 #define AD7746_REG_CAP_SETUP 7u
63 #define AD7746_REG_VT_SETUP 8u
64 #define AD7746_REG_EXC_SETUP 9u
65 #define AD7746_REG_CFG 10u
66 #define AD7746_REG_CAPDACA 11u
67 #define AD7746_REG_CAPDACB 12u
68 #define AD7746_REG_CAP_OFFH 13u
69 #define AD7746_REG_CAP_OFFL 14u
70 #define AD7746_REG_CAP_GAINH 15u
71 #define AD7746_REG_CAP_GAINL 16u
72 #define AD7746_REG_VOLT_GAINH 17u
73 #define AD7746_REG_VOLT_GAINL 18u
75 #define AD7746_NUM_REGISTERS (AD7746_REG_VOLT_GAINL + 1u)
78 #define AD7746_STATUS_EXCERR_MSK NO_OS_BIT(3)
79 #define AD7746_STATUS_RDY_MSK NO_OS_BIT(2)
80 #define AD7746_STATUS_RDYVT_MSK NO_OS_BIT(1)
81 #define AD7746_STATUS_RDYCAP_MSK NO_OS_BIT(0)
84 #define AD7746_CAPSETUP_CAPEN_MSK NO_OS_BIT(7)
85 #define AD7746_CAPSETUP_CIN2_MSK NO_OS_BIT(6)
86 #define AD7746_CAPSETUP_CAPDIFF_MSK NO_OS_BIT(5)
87 #define AD7746_CAPSETUP_CAPCHOP_MSK NO_OS_BIT(0)
90 #define AD7746_VTSETUP_VTEN_MSK NO_OS_BIT(7)
91 #define AD7746_VTSETUP_VTMD_MSK NO_OS_GENMASK(6,5)
92 #define AD7746_VTSETUP_EXTREF_MSK NO_OS_BIT(4)
93 #define AD7746_VTSETUP_VTSHORT_MSK NO_OS_BIT(1)
94 #define AD7746_VTSETUP_VTCHOP_MSK NO_OS_BIT(0)
97 #define AD7746_EXCSETUP_CLKCTRL_MSK NO_OS_BIT(7)
98 #define AD7746_EXCSETUP_EXCON_MSK NO_OS_BIT(6)
99 #define AD7746_EXCSETUP_EXCB_MSK NO_OS_GENMASK(5,4)
100 #define AD7746_EXCSETUP_EXCA_MSK NO_OS_GENMASK(3,2)
101 #define AD7746_EXCSETUP_EXCLVL_MSK NO_OS_GENMASK(1,0)
104 #define AD7746_CONF_VTF_MSK NO_OS_GENMASK(7,6)
105 #define AD7746_CONF_CAPF_MSK NO_OS_GENMASK(5,3)
106 #define AD7746_CONF_MD_MSK NO_OS_GENMASK(2,0)
109 #define AD7746_CAPDAC_DACEN_MSK NO_OS_BIT(7)
110 #define AD7746_CAPDAC_DACP_MSK NO_OS_GENMASK(6,0)
199 uint8_t* data, uint16_t bytes_number);
201 uint8_t* data, uint16_t bytes_number);
#define AD7746_CONF_CAPF_MSK
Definition: ad7746.h:105
#define AD7746_VTSETUP_VTMD_MSK
Definition: ad7746.h:91
#define AD7746_STATUS_RDYCAP_MSK
Definition: ad7746.h:81
bool cin2
Definition: ad7746.h:120
uint32_t timeout
Definition: ad413x.c:55
#define AD7746_REG_CAP_GAINH
Definition: ad7746.h:70
int32_t ad7746_set_cap_dac_a(struct ad7746_dev *dev, bool enable, uint8_t code)
Set the DAC code and enable state for EXCA.
Definition: ad7746.c:339
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:97
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:51
int32_t ad7746_set_cap_dac_b(struct ad7746_dev *dev, bool enable, uint8_t code)
Set the DAC code and enable state for EXCB.
Definition: ad7746.c:363
int32_t ad7746_init(struct ad7746_dev **device, struct ad7746_init_param *init_param)
Initialize the ad7606 device structure.
Definition: ad7746.c:59
int32_t ad7746_set_exc(struct ad7746_dev *dev, struct ad7746_exc exc)
Configure the excitation setup register.
Definition: ad7746.c:274
@ AD7746_EXCLVL_2_DIV_8
Definition: ad7746.h:148
int32_t ad7746_reg_write(struct ad7746_dev *dev, uint8_t reg, uint8_t *data, uint16_t bytes_number)
Writes data into AD7746 registers, starting from the selected register address pointer.
Definition: ad7746.c:121
bool extref
Definition: ad7746.h:135
bool vtshort
Definition: ad7746.h:136
int32_t ad7746_set_cap_offset(struct ad7746_dev *dev, uint16_t offset)
Set the capacitive offset.
Definition: ad7746.c:400
int32_t ad7746_remove(struct ad7746_dev *dev)
Deinitialize the ad7746 driver and free all allocated resources.
Definition: ad7746.c:187
#define AD7746_CAPSETUP_CAPCHOP_MSK
Definition: ad7746.h:87
#define AD7746_REG_CFG
Definition: ad7746.h:65
#define AD7746_CAPDAC_DACEN_MSK
Definition: ad7746.h:109
#define AD7746_VTSETUP_VTCHOP_MSK
Definition: ad7746.h:94
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:76
@ AD7746_EXCLVL_3_DIV_8
Definition: ad7746.h:149
#define AD7746_CONF_MD_MSK
Definition: ad7746.h:106
int32_t ad7746_remove(struct ad7746_dev *dev)
Deinitialize the ad7746 driver and free all allocated resources.
Definition: ad7746.c:187
ad7746_exc_pin
Definition: ad7746.h:140
@ AD7746_VIN_EXT_VIN
Definition: ad7746.h:129
#define AD7746_REG_CAP_SETUP
Definition: ad7746.h:62
Header file of Delay functions.
struct ad7746_setup setup
Definition: ad7746.h:193
int32_t ad7746_set_cap_dac_a(struct ad7746_dev *dev, bool enable, uint8_t code)
Set the DAC code and enable state for EXCA.
Definition: ad7746.c:339
enum ad7746_exc_pin excb
Definition: ad7746.h:156
ad7746_vtmd
Definition: ad7746.h:125
Definition: ad9361_util.h:75
@ AD7746_EXCLVL_1_DIV_8
Definition: ad7746.h:147
int32_t ad7746_get_vt_data(struct ad7746_dev *dev, uint32_t *vt_data)
Waits until a conversion on a voltage/temperature channel has been finished and returns the output da...
Definition: ad7746.c:447
@ AD7746_EXC_PIN_DISABLED
Definition: ad7746.h:141
@ AD7746_MODE_GAIN_CALIB
Definition: ad7746.h:167
@ AD7746_MODE_POWERDOWN
Definition: ad7746.h:165
int32_t ad7746_reset(struct ad7746_dev *dev)
Resets the AD7746.
Definition: ad7746.c:171
void * no_os_calloc(size_t nitems, size_t size)
ad7746_exclvl
Definition: ad7746.h:146
enum ad7746_exc_pin exca
Definition: ad7746.h:157
int32_t ad7746_set_cap(struct ad7746_dev *dev, struct ad7746_cap cap)
Configure the capacitive setup register.
Definition: ad7746.c:209
@ AD7746_MODE_CONT
Definition: ad7746.h:163
#define AD7746_VTSETUP_VTEN_MSK
Definition: ad7746.h:90
int32_t ad7746_get_vt_data(struct ad7746_dev *dev, uint32_t *vt_data)
Waits until a conversion on a voltage/temperature channel has been finished and returns the output da...
Definition: ad7746.c:447
bool capen
Definition: ad7746.h:119
#define AD7746_VTSETUP_VTSHORT_MSK
Definition: ad7746.h:93
bool excon
Definition: ad7746.h:155
int32_t ad7746_calibrate(struct ad7746_dev *dev, enum ad7746_md md)
Perform offset/gain calibration.
Definition: ad7746.c:530
@ AD7746_MODE_SINGLE
Definition: ad7746.h:164
#define AD7746_CAPSETUP_CAPEN_MSK
Definition: ad7746.h:84
@ ID_AD7746
Definition: ad7746.h:114
bool clkctrl
Definition: ad7746.h:154
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
#define AD7746_CONF_VTF_MSK
Definition: ad7746.h:104
@ AD7746_VTMD_VDD_MON
Definition: ad7746.h:128
Header file of AD7746 Driver.
struct ad7746_setup setup
Definition: ad7746.h:186
int32_t ad7746_init(struct ad7746_dev **device, struct ad7746_init_param *init_param)
Initialize the ad7606 device structure.
Definition: ad7746.c:59
@ AD7746_MODE_IDLE
Definition: ad7746.h:162
#define AD7746_EXCSETUP_EXCA_MSK
Definition: ad7746.h:100
int32_t ad7746_set_vt(struct ad7746_dev *dev, struct ad7746_vt vt)
Configure the voltage/temperature setup register.
Definition: ad7746.c:241
int32_t ad7746_set_cap_gain(struct ad7746_dev *dev, uint16_t gain)
Set the capacitive gain.
Definition: ad7746.c:415
#define AD7746_EXCSETUP_EXCON_MSK
Definition: ad7746.h:98
#define AD7746_CAPDAC_DACP_MSK
Definition: ad7746.h:110
#define AD7746_REG_CAPDACB
Definition: ad7746.h:67
#define AD7746_REG_VT_DATA_HIGH
Definition: ad7746.h:59
enum ad7746_id id
Definition: ad7746.h:191
enum ad7746_exclvl exclvl
Definition: ad7746.h:158
int32_t ad7746_set_cap_gain(struct ad7746_dev *dev, uint16_t gain)
Set the capacitive gain.
Definition: ad7746.c:415
int32_t ad7746_set_config(struct ad7746_dev *dev, struct ad7746_config config)
Set the configuration register.
Definition: ad7746.c:307
#define AD7746_RESET_CMD
Definition: ad7746.h:52
struct ad7746_exc exc
Definition: ad7746.h:179
struct ad7746_config config
Definition: ad7746.h:180
#define AD7746_REG_VOLT_GAINH
Definition: ad7746.h:72
int32_t ad7746_set_volt_gain(struct ad7746_dev *dev, uint16_t gain)
Set the voltage gain.
Definition: ad7746.c:430
#define AD7746_REG_CAPDACA
Definition: ad7746.h:66
ad7746_id
Definition: ad7746.h:112
@ AD7746_VTMD_EXT_TEMP
Definition: ad7746.h:127
#define AD7746_REG_EXC_SETUP
Definition: ad7746.h:64
#define AD7746_CAPSETUP_CAPDIFF_MSK
Definition: ad7746.h:86
int32_t ad7746_set_vt(struct ad7746_dev *dev, struct ad7746_vt vt)
Configure the voltage/temperature setup register.
Definition: ad7746.c:241
int32_t ad7746_set_cap_dac_b(struct ad7746_dev *dev, bool enable, uint8_t code)
Set the DAC code and enable state for EXCB.
Definition: ad7746.c:363
int32_t ad7746_set_volt_gain(struct ad7746_dev *dev, uint16_t gain)
Set the voltage gain.
Definition: ad7746.c:430
int32_t ad7746_set_exc(struct ad7746_dev *dev, struct ad7746_exc exc)
Configure the excitation setup register.
Definition: ad7746.c:274
enum ad7746_id id
Definition: ad7746.h:185
enum ad7746_md md
Definition: ad7746.h:173
#define AD7746_REG_CAP_DATA_HIGH
Definition: ad7746.h:56
int32_t ad7746_reg_read(struct ad7746_dev *dev, uint8_t reg, uint8_t *data, uint16_t bytes_number)
Reads data from AD7746 registers, starting from the selected register address pointer.
Definition: ad7746.c:146
int32_t ad7746_reg_write(struct ad7746_dev *dev, uint8_t reg, uint8_t *data, uint16_t bytes_number)
Writes data into AD7746 registers, starting from the selected register address pointer.
Definition: ad7746.c:121
int32_t ad7746_set_cap_offset(struct ad7746_dev *dev, uint16_t offset)
Set the capacitive offset.
Definition: ad7746.c:400
@ AD7746_EXC_PIN_INVERTED
Definition: ad7746.h:142
Structure holding I2C descriptor.
Definition: no_os_i2c.h:81
int32_t ad7746_calibrate(struct ad7746_dev *dev, enum ad7746_md md)
Perform offset/gain calibration.
Definition: ad7746.c:530
uint8_t buf[AD7746_NUM_REGISTERS+1u]
Definition: ad7746.h:192
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:122
@ ID_AD7747
Definition: ad7746.h:115
int32_t ad7746_reg_read(struct ad7746_dev *dev, uint8_t reg, uint8_t *data, uint16_t bytes_number)
Reads data from AD7746 registers, starting from the selected register address pointer.
Definition: ad7746.c:146
Header file of I2C Interface.
#define AD7746_REG_VT_SETUP
Definition: ad7746.h:63
@ AD7746_EXCLVL_4_DIV_8
Definition: ad7746.h:150
bool capchop
Definition: ad7746.h:122
uint8_t capf
Definition: ad7746.h:172
bool capdiff
Definition: ad7746.h:121
struct ad7746_vt vt
Definition: ad7746.h:178
void no_os_free(void *ptr)
bool vten
Definition: ad7746.h:133
uint8_t vtf
Definition: ad7746.h:171
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
#define NULL
Definition: wrapper.h:64
#define AD7746_REG_CAP_OFFH
Definition: ad7746.h:68
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
#define AD7746_NUM_REGISTERS
Definition: ad7746.h:75
int32_t ad7746_set_cap(struct ad7746_dev *dev, struct ad7746_cap cap)
Configure the capacitive setup register.
Definition: ad7746.c:209
struct ad7746_cap cap
Definition: ad7746.h:177
int32_t ad7746_get_cap_data(struct ad7746_dev *dev, uint32_t *cap_data)
Waits until a conversion on the capacitive channel has been finished and returns the output data.
Definition: ad7746.c:489
#define AD7746_EXCSETUP_EXCB_MSK
Definition: ad7746.h:99
#define AD7746_EXCSETUP_CLKCTRL_MSK
Definition: ad7746.h:97
Header file of utility functions.
ad7746_md
Definition: ad7746.h:161
#define AD7746_VTSETUP_EXTREF_MSK
Definition: ad7746.h:92
bool vtchop
Definition: ad7746.h:137
@ AD7746_MODE_OFFSET_CALIB
Definition: ad7746.h:166
#define AD7746_CAPSETUP_CIN2_MSK
Definition: ad7746.h:85
#define AD7746_STATUS_RDYVT_MSK
Definition: ad7746.h:80
int32_t ad7746_get_cap_data(struct ad7746_dev *dev, uint32_t *cap_data)
Waits until a conversion on the capacitive channel has been finished and returns the output data.
Definition: ad7746.c:489
struct no_os_i2c_desc * i2c_dev
Definition: ad7746.h:190
struct no_os_i2c_init_param i2c_init
Definition: ad7746.h:184
int32_t ad7746_reset(struct ad7746_dev *dev)
Resets the AD7746.
Definition: ad7746.c:171
@ AD7746_VTMD_INT_TEMP
Definition: ad7746.h:126
@ AD7746_EXC_PIN_NORMAL
Definition: ad7746.h:143
enum ad7746_vtmd vtmd
Definition: ad7746.h:134
#define AD7746_REG_STATUS
Definition: ad7746.h:55
@ ID_AD7745
Definition: ad7746.h:113
int32_t ad7746_set_config(struct ad7746_dev *dev, struct ad7746_config config)
Set the configuration register.
Definition: ad7746.c:307
#define AD7746_EXCSETUP_EXCLVL_MSK
Definition: ad7746.h:101