![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ADISense1000 Version 2.1 code base
Fork of AdiSense1000_V21 by
Diff: inc/adi_sense_config_types.h
- Revision:
- 7:4dbae381f693
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_config_types.h Fri Oct 20 15:58:01 2017 +0000 @@ -0,0 +1,745 @@ +/*! + ****************************************************************************** + * @file: adi_sense_config_types.h + * @brief: Type definitions for ADI Sense API. + *----------------------------------------------------------------------------- + */ + +/* +Copyright (c) 2017 Analog Devices, Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + - Modified versions of the software must be conspicuously marked as such. + - This software is licensed solely and exclusively for use with processors + manufactured by or for Analog Devices, Inc. + - This software may not be combined or merged with other code in any manner + that would cause the software to become subject to terms and conditions + which differ from those listed here. + - Neither the name of Analog Devices, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + - The use of this software may or may not infringe the patent rights of one + or more patent holders. This license does not release you from the + requirement that you obtain separate licenses from these patent holders + to use this software. + +THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, +TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL +PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef __ADI_SENSE_CONFIG_TYPES_H__ +#define __ADI_SENSE_CONFIG_TYPES_H__ + +#include "adi_sense_platform.h" + +/*! @addtogroup ADI_Sense_Api ADI Sense Host Library API + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! The maximum number of device instances included in this configuration */ +#define ADI_SENSE_MAX_DEVICES 1 + +/*! A list of supported product identifiers */ +typedef enum { + ADI_SENSE_PRODUCT_ID_1000 = 0x0020, + /*!< ADI Sense 1000 */ +} ADI_SENSE_PRODUCT_ID; + +/*! A list of support product identifiers */ +typedef enum { + ADI_SENSE_CONFIG_VERSION_001 = 1, + /*!< ADI Sense configuration version #1 */ +} ADI_SENSE_CONFIG_VERSION_ID; + +/*! Unique configuration identifier (optional) */ +typedef uint32_t ADI_SENSE_CONFIG_ID; + +/*! ADI Sense measurement channel identifiers */ +typedef enum { + ADI_SENSE_CHANNEL_ID_NONE = -1, + /*!< Used to indicate when no channel is selected (e.g. compensation channel) */ + + ADI_SENSE_CHANNEL_ID_CJC_0 = 0, + /*!< Cold-Juction Compensation channel #0 */ + ADI_SENSE_CHANNEL_ID_CJC_1, + /*!< Cold-Juction Compensation channel #1 */ + ADI_SENSE_CHANNEL_ID_SENSOR_0, + /*!< Analog Sensor channel #0 */ + ADI_SENSE_CHANNEL_ID_SENSOR_1, + /*!< Analog Sensor channel #1 */ + ADI_SENSE_CHANNEL_ID_SENSOR_2, + /*!< Analog Sensor channel #2 */ + ADI_SENSE_CHANNEL_ID_SENSOR_3, + /*!< Analog Sensor channel #3 */ + ADI_SENSE_CHANNEL_ID_VOLTAGE_0, + /*!< Analog 0-10V Voltage Sensor channel #0 */ + ADI_SENSE_CHANNEL_ID_CURRENT_0, + /*!< Analog 4-20mA Current Sensor channel #0 */ + ADI_SENSE_CHANNEL_ID_I2C_0, + /*!< Digital I2C Sensor channel #0 */ + ADI_SENSE_CHANNEL_ID_I2C_1, + /*!< Digital I2C Sensor channel #1 */ + ADI_SENSE_CHANNEL_ID_SPI_0, + /*!< Digital SPI Sensor channel #0 */ + ADI_SENSE_CHANNEL_ID_SPI_1, + /*!< Digital SPI Sensor channel #1 */ + ADI_SENSE_CHANNEL_ID_SPI_2, + /*!< Digital SPI Sensor channel #2 */ + + ADI_SENSE_MAX_CHANNELS, + /*!< Maximum number of measurement channels on the ADI Sense */ +} ADI_SENSE_CHANNEL_ID; + +/*! ADI Sense operating mode options */ +typedef enum { + ADI_SENSE_OPERATING_MODE_SINGLECYCLE = 1, + /*!< Executes a single measurement cycle and stops */ + ADI_SENSE_OPERATING_MODE_CONTINUOUS, + /*!< Continuously executes measurement cycles */ + ADI_SENSE_OPERATING_MODE_MULTICYCLE, + /*!< Executes a burst of measurement cycles, repeated at defined intervals */ +} ADI_SENSE_OPERATING_MODE; + +/*! ADI Sense data publishing mode options */ +typedef enum { + ADI_SENSE_DATA_PUBLISH_PER_CONVERSION = 1, + /*!< The DATAREADY signal is asserted after completion of each conversion + - a single data sample only from the latest completed conversion is stored in this mode */ + ADI_SENSE_DATA_PUBLISH_PER_CYCLE, + /*!< The DATAREADY signal is asserted after completion of each measurement cycle + - data samples only from the lastest completed measurement cycle are stored in this mode */ + ADI_SENSE_DATA_PUBLISH_PER_MULTICYCLE_BURST, + /*!< The DATAREADY signal is asserted after completion of each burst of measurement cycles + - applicable only when @ref ADI_SENSE_OPERATING_MODE_MULTICYCLE is also selected + - data samples only from the lastest completed burst of measurement cycles are stored in this mode */ +} ADI_SENSE_DATA_PUBLISH_MODE; + +/*! ADI Sense data power mode options */ +typedef enum { + ADI_SENSE_POWER_MODE_LOW = 1, + /*!< Lowest ADC power consumption mode, with lowest conversion rate */ + ADI_SENSE_POWER_MODE_MID, + /*!< Medium ADC power consumption mode, with medium conversion rate */ + ADI_SENSE_POWER_MODE_FULL, + /*!< Highest ADC power consumption mode, with highest conversion rate */ +} ADI_SENSE_POWER_MODE; + +/*! ADI Sense unit translation options + * + * Optionally select a translation to be performed on the final measurement + * before publishing + */ +typedef enum { + ADI_SENSE_UNIT_TRANSLATION_NONE = 0, + /*!< No translation required */ + ADI_SENSE_UNIT_TRANSLATION_CELSIUS_TO_FAHRENHEIT, + /*!< Convert temperature from Celsius to Fahrenheit */ + ADI_SENSE_UNIT_TRANSLATION_BAR_TO_PSI, + /*!< Convert pressure from Bar to PSI */ +} ADI_SENSE_UNIT_TRANSLATION; + +/*! ADI Sense Open-Circuit Detection frequency + * + * Select the per-cycle frequency at which Open-Circuit Detection diagnostic + * checks should be performed + * + * @note OCD checks, when performed, will add a delay to the start of + * the next measurement cycle. + */ +typedef enum { + ADI_SENSE_OCD_DISABLED = 0, + /*!< No Open-Circuit Detection is performed */ + ADI_SENSE_OCD_PER_CYCLE, + /*!< No Open-Circuit Detection is performed prior to each cycle */ + ADI_SENSE_OCD_PER_100_CYCLES, + /*!< No Open-Circuit Detection is performed at intervals of 100 cycles */ + ADI_SENSE_OCD_PER_1000_CYCLES, + /*!< No Open-Circuit Detection is performed at intervals of 1000 cycles */ +} ADI_SENSE_OCD_FREQUENCY; + +/*! ADI Sense analog sensor type options + * + * Select the sensor type that is connected to an ADC analog measurement + * channel. + * + * @note Some channels may only support a subset of the available sensor types + * below. + * + * @note "Custom" sensor types (with a _CUSTOMn suffix) are user-defined and + * require additional configuration parameters and linearisation data to + * be supplied. All other sensor types use pre-defined configuration + * information and linearisation data/equations. + */ +typedef enum { + ADI_SENSE_ADC_SENSOR_THERMOCOUPLE_J = 1, + /*!< Standard J-type Thermocouple temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_THERMOCOUPLE_K, + /*!< Standard K-type Thermocouple temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_THERMOCOUPLE_T, + /*!< Standard T-type Thermocouple temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_THERMOCOUPLE_CUSTOM, + /*!< Custom user-defined Thermocouple temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_RTD_2WIRE_PT100, + /*!< Standard 2-wire PT100 RTD temperature sensor + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_ADC_SENSOR_RTD_2WIRE_PT1000, + /*!< Standard 2-wire PT1000 RTD temperature sensor + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_ADC_SENSOR_RTD_2WIRE_CUSTOM, + /*!< Custom user-defined 2-wire RTD temperature sensor + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_ADC_SENSOR_RTD_3WIRE_PT100, + /*!< Standard 3-wire PT100 RTD temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_RTD_3WIRE_PT1000, + /*!< Standard 3-wire PT1000 RTD temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_RTD_3WIRE_CUSTOM, + /*!< Custom user-defined 3-wire RTD temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_RTD_4WIRE_PT100, + /*!< Standard 4-wire PT100 RTD temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_RTD_4WIRE_PT1000, + /*!< Standard 4-wire PT1000 RTD temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_RTD_4WIRE_CUSTOM, + /*!< Custom user-defined 4-wire RTD temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_BRIDGE_4WIRE_TRANSDUCER, + /*!< Standard 4-wire Bridge Transducer sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_BRIDGE_4WIRE_CUSTOM, + /*!< Custom user-defined 4-wire Bridge Transducer sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_BRIDGE_6WIRE_TRANSDUCER, + /*!< Standard 6-wire Bridge Transducer sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_BRIDGE_6WIRE_CUSTOM, + /*!< Custom user-defined 6-wire Bridge Transducer sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_THERMISTOR_10K_NTC, + /*!< Standard 10kOhm NTC Thermistor temperature sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_THERMISTOR_CUSTOM, + /*!< Custom user-defined Thermistor temperator sensor + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_VOLTAGE_PRESSURE_1, + /*!< Honeywell Pressure voltage sensor (HSCMRNN1.6BAAA3) + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_VOLTAGE_PRESSURE_2, + /*!< Amphenol Pressure voltage sensor (NPA-300B-015A) + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_VOLTAGE_PRESSURE_CUSTOM, + /*!< Custom user-defined 0-10V voltage sensor + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_CURRENT_PRESSURE_1, + /*!< Honeywell Pressure current sensor (PX2CN2XX100PACH) + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADI_SENSE_ADC_SENSOR_CURRENT_PRESSURE_CUSTOM, + /*!< Custom user-defined 4-20mA current sensor + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ +} ADI_SENSE_ADC_SENSOR_TYPE; + +/*! ADI Sense analog input signal amplification gain options + * + * @note applicable only to ADC analog sensor channels + */ +typedef enum { + ADI_SENSE_ADC_GAIN_1X = 0, + /*!< no amplification gain */ + ADI_SENSE_ADC_GAIN_2X, + /*!< x2 amplification gain */ + ADI_SENSE_ADC_GAIN_4X, + /*!< x4 amplification gain */ + ADI_SENSE_ADC_GAIN_8X, + /*!< x8 amplification gain */ + ADI_SENSE_ADC_GAIN_16X, + /*!< x16 amplification gain */ + ADI_SENSE_ADC_GAIN_32X, + /*!< x32 amplification gain */ + ADI_SENSE_ADC_GAIN_64X, + /*!< x64 amplification gain */ + ADI_SENSE_ADC_GAIN_128X, + /*!< x128 amplification gain */ +} ADI_SENSE_ADC_GAIN; + +/*! ADI Sense analog sensor excitation current output level options + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef enum { + ADI_SENSE_ADC_CURRENT_LEVEL_NONE = 0, + /*!< Excitation current disabled */ + ADI_SENSE_ADC_CURRENT_LEVEL_50uA, + /*!< 50uA excitation current enabled */ + ADI_SENSE_ADC_CURRENT_LEVEL_100uA, + /*!< 100uA excitation current enabled */ + ADI_SENSE_ADC_CURRENT_LEVEL_250uA, + /*!< 250uA excitation current enabled */ + ADI_SENSE_ADC_CURRENT_LEVEL_500uA, + /*!< 500uA excitation current enabled */ + ADI_SENSE_ADC_CURRENT_LEVEL_750uA, + /*!< 750uA excitation current enabled */ + ADI_SENSE_ADC_CURRENT_LEVEL_1000uA, + /*!< 1mA excitation current enabled */ +} ADI_SENSE_ADC_CURRENT_LEVEL; + +/*! ADI Sense analog sensor excitation current pin options + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef enum { + ADI_SENSE_ADC_CURRENT_SOURCE_DEFAULT = 0, + /*!< Excitation current output on default pin(s) (e.g. IOUT0) */ + ADI_SENSE_ADC_CURRENT_SOURCE_SWAP_STATIC, + /*!< Excitation current output pin assignments are swapped from defaults. + * @note this option is typically used only with 3-wire RTD sensors + */ + ADI_SENSE_ADC_CURRENT_SOURCE_SWAP_DYNAMIC, + /*!< Excitation current output on default output pins initially, then swapped + * for a second measurement + * @note this option is typically used only with 3-wire RTD sensors + */ +} ADI_SENSE_ADC_CURRENT_SOURCE; + +/*! ADI Sense analog reference selection options + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef enum { + ADI_SENSE_ADC_REFERENCE_NONE = 0, + /*!< No reference is selected */ + + ADI_SENSE_ADC_REFERENCE_RESISTOR_INTERNAL_1, + /*!< Internal reference resistor #1 (4320 ohms) is selected */ + ADI_SENSE_ADC_REFERENCE_RESISTOR_INTERNAL_2, + /*!< Internal reference resistor #2 (10000 ohms) is selected */ + ADI_SENSE_ADC_REFERENCE_VOLTAGE_INTERNAL, + /*!< Internal ADC voltage reference (2.5V) is selected */ + ADI_SENSE_ADC_REFERENCE_VOLTAGE_AVDD, + /*!< Analag Supply Voltage AVDD reference (typically 3.3V) is selected */ + + ADI_SENSE_ADC_REFERENCE_RESISTOR_EXTERNAL_1, + /*!< External user-supplied reference resistor #1 is selected + * + * @note reference resistor value @ref externalRef1Value must be specified + * (see @ref ADI_SENSE_MEASUREMENT_CONFIG) */ + ADI_SENSE_ADC_REFERENCE_RESISTOR_EXTERNAL_2, + /*!< External user-supplied reference resistor #2 is selected + * + * @note reference resistor value @ref externalRef2Value must be specified + * (see @ref ADI_SENSE_MEASUREMENT_CONFIG) */ + ADI_SENSE_ADC_REFERENCE_VOLTAGE_EXTERNAL_1, + /*!< External user-supplied reference voltage #1 is selected + * + * @note reference voltage value @ref externalRef1Value must be specified + * (see @ref ADI_SENSE_MEASUREMENT_CONFIG) */ + ADI_SENSE_ADC_REFERENCE_VOLTAGE_EXTERNAL_2, + /*!< External user-supplied reference voltage #2 is selected + * + * @note reference voltage value @ref externalRef2Value must be specified + * (see @ref ADI_SENSE_MEASUREMENT_CONFIG) */ +} ADI_SENSE_ADC_REFERENCE_TYPE; + +/*! ADI Sense analog filter selection options + * + * @note applicable only to ADC analog sensor channels + */ +typedef enum { + ADI_SENSE_ADC_FILTER_SINC4 = 1, + /*!< SINC4 filter + * + * @note The number of input samples to be averaged by the filter + * must be specified by @ref fs (see @ref ADI_SENSE_ADC_FILTER_CONFIG) + * The fs value affects the output sample rate and settling times + * of the ADC */ + ADI_SENSE_ADC_FILTER_FIR_20SPS, + /*!< FIR post filter, producing a 20sps output sample rate */ + ADI_SENSE_ADC_FILTER_FIR_25SPS, + /*!< FIR post filter, producing a 25sps output sample rate */ +} ADI_SENSE_ADC_FILTER_TYPE; + +/*! ADI Sense I2C digital sensor type options + * + * Select the sensor type that is connected to an I2C digital measurement + * channel. + * + * @note "Custom" sensor types (with a _CUSTOMn suffix) are user-defined and + * require additional configuration parameters and linearisation data to + * be supplied. All other sensor types use pre-defined configuration + * information and linearisation data/equations. + */ +typedef enum { + ADI_SENSE_I2C_SENSOR_HUMIDITY_HONEYWELL_HIH = 1, + /*!< Honeywell HiH9000-series humidity sensor + * + * @note For use with I2C Digital Sensor channels only + */ + ADI_SENSE_I2C_SENSOR_HUMIDITY_SENSIRION_SHT35, + /*!< Sensirion SHT35-DIS-B humidity sensor + * + * @note For use with I2C Digital Sensor channels only + */ + ADI_SENSE_I2C_SENSOR_CUSTOM, + /*!< Custom user-defined I2C digital sensor + * + * @note For use with I2C Digital Sensor channels only + */ +} ADI_SENSE_I2C_SENSOR_TYPE; + +/*! ADI Sense SPI digital sensor type options + * + * Select the sensor type that is connected to an SPI digital measurement + * channel. + * + * @note "Custom" sensor types (with a _CUSTOMn suffix) are user-defined and + * require additional configuration parameters and linearisation data to + * be supplied. All other sensor types use pre-defined configuration + * information and linearisation data/equations. + */ +typedef enum { + ADI_SENSE_SPI_SENSOR_PRESSURE_HONEYWELL_HSCDRN1 = 1, + /*!< Honeywell HSCDRNN1.6BASA3 pressure sensor + * + * @note For use with SPI Digital Sensor channels only + */ + ADI_SENSE_SPI_SENSOR_PRESSURE_ADI_ADXL362, + /*!< Analog Devices ADxL362 3-axis accelerometer sensor + * + * @note For use with SPI Digital Sensor channels only + * + * @note This sensor requires the use of 3 SPI Digital Sensor channels, with + * the sensor measurements from the X/Y/Z axes each output on a + * seperate dedicated channel (SPI#0/SPI#1/SPI#2, respectively) + */ + ADI_SENSE_SPI_SENSOR_CUSTOM, + /*!< Custom user-defined SPI digital sensor + * + * @note For use with SPI Digital Sensor channels only + */ +} ADI_SENSE_SPI_SENSOR_TYPE; + +/*! ADI Sense Power Configuration options */ +typedef struct { + ADI_SENSE_POWER_MODE powerMode; + /*!< Power mode selection */ + float32_t supplyVoltage; + /*!< AVDD analog supply voltage (e.g. 3.3V)*/ +} ADI_SENSE_POWER_CONFIG; + +/*! ADI Sense Multi-Cycle Configuration options + * + * @note required only when ADI_SENSE_OPERATING_MODE_MULTICYCLE is selected + * as the operatingMode (@ref ADI_SENSE_MEASUREMENT_CONFIG) + */ +typedef struct { + uint32_t cyclesPerBurst; + /*!< Number of cycles to complete for a single burst */ + uint32_t burstInterval; + /*!< Interval, in seconds, between each successive burst of cycles */ +} ADI_SENSE_MULTICYCLE_CONFIG; + +/*! ADI Sense Measurement Configuration options */ +typedef struct { + ADI_SENSE_OPERATING_MODE operatingMode; + /*!< Operating mode - specifies how measurement cycles are scheduled */ + ADI_SENSE_DATA_PUBLISH_MODE dataPublishMode; + /*!< Data publish mode - specifies how output samples are stored and + * published + */ + ADI_SENSE_MULTICYCLE_CONFIG multiCycleConfig; + /*!< Multi-Cycle configuration - specifies how bursts of measurement cycles + * are scheduled. Applicable only when operatingMode is + * ADI_SENSE_OPERATING_MODE_MULTICYCLE + */ + uint32_t cycleInterval; + /*!< Cycle interval - specifies the time interval between the start of each + * successive measurement cycle. Applicable only when operatingMode is + * not ADI_SENSE_OPERATING_MODE_SINGLECYCLE + */ + float32_t externalRef1Value; + /*!< Resistance/voltage value connected to external reference input #1. + * Applicable only if the selected reference type is + * ADI_SENSE_ADC_REFERENCE_RESISTOR_EXTERNAL_1 or + * ADI_SENSE_ADC_REFERENCE_VOLTAGE_EXTERNAL_1 + * (see @ref ADI_SENSE_ADC_REFERENCE_TYPE) + */ + float32_t externalRef2Value; + /*!< Resistance/voltage value connected to external reference input #2. + * Applicable only if the selected reference type is + * ADI_SENSE_ADC_REFERENCE_RESISTOR_EXTERNAL_2 or + * ADI_SENSE_ADC_REFERENCE_VOLTAGE_EXTERNAL_2 + * (see @ref ADI_SENSE_ADC_REFERENCE_TYPE) + */ +} ADI_SENSE_MEASUREMENT_CONFIG; + +/*! ADI Sense ADC Excitation Current output configuration + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef struct { + ADI_SENSE_ADC_CURRENT_LEVEL outputLevel; + /*!< Excitation current output level */ + ADI_SENSE_ADC_CURRENT_SOURCE sourceOption; + /*!< Excitation current output source options */ +} ADI_SENSE_ADC_CURRENT_CONFIG; + +/*! ADI Sense ADC Filter configuration + * + * @note applicable only to ADC analog sensor channels + */ +typedef struct { + ADI_SENSE_ADC_FILTER_TYPE type; + /*!< Filter type selection */ + uint32_t fs; + /*!< Number of input samples to accumulate and average in the filter. + * Applicable only when type is ADI_SENSE_ADC_FILTER_SINC4 */ +} ADI_SENSE_ADC_FILTER_CONFIG; + +/*! ADI Sense ADC Referemce configuration + * + * @note applicable only to ADC analog sensor channels + */ +typedef struct { + ADI_SENSE_ADC_REFERENCE_TYPE type; + /*!< Filter type selection */ + bool_t disableBuffer; + /*!< Option to disable internal ADC reference buffer */ +} ADI_SENSE_ADC_REFERENCE_CONFIG; + +/*! ADI Sense ADC analog channel configuration details + * + * @note applicable only to ADC analog sensor channels + */ +typedef struct { + ADI_SENSE_ADC_SENSOR_TYPE sensor; + /*!< Sensor type selection */ + ADI_SENSE_ADC_GAIN gain; + /*!< ADC Gain selection */ + ADI_SENSE_ADC_CURRENT_CONFIG current; + /*!< ADC Excitation Current configuration */ + ADI_SENSE_ADC_FILTER_CONFIG filter; + /*!< ADC Filter configuration */ + ADI_SENSE_ADC_REFERENCE_CONFIG reference; + /*!< ADC Reference configuration */ + bool_t enableVbias; + /*!< Option to enable internal ADC voltage bias */ +} ADI_SENSE_ADC_CHANNEL_CONFIG; + +/*! ADI Sense I2C digital channel configuration details + * + * @note applicable only to I2C digital sensor channels + */ +typedef struct { + ADI_SENSE_I2C_SENSOR_TYPE sensor; + /*!< Sensor type selection */ + uint32_t deviceAddress; + /*!< I2C device address (7-bit) */ +} ADI_SENSE_I2C_CHANNEL_CONFIG; + +/*! ADI Sense SPI digital channel configuration details + * + * @note applicable only to SPI digital sensor channels + */ +typedef struct { + ADI_SENSE_SPI_SENSOR_TYPE sensor; + /*!< Sensor type selection */ +} ADI_SENSE_SPI_CHANNEL_CONFIG; + +/*! ADI Sense Measurement Channel configuration details */ +typedef struct { + bool_t enableChannel; + /*!< Option to enable this channel. If set to false, all other fields + * are ignored and this channel will be omitted from measurement cycles + */ + bool_t disablePublishing; + /*!< Option to disable publishing of data samples from this channel. The + * channel may still be included in measurement cycles, but data samples + * obtained from this channel will not be published. This is typically + * used for channels which are required only as a compensation reference + * for another channel (e.g. Cold-Junction Compensation channels). + */ + ADI_SENSE_CHANNEL_ID compensationChannel; + /*!< Optional compensation channel. Set to ADI_SENSE_CHANNEL_ID_NONE if not + * required. Typically used for thermocouple sensors that require a + * separate measurement of the "cold-junction" temperature, which can be + * be provided by an RTD temperature sensor connected on a separate + * "compensation channel" */ + ADI_SENSE_UNIT_TRANSLATION unitTranslation; + /*!< Optional translation from one measurement unit to another, to be + * performed on each processed sample prior to publishing. Set to + * ADI_SENSE_UNIT_TRANSLATION_NONE if not required. + */ + float32_t measurementMinValue; + /*!< Optional minimum threshold value for each processed sample, to be + * checked prior to publishing. A channel ALERT condition is raised + * if the processed value is lower than this threshold. Set to NaN + * if not required. + */ + float32_t measurementMaxValue; + /*!< Optional maximum threshold value for each processed sample, to be + * checked prior to publishing. A channel ALERT condition is raised + * if the processed value is higher than this threshold. Set to NaN + * if not required. + */ + uint32_t measurementsPerCycle; + /*!< The number of measurements to obtain from this channel within each + * cycle. Each enabled channel is measured in turn, until the number of + * measurements requested for the channel has been reached. A different + * number of measurements-per-cycle may be specified for each channel. + */ + uint32_t extraSettlingTime; + /*!< A minimum settling time is applied internally for each channel, based + * on the sensor type. However, additional settling time (microseconds) + * can optionally be specified. Set to 0 if not required. + */ + union { + ADI_SENSE_ADC_CHANNEL_CONFIG adcChannelConfig; + /*!< ADC channel configuration - applicable only to ADC channels */ + ADI_SENSE_I2C_CHANNEL_CONFIG i2cChannelConfig; + /*!< I2C channel configuration - applicable only to I2C channels */ + ADI_SENSE_SPI_CHANNEL_CONFIG spiChannelConfig; + /*!< SPI channel configuration - applicable only to SPI channels */ + }; + /*!< Only one of adcChannelConfig, i2cChannelConfig, or spiChannelConfig is + * required, depending on the channel designation (analog, I2C or SPI) + */ +} ADI_SENSE_CHANNEL_CONFIG; + +/*! ADI Sense Diagnostics configuration details */ +typedef struct { + bool_t enableGlobalDiag; + /*!< Option to enable system-level diagnostic checks + * (e.g. communication and data integrity, power supply health, etc.) + */ + bool_t enableMeasurementDiag; + /*!< Option to enable channel-specific measurement-level diagnostic checks + * (e.g. range detection, timeouts, reference detection, etc.) + */ + ADI_SENSE_OCD_FREQUENCY openCircuitDetectionFreq; + /*!< Option to enable Open-Circuit Detection at a selected cycle interval */ +} ADI_SENSE_DIAGNOSTICS_CONFIG; + +/*! ADI Sense Device configuration details */ +typedef struct { + ADI_SENSE_PRODUCT_ID productId; + /*!< Identify the product type for which this configuration is valid */ + ADI_SENSE_POWER_CONFIG power; + /*!< Power configuration details */ + ADI_SENSE_MEASUREMENT_CONFIG measurement; + /*!< Measurement configuration details */ + ADI_SENSE_DIAGNOSTICS_CONFIG diagnostics; + /*!< Diagnostics configuration details */ + ADI_SENSE_CHANNEL_CONFIG channels[ADI_SENSE_MAX_CHANNELS]; + /*!< Channel-specific configuration details */ +} ADI_SENSE_DEVICE_CONFIG; + +/*! ADI Sense global configuration details + * + * @note This may encapsulate configuration details for multiple ADI Sense + * device instances, but currently only a single instance is supported + */ +typedef struct { + ADI_SENSE_CONFIG_ID configId; + /*!< Optional unique identifier for this configuration */ + ADI_SENSE_CONFIG_VERSION_ID versionId; + /*!< Identifies the schema version for this configuration */ + uint32_t numDevices; + /*!< The number of valid device configurations (currently limited to 1) */ + ADI_SENSE_DEVICE_CONFIG devices[ADI_SENSE_MAX_DEVICES]; + /*!< An array of device configurations, with the number of valid elements + * specified by @ref numDevices + */ +} ADI_SENSE_CONFIG; + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_CONFIG_TYPES_H__ */ +