![](/media/cache/group/ADI_Logo_AWP_zgjvy7B.png.50x50_q85.png)
Example Program for EVAL-AD7606
Dependencies: platform_drivers
app/ad7606_support.h@7:054dbd5e1f45, 2021-08-03 (annotated)
- Committer:
- Kjansen
- Date:
- Tue Aug 03 11:54:49 2021 +0100
- Revision:
- 7:054dbd5e1f45
- Parent:
- 1:819ac9aa5667
Modified the ADC data capture module to remove dependancy on type of ADC and it's specific operations
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
1:819ac9aa5667 | 1 | /***************************************************************************//** |
mahphalke |
1:819ac9aa5667 | 2 | * @file ad7606_support.h |
mahphalke |
1:819ac9aa5667 | 3 | * @brief Header for AD7606 No-OS driver supports |
mahphalke |
1:819ac9aa5667 | 4 | ******************************************************************************** |
mahphalke |
1:819ac9aa5667 | 5 | * Copyright (c) 2020 Analog Devices, Inc. |
mahphalke |
1:819ac9aa5667 | 6 | * |
mahphalke |
1:819ac9aa5667 | 7 | * All rights reserved. |
mahphalke |
1:819ac9aa5667 | 8 | * |
mahphalke |
1:819ac9aa5667 | 9 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke |
1:819ac9aa5667 | 10 | * By using this software you agree to the terms of the associated |
mahphalke |
1:819ac9aa5667 | 11 | * Analog Devices Software License Agreement. |
mahphalke |
1:819ac9aa5667 | 12 | *******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 13 | |
mahphalke |
1:819ac9aa5667 | 14 | #ifndef AD7606_SUPPORT_H_ |
mahphalke |
1:819ac9aa5667 | 15 | #define AD7606_SUPPORT_H_ |
mahphalke |
1:819ac9aa5667 | 16 | |
mahphalke |
1:819ac9aa5667 | 17 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 18 | /***************************** Include Files **********************************/ |
mahphalke |
1:819ac9aa5667 | 19 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 20 | |
mahphalke |
1:819ac9aa5667 | 21 | #include "ad7606.h" |
mahphalke |
1:819ac9aa5667 | 22 | |
mahphalke |
1:819ac9aa5667 | 23 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 24 | /********************** Macros and Constants Definition ***********************/ |
mahphalke |
1:819ac9aa5667 | 25 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 26 | |
mahphalke |
1:819ac9aa5667 | 27 | /* Offset b/w two channel selections in CHx_RANGE register */ |
mahphalke |
1:819ac9aa5667 | 28 | #define CHANNEL_RANGE_MSK_OFFSET 4 |
mahphalke |
1:819ac9aa5667 | 29 | |
mahphalke |
1:819ac9aa5667 | 30 | /* AD7606_REG_OVERSAMPLING */ |
mahphalke |
1:819ac9aa5667 | 31 | #define AD7606_OVERSAMPLING_MSK GENMASK(3,0) |
mahphalke |
1:819ac9aa5667 | 32 | |
mahphalke |
1:819ac9aa5667 | 33 | /* Default channel range for AD7606 devices */ |
mahphalke |
1:819ac9aa5667 | 34 | #define DEFAULT_CHN_RANGE (10.0) |
mahphalke |
1:819ac9aa5667 | 35 | |
mahphalke |
1:819ac9aa5667 | 36 | /* Diagnostic channels Mux configurations */ |
mahphalke |
1:819ac9aa5667 | 37 | #define AD7606_DIAGN_MUX_CH_MSK(ch) (GENMASK(2, 0) << (3 * ((ch) % 2))) |
mahphalke |
1:819ac9aa5667 | 38 | #define AD7606_DIAGN_MUX_CH_VAL(ch, val) (val << (3 * ((ch) % 2))) |
mahphalke |
1:819ac9aa5667 | 39 | |
mahphalke |
1:819ac9aa5667 | 40 | #define AD7606_OPEN_DETECT_ENABLE_MSK(ch) (GENMASK(7,0) & (~(1 << ch))) |
mahphalke |
1:819ac9aa5667 | 41 | |
mahphalke |
1:819ac9aa5667 | 42 | /* Diagnostic channels Mux select bits */ |
mahphalke |
1:819ac9aa5667 | 43 | #define ANALOG_INPUT_MUX 0X00 |
mahphalke |
1:819ac9aa5667 | 44 | #define TEMPERATURE_MUX 0x01 |
mahphalke |
1:819ac9aa5667 | 45 | #define VREF_MUX 0X02 |
mahphalke |
1:819ac9aa5667 | 46 | #define ALDO_MUX 0X03 |
mahphalke |
1:819ac9aa5667 | 47 | #define DLDO_MUX 0X04 |
mahphalke |
1:819ac9aa5667 | 48 | #define VDRIVE_MUX 0x05 |
mahphalke |
1:819ac9aa5667 | 49 | |
mahphalke |
1:819ac9aa5667 | 50 | /* Diagnostic Mux multiplers */ |
mahphalke |
1:819ac9aa5667 | 51 | #define VREF_MUX_MULTIPLIER 4.0 |
mahphalke |
1:819ac9aa5667 | 52 | |
mahphalke |
1:819ac9aa5667 | 53 | /* Unipolar inputs range bits for AD7606C */ |
mahphalke |
1:819ac9aa5667 | 54 | #define AD7606C_UNIPOLAR_RANGE_MIN 5 |
mahphalke |
1:819ac9aa5667 | 55 | #define AD7606C_UNIPOLAR_RANGE_MAX 7 |
mahphalke |
1:819ac9aa5667 | 56 | |
mahphalke |
1:819ac9aa5667 | 57 | /* Number of AD7606 registers */ |
mahphalke |
1:819ac9aa5667 | 58 | #define NUM_OF_REGISTERS 0x2F |
mahphalke |
1:819ac9aa5667 | 59 | |
mahphalke |
1:819ac9aa5667 | 60 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 61 | /********************** Variables and User Defined Data Types *****************/ |
mahphalke |
1:819ac9aa5667 | 62 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 63 | |
mahphalke |
1:819ac9aa5667 | 64 | /* Analog input polarity */ |
mahphalke |
1:819ac9aa5667 | 65 | typedef enum { |
mahphalke |
1:819ac9aa5667 | 66 | UNIPOLAR, |
mahphalke |
1:819ac9aa5667 | 67 | BIPOLAR |
mahphalke |
1:819ac9aa5667 | 68 | } polarity_e; |
mahphalke |
1:819ac9aa5667 | 69 | |
mahphalke |
1:819ac9aa5667 | 70 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 71 | /************************ Public Declarations *********************************/ |
mahphalke |
1:819ac9aa5667 | 72 | /******************************************************************************/ |
mahphalke |
1:819ac9aa5667 | 73 | |
mahphalke |
1:819ac9aa5667 | 74 | float convert_adc_raw_to_voltage(int32_t adc_raw, float scale); |
mahphalke |
1:819ac9aa5667 | 75 | int32_t ad7606_read_conversion_data(struct ad7606_dev *dev, uint8_t bytes); |
mahphalke |
1:819ac9aa5667 | 76 | polarity_e ad7606_get_input_polarity(uint8_t chn_range_bits); |
mahphalke |
1:819ac9aa5667 | 77 | |
mahphalke |
1:819ac9aa5667 | 78 | #endif /* AD7606_SUPPORT_H_ */ |