Header file for ada4250 Driver.
More...
#include <stdint.h>
#include <math.h>
#include <stdbool.h>
#include "no_os_spi.h"
#include "no_os_gpio.h"
#include "no_os_util.h"
|
| enum | ada4250_id {
ADA4230
,
ADA4250
} |
| | Current bias settings. More...
|
| |
| enum | ada4250_bias {
ADA4250_BIAS_DISABLE
,
ADA4250_BIAS_BANDGAP_REF
,
ADA4250_BIAS_AVDD
} |
| | Current bias settings. More...
|
| |
| enum | ada4250_offset_range {
ADA4250_RANGE1
,
ADA4250_RANGE2
,
ADA4250_RANGE3
,
ADA4250_RANGE4
} |
| | Sensor offset trim range. More...
|
| |
| enum | ada4250_gain {
ADA4250_GAIN_1
,
ADA4250_GAIN_2
,
ADA4250_GAIN_4
,
ADA4250_GAIN_8
,
ADA4250_GAIN_16
,
ADA4250_GAIN_32
,
ADA4250_GAIN_64
,
ADA4250_GAIN_128
} |
| | Gain value. More...
|
| |
| enum | ada4250_bandwidth {
ADA4250_BANDWIDTH_LOW
,
ADA4250_BANDWIDTH_HIGH
} |
| | Bandwidth modes. More...
|
| |
| enum | ada4250_power_mode {
ADA4250_POWER_NORMAL
,
ADA4250_POWER_SLEEP
,
ADA4250_POWER_SHUTDOWN
} |
| | Power Modes. More...
|
| |
|
| int32_t | ada4250_write (struct ada4250_dev *dev, uint8_t reg_addr, uint8_t data) |
| | Writes data to ada4250 over SPI.
|
| |
| int32_t | ada4250_read (struct ada4250_dev *dev, uint8_t reg_addr, uint8_t *data) |
| | Reads data from ada4250 over SPI.
|
| |
| int32_t | ada4250_update (struct ada4250_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data) |
| | Update ADA4250 register.
|
| |
| int32_t | ada4250_update_desc (struct ada4250_dev *dev) |
| | Update ADA4250 device descriptor.
|
| |
| int32_t | ada4250_soft_reset (struct ada4250_dev *dev) |
| | Software reset.
|
| |
| int32_t | ada4250_en_refbuf (struct ada4250_dev *dev, bool refbuf) |
| | Enable/Disable Reference Buffer.
|
| |
| int32_t | ada4250_set_bias (struct ada4250_dev *dev, enum ada4250_bias bias) |
| | Set current bias for ADA4250.
|
| |
| int32_t | ada4250_set_gain (struct ada4250_dev *dev, enum ada4250_gain gain) |
| | Set gain for ADA4250.
|
| |
| int32_t | ada4250_set_offset (struct ada4250_dev *dev, int64_t offset) |
| | Set offset value for ADA4250.
|
| |
| int32_t | ada4250_set_bandwidth (struct ada4250_dev *dev, enum ada4250_bandwidth bw) |
| | Set the bandwidth value for ADA4250.
|
| |
| int32_t | ada4250_set_slp_shtdwn_mode (struct ada4250_dev *dev, enum ada4250_power_mode pwrmode) |
| | Set the ADA4250 into sleep or shutdown mode.
|
| |
| int32_t | ada4250_set_normal_mode (struct ada4250_dev *dev, bool reconfig) |
| | Sets the ADA4250 into normal mode and reconfigures it according to the user input.
|
| |
| int32_t | ada4250_init (struct ada4250_dev **device, struct ada4250_init_param *init_param) |
| | Initialize the ADA4250 device.
|
| |
| int32_t | ada4250_remove (struct ada4250_dev *dev) |
| | Free resoulces allocated for ADA4250.
|
| |
Header file for ada4250 Driver.
- Author
- Antoniu Miclaus (anton.nosp@m.iu.m.nosp@m.iclau.nosp@m.s@an.nosp@m.alog..nosp@m.com)
Copyright 2021(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ ADA4250_BIAS_SET
| #define ADA4250_BIAS_SET |
( |
| x | ) |
|
Value:
#define ADA4250_BIAS_SET_MSK
Definition ada4250.h:56
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
◆ ADA4250_BIAS_SET_MSK
◆ ADA4250_BUF_DISABLE
| #define ADA4250_BUF_DISABLE 0x00 |
◆ ADA4250_BUF_ENABLE
| #define ADA4250_BUF_ENABLE 0x01 |
◆ ADA4250_BUFF_SIZE_BYTES
| #define ADA4250_BUFF_SIZE_BYTES 2 |
◆ ADA4250_CHIP_ID
| #define ADA4250_CHIP_ID 0x4250 |
◆ ADA4250_DIE_REV
| #define ADA4250_DIE_REV 0x0 |
◆ ADA4250_GAIN_MUX
| #define ADA4250_GAIN_MUX |
( |
| x | ) |
|
Value:
#define ADA4250_GAIN_MUX_MSK
Definition ada4250.h:32
◆ ADA4250_GAIN_MUX_MSK
◆ ADA4250_RANGE_SET
| #define ADA4250_RANGE_SET |
( |
| x | ) |
|
Value:
#define ADA4250_RANGE_SET_MSK
Definition ada4250.h:58
◆ ADA4250_RANGE_SET_MSK
◆ ADA4250_REFBUF
| #define ADA4250_REFBUF |
( |
| x | ) |
|
Value:
#define ADA4250_REFBUF_MSK
Definition ada4250.h:36
◆ ADA4250_REFBUF_MSK
◆ ADA4250_REG_CHIP_ID1
| #define ADA4250_REG_CHIP_ID1 0x19 |
◆ ADA4250_REG_CHIP_ID2
| #define ADA4250_REG_CHIP_ID2 0x1a |
◆ ADA4250_REG_DIE_REV
| #define ADA4250_REG_DIE_REV 0x18 |
◆ ADA4250_REG_GAIN_MUX
| #define ADA4250_REG_GAIN_MUX 0x00 |
◆ ADA4250_REG_REFBUF_EN
| #define ADA4250_REG_REFBUF_EN 0x01 |
◆ ADA4250_REG_RESET
| #define ADA4250_REG_RESET 0x02 |
◆ ADA4250_REG_SNSR_CAL_CNFG
| #define ADA4250_REG_SNSR_CAL_CNFG 0x05 |
◆ ADA4250_REG_SNSR_CAL_VAL
| #define ADA4250_REG_SNSR_CAL_VAL 0x04 |
◆ ADA4250_RESET
| #define ADA4250_RESET |
( |
| x | ) |
|
Value:
#define ADA4250_RESET_MSK
Definition ada4250.h:44
◆ ADA4250_RESET_DISABLE
| #define ADA4250_RESET_DISABLE 0x00 |
◆ ADA4250_RESET_ENABLE
| #define ADA4250_RESET_ENABLE 0x01 |
◆ ADA4250_RESET_MSK
◆ ADA4250_SNSR_CAL_VAL
| #define ADA4250_SNSR_CAL_VAL |
( |
| x | ) |
|
Value:
#define ADA4250_SNSR_CAL_VAL_MSK
Definition ada4250.h:52
◆ ADA4250_SNSR_CAL_VAL_MSK
◆ ADA4250_SPI_DUMMY_DATA
| #define ADA4250_SPI_DUMMY_DATA 0x00 |
◆ ADA4250_SPI_READ_CMD
◆ ADA4250_SPI_WRITE_CMD
| #define ADA4250_SPI_WRITE_CMD 0x0 |
◆ ada4250_bandwidth
Bandwidth modes.
| Enumerator |
|---|
| ADA4250_BANDWIDTH_LOW | |
| ADA4250_BANDWIDTH_HIGH | |
◆ ada4250_bias
Current bias settings.
| Enumerator |
|---|
| ADA4250_BIAS_DISABLE | |
| ADA4250_BIAS_BANDGAP_REF | |
| ADA4250_BIAS_AVDD | |
◆ ada4250_gain
Gain value.
| Enumerator |
|---|
| ADA4250_GAIN_1 | |
| ADA4250_GAIN_2 | |
| ADA4250_GAIN_4 | |
| ADA4250_GAIN_8 | |
| ADA4250_GAIN_16 | |
| ADA4250_GAIN_32 | |
| ADA4250_GAIN_64 | |
| ADA4250_GAIN_128 | |
◆ ada4250_id
Current bias settings.
| Enumerator |
|---|
| ADA4230 | |
| ADA4250 | |
◆ ada4250_offset_range
Sensor offset trim range.
| Enumerator |
|---|
| ADA4250_RANGE1 | |
| ADA4250_RANGE2 | |
| ADA4250_RANGE3 | |
| ADA4250_RANGE4 | |
◆ ada4250_power_mode
Power Modes.
| Enumerator |
|---|
| ADA4250_POWER_NORMAL | |
| ADA4250_POWER_SLEEP | |
| ADA4250_POWER_SHUTDOWN | |
◆ ada4250_en_refbuf()
Enable/Disable Reference Buffer.
- Parameters
-
| dev | - The device structure. |
| refbuf | - REFBUF enable/disable. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_init()
Initialize the ADA4250 device.
- Parameters
-
| device | - The device structure. |
| init_param | - The structure containing the device initial parameters. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_read()
| int32_t ada4250_read |
( |
struct ada4250_dev * | dev, |
|
|
uint8_t | reg_addr, |
|
|
uint8_t * | data ) |
Reads data from ada4250 over SPI.
ADA4250 SPI Read
- Parameters
-
| dev | - The device structure. |
| reg_addr | - The register address. |
| data | - Data read from the device. |
- Returns
- Returns 0 in case of success or negative error code otherwise.
◆ ada4250_remove()
Free resoulces allocated for ADA4250.
ADA4250 Resources Deallocation
- Parameters
-
| dev | - The device structure. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_set_bandwidth()
Set the bandwidth value for ADA4250.
- Parameters
-
| dev | - The device structure. |
| bw | - Bandwidth value. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_set_bias()
Set current bias for ADA4250.
- Parameters
-
| dev | - The device structure. |
| bias | - Current bias option. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_set_gain()
Set gain for ADA4250.
- Parameters
-
| dev | - The device structure. |
| gain | - Gain Value. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_set_normal_mode()
| int32_t ada4250_set_normal_mode |
( |
struct ada4250_dev * | dev, |
|
|
bool | reconfig ) |
Sets the ADA4250 into normal mode and reconfigures it according to the user input.
- Parameters
-
| dev | - The device structure. |
| reconfig | - Reconfiguration enable/disable. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_set_offset()
| int32_t ada4250_set_offset |
( |
struct ada4250_dev * | dev, |
|
|
int64_t | offset ) |
Set offset value for ADA4250.
- Parameters
-
| dev | - The device structure. |
| offset | - Offset Value in nV. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_set_slp_shtdwn_mode()
Set the ADA4250 into sleep or shutdown mode.
- Parameters
-
| dev | - The device structure. |
| pwrmode | - Power mode option. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_soft_reset()
Software reset.
- Parameters
-
| dev | - The device structure. |
- Returns
- Returns 0 in case of success or negative error code.
◆ ada4250_update()
| int32_t ada4250_update |
( |
struct ada4250_dev * | dev, |
|
|
uint8_t | reg_addr, |
|
|
uint8_t | mask, |
|
|
uint8_t | data ) |
Update ADA4250 register.
- Parameters
-
| dev | - The device structure. |
| reg_addr | - The register address. |
| mask | - Mask for specific register bits to be updated. |
| data | - Data read from the device. |
- Returns
- Returns 0 in case of success or negative error code otherwise.
◆ ada4250_update_desc()
| int32_t ada4250_update_desc |
( |
struct ada4250_dev * | dev | ) |
|
Update ADA4250 device descriptor.
- Parameters
-
| dev | - The device structure. |
- Returns
- Returns 0 in case of success or negative error code otherwise.
◆ ada4250_write()
| int32_t ada4250_write |
( |
struct ada4250_dev * | dev, |
|
|
uint8_t | reg_addr, |
|
|
uint8_t | data ) |
Writes data to ada4250 over SPI.
ADA4250 SPI write
- Parameters
-
| dev | - The device structure. |
| reg_addr | - The register address. |
| data | - Data value to write. |
- Returns
- Returns 0 in case of success or negative error code otherwise.