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