Go to the documentation of this file.
43 #define AD7746_ADDRESS 0x48
46 #define AD7746_RESET_CMD 0xBF
49 #define AD7746_REG_STATUS 0u
50 #define AD7746_REG_CAP_DATA_HIGH 1u
51 #define AD7746_REG_CAP_DATA_MID 2u
52 #define AD7746_REG_CAP_DATA_LOW 3u
53 #define AD7746_REG_VT_DATA_HIGH 4u
54 #define AD7746_REG_VT_DATA_MID 5u
55 #define AD7746_REG_VT_DATA_LOW 6u
56 #define AD7746_REG_CAP_SETUP 7u
57 #define AD7746_REG_VT_SETUP 8u
58 #define AD7746_REG_EXC_SETUP 9u
59 #define AD7746_REG_CFG 10u
60 #define AD7746_REG_CAPDACA 11u
61 #define AD7746_REG_CAPDACB 12u
62 #define AD7746_REG_CAP_OFFH 13u
63 #define AD7746_REG_CAP_OFFL 14u
64 #define AD7746_REG_CAP_GAINH 15u
65 #define AD7746_REG_CAP_GAINL 16u
66 #define AD7746_REG_VOLT_GAINH 17u
67 #define AD7746_REG_VOLT_GAINL 18u
69 #define AD7746_NUM_REGISTERS (AD7746_REG_VOLT_GAINL + 1u)
72 #define AD7746_STATUS_EXCERR_MSK NO_OS_BIT(3)
73 #define AD7746_STATUS_RDY_MSK NO_OS_BIT(2)
74 #define AD7746_STATUS_RDYVT_MSK NO_OS_BIT(1)
75 #define AD7746_STATUS_RDYCAP_MSK NO_OS_BIT(0)
78 #define AD7746_CAPSETUP_CAPEN_MSK NO_OS_BIT(7)
79 #define AD7746_CAPSETUP_CIN2_MSK NO_OS_BIT(6)
80 #define AD7746_CAPSETUP_CAPDIFF_MSK NO_OS_BIT(5)
81 #define AD7746_CAPSETUP_CAPCHOP_MSK NO_OS_BIT(0)
84 #define AD7746_VTSETUP_VTEN_MSK NO_OS_BIT(7)
85 #define AD7746_VTSETUP_VTMD_MSK NO_OS_GENMASK(6,5)
86 #define AD7746_VTSETUP_EXTREF_MSK NO_OS_BIT(4)
87 #define AD7746_VTSETUP_VTSHORT_MSK NO_OS_BIT(1)
88 #define AD7746_VTSETUP_VTCHOP_MSK NO_OS_BIT(0)
91 #define AD7746_EXCSETUP_CLKCTRL_MSK NO_OS_BIT(7)
92 #define AD7746_EXCSETUP_EXCON_MSK NO_OS_BIT(6)
93 #define AD7746_EXCSETUP_EXCB_MSK NO_OS_GENMASK(5,4)
94 #define AD7746_EXCSETUP_EXCA_MSK NO_OS_GENMASK(3,2)
95 #define AD7746_EXCSETUP_EXCLVL_MSK NO_OS_GENMASK(1,0)
98 #define AD7746_CONF_VTF_MSK NO_OS_GENMASK(7,6)
99 #define AD7746_CONF_CAPF_MSK NO_OS_GENMASK(5,3)
100 #define AD7746_CONF_MD_MSK NO_OS_GENMASK(2,0)
103 #define AD7746_CAPDAC_DACEN_MSK NO_OS_BIT(7)
104 #define AD7746_CAPDAC_DACP_MSK NO_OS_GENMASK(6,0)
193 uint8_t* data, uint16_t bytes_number);
195 uint8_t* data, uint16_t bytes_number);
#define AD7746_CONF_CAPF_MSK
Definition: ad7746.h:99
#define AD7746_VTSETUP_VTMD_MSK
Definition: ad7746.h:85
#define AD7746_STATUS_RDYCAP_MSK
Definition: ad7746.h:75
bool cin2
Definition: ad7746.h:114
uint32_t timeout
Definition: ad413x.c:49
#define AD7746_REG_CAP_GAINH
Definition: ad7746.h:64
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:333
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:159
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:52
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:357
int32_t ad7746_init(struct ad7746_dev **device, struct ad7746_init_param *init_param)
Initialize the ad7606 device structure.
Definition: ad7746.c:53
int32_t ad7746_set_exc(struct ad7746_dev *dev, struct ad7746_exc exc)
Configure the excitation setup register.
Definition: ad7746.c:268
@ AD7746_EXCLVL_2_DIV_8
Definition: ad7746.h:142
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:115
bool extref
Definition: ad7746.h:129
bool vtshort
Definition: ad7746.h:130
int32_t ad7746_set_cap_offset(struct ad7746_dev *dev, uint16_t offset)
Set the capacitive offset.
Definition: ad7746.c:394
int32_t ad7746_remove(struct ad7746_dev *dev)
Deinitialize the ad7746 driver and free all allocated resources.
Definition: ad7746.c:181
#define AD7746_CAPSETUP_CAPCHOP_MSK
Definition: ad7746.h:81
#define AD7746_REG_CFG
Definition: ad7746.h:59
#define AD7746_CAPDAC_DACEN_MSK
Definition: ad7746.h:103
#define AD7746_VTSETUP_VTCHOP_MSK
Definition: ad7746.h:88
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:113
@ AD7746_EXCLVL_3_DIV_8
Definition: ad7746.h:143
#define AD7746_CONF_MD_MSK
Definition: ad7746.h:100
int32_t ad7746_remove(struct ad7746_dev *dev)
Deinitialize the ad7746 driver and free all allocated resources.
Definition: ad7746.c:181
ad7746_exc_pin
Definition: ad7746.h:134
@ AD7746_VIN_EXT_VIN
Definition: ad7746.h:123
#define AD7746_REG_CAP_SETUP
Definition: ad7746.h:56
Header file of Delay functions.
struct ad7746_setup setup
Definition: ad7746.h:187
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:333
enum ad7746_exc_pin excb
Definition: ad7746.h:150
ad7746_vtmd
Definition: ad7746.h:119
Definition: ad9361_util.h:69
@ AD7746_EXCLVL_1_DIV_8
Definition: ad7746.h:141
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:441
@ AD7746_EXC_PIN_DISABLED
Definition: ad7746.h:135
@ AD7746_MODE_GAIN_CALIB
Definition: ad7746.h:161
@ AD7746_MODE_POWERDOWN
Definition: ad7746.h:159
int32_t ad7746_reset(struct ad7746_dev *dev)
Resets the AD7746.
Definition: ad7746.c:165
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
ad7746_exclvl
Definition: ad7746.h:140
enum ad7746_exc_pin exca
Definition: ad7746.h:151
int32_t ad7746_set_cap(struct ad7746_dev *dev, struct ad7746_cap cap)
Configure the capacitive setup register.
Definition: ad7746.c:203
@ AD7746_MODE_CONT
Definition: ad7746.h:157
#define AD7746_VTSETUP_VTEN_MSK
Definition: ad7746.h:84
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:441
bool capen
Definition: ad7746.h:113
#define AD7746_VTSETUP_VTSHORT_MSK
Definition: ad7746.h:87
bool excon
Definition: ad7746.h:149
int32_t ad7746_calibrate(struct ad7746_dev *dev, enum ad7746_md md)
Perform offset/gain calibration.
Definition: ad7746.c:524
@ AD7746_MODE_SINGLE
Definition: ad7746.h:158
#define AD7746_CAPSETUP_CAPEN_MSK
Definition: ad7746.h:78
@ ID_AD7746
Definition: ad7746.h:108
bool clkctrl
Definition: ad7746.h:148
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
#define AD7746_CONF_VTF_MSK
Definition: ad7746.h:98
@ AD7746_VTMD_VDD_MON
Definition: ad7746.h:122
Header file of AD7746 Driver.
struct ad7746_setup setup
Definition: ad7746.h:180
int32_t ad7746_init(struct ad7746_dev **device, struct ad7746_init_param *init_param)
Initialize the ad7606 device structure.
Definition: ad7746.c:53
@ AD7746_MODE_IDLE
Definition: ad7746.h:156
#define AD7746_EXCSETUP_EXCA_MSK
Definition: ad7746.h:94
int32_t ad7746_set_vt(struct ad7746_dev *dev, struct ad7746_vt vt)
Configure the voltage/temperature setup register.
Definition: ad7746.c:235
int32_t ad7746_set_cap_gain(struct ad7746_dev *dev, uint16_t gain)
Set the capacitive gain.
Definition: ad7746.c:409
#define AD7746_EXCSETUP_EXCON_MSK
Definition: ad7746.h:92
#define AD7746_CAPDAC_DACP_MSK
Definition: ad7746.h:104
#define AD7746_REG_CAPDACB
Definition: ad7746.h:61
#define AD7746_REG_VT_DATA_HIGH
Definition: ad7746.h:53
enum ad7746_id id
Definition: ad7746.h:185
enum ad7746_exclvl exclvl
Definition: ad7746.h:152
int32_t ad7746_set_cap_gain(struct ad7746_dev *dev, uint16_t gain)
Set the capacitive gain.
Definition: ad7746.c:409
int32_t ad7746_set_config(struct ad7746_dev *dev, struct ad7746_config config)
Set the configuration register.
Definition: ad7746.c:301
#define AD7746_RESET_CMD
Definition: ad7746.h:46
struct ad7746_exc exc
Definition: ad7746.h:173
struct ad7746_config config
Definition: ad7746.h:174
#define AD7746_REG_VOLT_GAINH
Definition: ad7746.h:66
int32_t ad7746_set_volt_gain(struct ad7746_dev *dev, uint16_t gain)
Set the voltage gain.
Definition: ad7746.c:424
#define AD7746_REG_CAPDACA
Definition: ad7746.h:60
ad7746_id
Definition: ad7746.h:106
@ AD7746_VTMD_EXT_TEMP
Definition: ad7746.h:121
#define AD7746_REG_EXC_SETUP
Definition: ad7746.h:58
#define AD7746_CAPSETUP_CAPDIFF_MSK
Definition: ad7746.h:80
int32_t ad7746_set_vt(struct ad7746_dev *dev, struct ad7746_vt vt)
Configure the voltage/temperature setup register.
Definition: ad7746.c:235
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:357
int32_t ad7746_set_volt_gain(struct ad7746_dev *dev, uint16_t gain)
Set the voltage gain.
Definition: ad7746.c:424
int32_t ad7746_set_exc(struct ad7746_dev *dev, struct ad7746_exc exc)
Configure the excitation setup register.
Definition: ad7746.c:268
enum ad7746_id id
Definition: ad7746.h:179
enum ad7746_md md
Definition: ad7746.h:167
#define AD7746_REG_CAP_DATA_HIGH
Definition: ad7746.h:50
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:140
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:115
int32_t ad7746_set_cap_offset(struct ad7746_dev *dev, uint16_t offset)
Set the capacitive offset.
Definition: ad7746.c:394
@ AD7746_EXC_PIN_INVERTED
Definition: ad7746.h:136
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
int32_t ad7746_calibrate(struct ad7746_dev *dev, enum ad7746_md md)
Perform offset/gain calibration.
Definition: ad7746.c:524
uint8_t buf[AD7746_NUM_REGISTERS+1u]
Definition: ad7746.h:186
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:190
@ ID_AD7747
Definition: ad7746.h:109
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:140
Header file of I2C Interface.
#define AD7746_REG_VT_SETUP
Definition: ad7746.h:57
@ AD7746_EXCLVL_4_DIV_8
Definition: ad7746.h:144
bool capchop
Definition: ad7746.h:116
uint8_t capf
Definition: ad7746.h:166
bool capdiff
Definition: ad7746.h:115
struct ad7746_vt vt
Definition: ad7746.h:172
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
bool vten
Definition: ad7746.h:127
uint8_t vtf
Definition: ad7746.h:165
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
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:62
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define AD7746_NUM_REGISTERS
Definition: ad7746.h:69
int32_t ad7746_set_cap(struct ad7746_dev *dev, struct ad7746_cap cap)
Configure the capacitive setup register.
Definition: ad7746.c:203
struct ad7746_cap cap
Definition: ad7746.h:171
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:483
#define AD7746_EXCSETUP_EXCB_MSK
Definition: ad7746.h:93
#define AD7746_EXCSETUP_CLKCTRL_MSK
Definition: ad7746.h:91
Header file of utility functions.
ad7746_md
Definition: ad7746.h:155
#define AD7746_VTSETUP_EXTREF_MSK
Definition: ad7746.h:86
bool vtchop
Definition: ad7746.h:131
@ AD7746_MODE_OFFSET_CALIB
Definition: ad7746.h:160
#define AD7746_CAPSETUP_CIN2_MSK
Definition: ad7746.h:79
#define AD7746_STATUS_RDYVT_MSK
Definition: ad7746.h:74
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:483
struct no_os_i2c_desc * i2c_dev
Definition: ad7746.h:184
struct no_os_i2c_init_param i2c_init
Definition: ad7746.h:178
int32_t ad7746_reset(struct ad7746_dev *dev)
Resets the AD7746.
Definition: ad7746.c:165
@ AD7746_VTMD_INT_TEMP
Definition: ad7746.h:120
@ AD7746_EXC_PIN_NORMAL
Definition: ad7746.h:137
enum ad7746_vtmd vtmd
Definition: ad7746.h:128
#define AD7746_REG_STATUS
Definition: ad7746.h:49
@ ID_AD7745
Definition: ad7746.h:107
int32_t ad7746_set_config(struct ad7746_dev *dev, struct ad7746_config config)
Set the configuration register.
Definition: ad7746.c:301
#define AD7746_EXCSETUP_EXCLVL_MSK
Definition: ad7746.h:95