Example program for AD717x and AD411x family of products.

Dependencies:   adi_console_menu platform_drivers

Committer:
Kjansen
Date:
Tue Aug 03 12:23:16 2021 +0100
Revision:
8:2e0e9b520392
Parent:
4:4592cc69bfa6
No-OS Adoption Changes:
* Updated the .lib files for adoption of no-OS repository as-is.
* Replaced platform_drivers.h with required header files.
* Updated the copyright year.

Mbed OS update changes:
1) Added the mbed_app.json file with custom parameters.
2) Updated the mbed-os version to 6.8.0

Updated the readme file.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mahphalke 1:48914f9593f1 1 /*!
mahphalke 1:48914f9593f1 2 *****************************************************************************
mahphalke 1:48914f9593f1 3 @file: ad717x_support.h
mahphalke 1:48914f9593f1 4
mahphalke 1:48914f9593f1 5 @brief: Header for AD717x/AD411x No-OS driver supports
mahphalke 1:48914f9593f1 6
mahphalke 1:48914f9593f1 7 @details:
mahphalke 1:48914f9593f1 8 -----------------------------------------------------------------------------
mahphalke 1:48914f9593f1 9 Copyright (c) 2020 Analog Devices, Inc.
mahphalke 1:48914f9593f1 10 All rights reserved.
mahphalke 1:48914f9593f1 11
mahphalke 1:48914f9593f1 12 This software is proprietary to Analog Devices, Inc. and its licensors.
mahphalke 1:48914f9593f1 13 By using this software you agree to the terms of the associated
mahphalke 1:48914f9593f1 14 Analog Devices Software License Agreement.
mahphalke 1:48914f9593f1 15 *****************************************************************************/
mahphalke 1:48914f9593f1 16
mahphalke 1:48914f9593f1 17 #ifndef AD717X_SUPPORT_H_
mahphalke 1:48914f9593f1 18 #define AD717X_SUPPORT_H_
mahphalke 1:48914f9593f1 19
mahphalke 1:48914f9593f1 20 /******************************************************************************/
mahphalke 1:48914f9593f1 21 /***************************** Include Files **********************************/
mahphalke 1:48914f9593f1 22 /******************************************************************************/
mahphalke 1:48914f9593f1 23
mahphalke 1:48914f9593f1 24 /******************************************************************************/
mahphalke 1:48914f9593f1 25 /********************** Macros and Constants Definitions **********************/
mahphalke 1:48914f9593f1 26 /******************************************************************************/
mahphalke 1:48914f9593f1 27
mahphalke 1:48914f9593f1 28 /*
mahphalke 1:48914f9593f1 29 * Create a contiguous bitmask starting at bit position @l and ending at
mahphalke 1:48914f9593f1 30 * position @h.
mahphalke 1:48914f9593f1 31 */
mahphalke 1:48914f9593f1 32 #ifndef GENMASK
mahphalke 1:48914f9593f1 33 #define GENMASK(h, l) (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (31 - (h))))
mahphalke 1:48914f9593f1 34 #endif
mahphalke 1:48914f9593f1 35 #define BIT(x) (1UL << (x))
mahphalke 1:48914f9593f1 36
mahphalke 1:48914f9593f1 37
mahphalke 1:48914f9593f1 38 /* ADC Mode Register bits */
mahphalke 1:48914f9593f1 39 #define AD717X_ADCMODE_REG_MODE_MSK GENMASK(6,4)
mahphalke 1:48914f9593f1 40 #define AD717X_ADCMODE_REG_MODE_RD(x) (((x) >> 4) & 0x7)
mahphalke 1:48914f9593f1 41
mahphalke 1:48914f9593f1 42
mahphalke 1:48914f9593f1 43 /* Channel Map Register bits */
mahphalke 1:48914f9593f1 44 #define AD717X_CHMAP_REG_CH_EN_RD(x) (((x) >> 15) & 0x1)
mahphalke 1:48914f9593f1 45
mahphalke 1:48914f9593f1 46 #define AD717X_CHMAP_REG_SETUP_SEL_MSK GENMASK(14,12)
mahphalke 1:48914f9593f1 47 #define AD717X_CHMAP_REG_SETUP_SEL_RD(x) (((x) >> 12) & 0x7)
mahphalke 1:48914f9593f1 48
mahphalke 1:48914f9593f1 49 #define AD717X_CHMAP_REG_AINPOS_MSK GENMASK(9,5)
mahphalke 1:48914f9593f1 50 #define AD717X_CHMAP_REG_AINPOS_RD(x) (((x) >> 5) & 0x1F)
mahphalke 1:48914f9593f1 51
mahphalke 1:48914f9593f1 52 #define AD717X_CHMAP_REG_AINNEG_MSK GENMASK(4,0)
mahphalke 1:48914f9593f1 53 #define AD717X_CHMAP_REG_AINNEG_RD(x) (((x) >> 0) & 0x1F)
mahphalke 1:48914f9593f1 54
Mahesh Phalke 4:4592cc69bfa6 55 /* Channel Map Register additional bits for AD4111, AD4112, AD4114, AD4115 */
mahphalke 1:48914f9593f1 56 #define AD4111_CHMAP_REG_INPUT_MSK GENMASK(9,0)
mahphalke 1:48914f9593f1 57 #define AD4111_CHMAP_REG_INPUT_RD(x) (((x) >> 0) & 0x3FF)
mahphalke 1:48914f9593f1 58
mahphalke 1:48914f9593f1 59
mahphalke 1:48914f9593f1 60 /* Setup Configuration Register bits */
mahphalke 1:48914f9593f1 61 #define AD717X_SETUP_CONF_REG_BI_UNIPOLAR_RD(x) (((x) >> 12) & 0x1)
mahphalke 1:48914f9593f1 62
mahphalke 1:48914f9593f1 63 #define AD717X_SETUP_CONF_REG_REF_SEL_MSK GENMASK(5,4)
mahphalke 1:48914f9593f1 64 #define AD717X_SETUP_CONF_REG_REF_SEL_RD(x) (((x) >> 4) & 0x3)
mahphalke 1:48914f9593f1 65
mahphalke 1:48914f9593f1 66 /* Setup Configuration Register additional bits for AD7173-8 */
mahphalke 1:48914f9593f1 67 #define AD717X_SETUP_CONF_REG_REF_BUF_MSK GENMASK(11,10)
mahphalke 1:48914f9593f1 68 #define AD717X_SETUP_CONF_REG_REF_BUF_RD(x) (((x)>> 10) & 0x3)
mahphalke 1:48914f9593f1 69
mahphalke 1:48914f9593f1 70 #define AD717X_SETUP_CONF_REG_AIN_BUF_MSK GENMASK(9,8)
mahphalke 1:48914f9593f1 71 #define AD717X_SETUP_CONF_REG_AIN_BUF_RD(x) (((x) >> 8) & 0x3)
mahphalke 1:48914f9593f1 72
mahphalke 1:48914f9593f1 73 /* Setup Configuration Register additional bits for AD7172-2, AD7172-4, AD7175-2 */
mahphalke 1:48914f9593f1 74 #define AD717X_SETUP_CONF_REG_REFBUF_P_RD(x) (((x) >> 11) & 0x1)
mahphalke 1:48914f9593f1 75 #define AD717X_SETUP_CONF_REG_REFBUF_N_RD(x) (((x) >> 10) & 0x1)
mahphalke 1:48914f9593f1 76
mahphalke 1:48914f9593f1 77 #define AD717X_SETUP_CONF_REG_AINBUF_P_RD(x) (((x) >> 9) & 0x1)
mahphalke 1:48914f9593f1 78 #define AD717X_SETUP_CONF_REG_AINBUF_N_RD(x) (((x) >> 8) & 0x1)
mahphalke 1:48914f9593f1 79
Mahesh Phalke 4:4592cc69bfa6 80 /* Setup Configuration Register additional bits for AD4111, AD4112, AD4114, AD4115 */
mahphalke 1:48914f9593f1 81 #define AD4111_SETUP_CONF_REG_REFPOS_BUF_RD(x) (((x) >> 11) & 0x1)
mahphalke 1:48914f9593f1 82 #define AD4111_SETUP_CONF_REG_REFNEG_BUF_RD(x) (((x) >> 10) & 0x1)
mahphalke 1:48914f9593f1 83
mahphalke 1:48914f9593f1 84 #define AD4111_SETUP_CONF_REG_AIN_BUF_MSK GENMASK(9,8)
mahphalke 1:48914f9593f1 85 #define AD4111_SETUP_CONF_REG_AIN_BUF_RD(x) (((x) >> 8) & 0x3)
mahphalke 1:48914f9593f1 86
mahphalke 1:48914f9593f1 87
mahphalke 1:48914f9593f1 88 /* Filter Configuration Register bits */
mahphalke 1:48914f9593f1 89 #define AD717X_FILT_CONF_REG_ENHFILTEN_RD(x) (((x) >> 11) & 0x1)
mahphalke 1:48914f9593f1 90
mahphalke 1:48914f9593f1 91 #define AD717X_FILT_CONF_REG_ENHFILT_MSK GENMASK(10,8)
mahphalke 1:48914f9593f1 92 #define AD717X_FILT_CONF_REG_ENHFILT_RD(x) (((x) >> 8) & 0x7)
mahphalke 1:48914f9593f1 93
mahphalke 1:48914f9593f1 94 #define AD717X_FILT_CONF_REG_ORDER_MSK GENMASK(6,5)
mahphalke 1:48914f9593f1 95 #define AD717X_FILT_CONF_REG_ORDER_RD(x) (((x) >> 5) & 0x3)
mahphalke 1:48914f9593f1 96
mahphalke 1:48914f9593f1 97 #define AD717X_FILT_CONF_REG_ODR_MSK GENMASK(4,0)
mahphalke 1:48914f9593f1 98 #define AD717X_FILT_CONF_REG_ODR_RD(x) (((x) >> 0) & 0x1F)
mahphalke 1:48914f9593f1 99
mahphalke 3:6c7324997606 100
mahphalke 3:6c7324997606 101 // ADC operating mode types
mahphalke 3:6c7324997606 102 #define CONTINUOUS_CONVERSION 0
mahphalke 3:6c7324997606 103 #define SINGLE_CONVERISION 1
mahphalke 3:6c7324997606 104 #define STANDBY_MODE 2
mahphalke 3:6c7324997606 105 #define POWER_DOWN_MODE 3
mahphalke 3:6c7324997606 106 #define INTERNAL_OFFSET_CAL_MODE 4
mahphalke 3:6c7324997606 107 #define INTERNAL_FULL_SCALE_CAL_MODE 5
mahphalke 3:6c7324997606 108
mahphalke 1:48914f9593f1 109 /******************************************************************************/
mahphalke 1:48914f9593f1 110 /********************** Variables and User Defined Data Types *****************/
mahphalke 1:48914f9593f1 111 /******************************************************************************/
mahphalke 1:48914f9593f1 112
mahphalke 1:48914f9593f1 113 /******************************************************************************/
mahphalke 1:48914f9593f1 114 /************************ Public Declarations *********************************/
mahphalke 1:48914f9593f1 115 /******************************************************************************/
mahphalke 1:48914f9593f1 116
mahphalke 1:48914f9593f1 117 #endif /* AD717X_SUPPORT_H_ */