Mbed FW update

inc/admw1001/admw1001_config.h

Committer:
Vkadaba
Date:
2019-06-15
Revision:
6:9d393a9677f4
Parent:
5:0728bde67bdb
Child:
8:2f2775c34640

File content as of revision 6:9d393a9677f4:

/*
Copyright 2019 (c) 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.
  - 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.
  - Use of the software either in source or binary form, must be run
    on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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.
 */

/*!
 ******************************************************************************
 * @file:   admw1001_config.h
 * @brief:  Configuration type definitions for ADMW1001.
 *-----------------------------------------------------------------------------
 */

#ifndef __ADMW1001_CONFIG_H__
#define __ADMW1001_CONFIG_H__

#include "admw_platform.h"
#include "admw1001_sensor_types.h"

/* Undefine for versions prior to V2.3. */
#undef __V2_3_CFG_FMT__


/*! @addtogroup ADMW1001_Api
 *  @{
 */

#ifdef __cplusplus
extern "C" {
#endif

/*! Maximum length allowed for a digital sensor command */
#define ADMW1001_SENSOR_COMMAND_MAX_LENGTH 7

/*! ADMW1001 channel priority options */
typedef enum {
    ADMW1001_CHANNEL_PRIORITY_0 = 0,
    ADMW1001_CHANNEL_PRIORITY_1,
    ADMW1001_CHANNEL_PRIORITY_2,
    ADMW1001_CHANNEL_PRIORITY_3,
    ADMW1001_CHANNEL_PRIORITY_4,
    ADMW1001_CHANNEL_PRIORITY_5,
    ADMW1001_CHANNEL_PRIORITY_6,
    ADMW1001_CHANNEL_PRIORITY_7,
    ADMW1001_CHANNEL_PRIORITY_8,
    ADMW1001_CHANNEL_PRIORITY_9,
    ADMW1001_CHANNEL_PRIORITY_10,
    ADMW1001_CHANNEL_PRIORITY_11,
    ADMW1001_CHANNEL_PRIORITY_12,
    ADMW1001_CHANNEL_PRIORITY_13,
    ADMW1001_CHANNEL_PRIORITY_14,
    ADMW1001_CHANNEL_PRIORITY_15,

    ADMW1001_CHANNEL_PRIORITY_HIGHEST = ADMW1001_CHANNEL_PRIORITY_0,
    ADMW1001_CHANNEL_PRIORITY_LOWEST  = ADMW1001_CHANNEL_PRIORITY_15,
} ADMW1001_CHANNEL_PRIORITY;

/*! ADMW1001 operating mode options */
typedef enum {
    ADMW1001_OPERATING_MODE_SINGLECYCLE = 0,
    /*!< Executes a single measurement cycle and stops */
    ADMW1001_OPERATING_MODE_CONTINUOUS,
    /*!< Continuously executes measurement cycles */
    ADMW1001_OPERATING_MODE_MULTICYCLE,
    /*!< Executes a burst of measurement cycles, repeated at defined intervals */
} ADMW1001_OPERATING_MODE;

/*! ADMW1001 data ready mode options */
typedef enum {
    ADMW1001_DATAREADY_PER_CONVERSION = 0,
    /*!< 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
     */
    ADMW1001_DATAREADY_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
     */
    ADMW1001_DATAREADY_PER_MULTICYCLE_BURST,
    /*!< The DATAREADY signal is asserted after completion of each burst of
     *   measurement cycles
     *   - applicable only when @ref ADMW1001_OPERATING_MODE_MULTICYCLE
     *     is also selected
     *   - data samples only from the lastest completed burst of measurement
     *     cycles are stored in this mode
     */
} ADMW1001_DATAREADY_MODE;

/*! ADMW1001 power mode options */
typedef enum {
    ADMW1001_POWER_MODE_HIBERNATION = 0,
    /*!< module has entede hibernation mode. All analog circuitry is disabled. All peripherals disabled apart from the Wake-up pin functionality. */
    ADMW1001_POWER_MODE_ACTIVE,
    /*!< Part is fully powered up and either cycling through a sequence or awaiting a configuration */
} ADMW1001_POWER_MODE;

#ifdef __V2_3_CFG_FMT__
/*! ADMW1001 measurement analog filter settling options */
typedef enum
{
    ADMW1001_FILTER_SETTLING_ALWAYS = 0,
    /*!< Allow full settling time to elapse between every measurement from an analog sensor */
    ADMW1001_FILTER_SETTLING_FAST,
    /*!< Skip settling time between consecutive measurements from an analog sensor */
} ADMW1001_FILTER_SETTLING;
#endif

/*! ADMW1001 measurement unit options
 *
 *  Optionally select a measurement unit for final conversion results.
 *  Currently applicable only to specific temperature sensor types.
 */
typedef enum {
    ADMW1001_MEASUREMENT_UNIT_UNSPECIFIED = 0,
    /*!< No measurement unit specified */
    ADMW1001_MEASUREMENT_UNIT_CELSIUS,
    /*!< Celsius temperature unit - applicable to temperature sensors only */
    ADMW1001_MEASUREMENT_UNIT_FAHRENHEIT,
    /*!< Fahrenheit temperature unit - applicable to temperature sensors only */
} ADMW1001_MEASUREMENT_UNIT;

/*! ADMW1001 Open-Sensor Diagnostics frequency
 *
 *  Select the per-cycle frequency at which open-sensor diagnostic
 *  checks should be performed.  Open-sensor diagnostic checks typically require
 *  specific or time-consuming processing which cannot be executed while a
 *  measurement cycle is running.
 *
 *  @note Open-sensor diagnostic checks, when performed, will add a delay to the
 *        start of the next measurement cycle.
 */
typedef enum {
    ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED = 0,
    /*!< No Open-Sensor Detection is performed */
    ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_CYCLE,
    /*!< No Open-Sensor Detection is performed prior to each cycle */
    ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_100_CYCLES,
    /*!< No Open-Sensor Detection is performed at intervals of 100 cycles */
    ADMW1001_OPEN_SENSOR_DIAGNOSTICS_PER_1000_CYCLES,
    /*!< No Open-Sensor Detection is performed at intervals of 1001 cycles */
} ADMW1001_OPEN_SENSOR_DIAGNOSTICS;

/*! ADMW1001 analog input signal amplification gain options
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef enum {
    ADMW1001_ADC_RTD_CURVE_EUROPEAN = 0,
    /*!< EUROPEAN RTD curve used. */
    ADMW1001_ADC_RTD_CURVE_AMERICAN,
    /*!< AMERICAN RTD curve used. */
    ADMW1001_ADC_RTD_CURVE_JAPANESE,
    /*!< JAPANESE RTD curve used. */
    ADMW1001_ADC_RTD_CURVE_ITS90,
    /*!< ITS90 RTD curve used. */
} ADMW1001_ADC_RTD_CURVE;
/*! ADMW1001 analog input signal amplification gain options
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef enum {
    ADMW1001_ADC_GAIN_1X = 0,
    /*!< no amplification gain */
    ADMW1001_ADC_GAIN_2X,
    /*!< x2 amplification gain */
    ADMW1001_ADC_GAIN_4X,
    /*!< x4 amplification gain */
    ADMW1001_ADC_GAIN_8X,
    /*!< x8 amplification gain */
    ADMW1001_ADC_GAIN_16X,
    /*!< x16 amplification gain */
    ADMW1001_ADC_GAIN_32X,
    /*!< x32 amplification gain */
    ADMW1001_ADC_GAIN_64X,
    /*!< x64 amplification gain */
    ADMW1001_ADC_GAIN_128X,
    /*!< x128 amplification gain */
} ADMW1001_ADC_GAIN;

/*! ADMW1001 analog sensor excitation state options
 *
 *  @note applicable only to ADC analog sensor channels, and
 *        specific sensor types
 */
typedef enum {
    ADMW1001_ADC_EXC_STATE_ALWAYS_ON,
    /*!< Excitation for measurement is always on */
    ADMW1001_ADC_EXC_STATE_CYCLE_POWER,
    /*!< Excitation for measurement is active only during measurement */
} ADMW1001_ADC_EXC_STATE;

/*! ADMW1001 analog sensor excitation current output level options
 *
 *  @note applicable only to ADC analog sensor channels, and
 *        specific sensor types
 */
typedef enum {
    ADMW1001_ADC_EXC_CURRENT_EXTERNAL = 0,
    /*!< External excitation is provided */ 
    ADMW1001_ADC_EXC_CURRENT_50uA,
    /*!< 50uA excitation current enabled */
    ADMW1001_ADC_EXC_CURRENT_100uA,
    /*!< 100uA excitation current  */
    ADMW1001_ADC_EXC_CURRENT_250uA,
    /*!< 250uA excitation current enabled */
    ADMW1001_ADC_EXC_CURRENT_500uA,
    /*!< 500uA excitation current enabled */
    ADMW1001_ADC_EXC_CURRENT_1000uA,
    /*!< 1mA excitation current enabled */
} ADMW1001_ADC_EXC_CURRENT;

/*! ADMW1001 analog sensor excitation current ratios used for diode sensor
 *
 *  @note applicable only to a diode sensor
 */
typedef enum {
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_10UA_100UA = 0, 
    /**< 2 Current measurement 10uA 100uA        */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_20UA_160UA,  
    /**< 2 Current measurement 20uA 160uA        */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_50UA_300UA,  
    /**< 2 Current measurement 50uA 300uA        */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_100UA_600UA,  
    /**< 2 Current measurement 100uA 600uA       */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_10UA_50UA_100UA,  
    /**< 3 current measuremetn 10uA 50uA 100uA   */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_20UA_100UA_160UA,  
    /**< 3 current measuremetn 20uA 100uA 160uA  */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_50UA_150UA_300UA,  
    /**< 3 current measuremetn 50uA 150uA 300uA  */
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_100UA_300UA_600UA,
    /**< 3 current measuremetn 100uA 300uA 600uA */
} ADMW1001_ADC_EXC_CURRENT_DIODE_RATIO;

/*! ADMW1001 analog reference selection options
 *
 *  @note applicable only to ADC analog sensor channels, and
 *        specific sensor types
 */
typedef enum {
    ADMW1001_ADC_REFERENCE_NONE = 0,
    /*!< No reference is selected */

    ADMW1001_ADC_REFERENCE_RESISTOR_INTERNAL_1,
    /*!< Internal reference resistor #1 (4320 ohms) is selected */
    ADMW1001_ADC_REFERENCE_RESISTOR_INTERNAL_2,
    /*!< Internal reference resistor #2 (10010 ohms) is selected */
    ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL,
    /*!< Internal ADC voltage reference (2.5V) is selected */
    ADMW1001_ADC_REFERENCE_VOLTAGE_AVDD,
    /*!< Analag Supply Voltage AVDD reference (typically 3.3V) is selected */

    ADMW1001_ADC_REFERENCE_RESISTOR_EXTERNAL_1,
    /*!< External user-supplied reference resistor #1 is selected
     *
     * @note reference resistor value externalRef1Value must be specified
     * (see @ref ADMW1001_MEASUREMENT_CONFIG) */
    ADMW1001_ADC_REFERENCE_RESISTOR_EXTERNAL_2,
    /*!< External user-supplied reference resistor #2 is selected
     *
     * @note reference resistor value externalRef2Value must be specified
     * (see @ref ADMW1001_MEASUREMENT_CONFIG) */
    ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_1,
    /*!< External user-supplied reference voltage #1 is selected
     *
     * @note reference voltage value externalRef1Value must be specified
     * (see @ref ADMW1001_MEASUREMENT_CONFIG) */
    ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_2,
    /*!< External user-supplied reference voltage #2 is selected
     *
     * @note reference voltage value externalRef2Value must be specified
     * (see @ref ADMW1001_MEASUREMENT_CONFIG) */
    ADMW1001_ADC_REFERENCE_BRIDGE_EXCITATION,
    /*!< Bridge Excition Voltage is selected as reference
     *
     * @note this reference MUST be selected for 4/6-wire bridge sensor types
     * (see @ref ADMW1001_ADC_SENSOR_TYPE) */
} ADMW1001_ADC_REFERENCE_TYPE;

/*! ADMW1001 ADC Reference configuration
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef enum {
    ADMW1001_ADC_GND_SW_OPEN = 0,
    /*!< Ground switch not enabled for measurement. */
    ADMW1001_ADC_GND_SW_CLOSED,
    /*!< Ground switch closed for measurement. */
} ADMW1001_ADC_GND_SW;

/*! ADMW1001 analog filter selection options
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef enum {
    ADMW1001_ADC_FILTER_SINC4 = 0,
    /*!< SINC4 filter
     *
     * @note The number of input samples to be averaged by the filter
     *       must be specified by fs (see @ref ADMW1001_ADC_FILTER_CONFIG).
     *       The fs value affects the output sample rate and settling times
     *       of the ADC */
    ADMW1001_ADC_FILTER_SINC3,
} ADMW1001_ADC_FILTER_TYPE;

/*! ADMW1001 I2C clock speed options
 *
 *  @note applicable only for I2C sensors
 */
typedef enum
{
  ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED_100K = 0,
    /*!< 100kHz I2C clock speed */
  ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED_400K,
    /*!< 400kHz I2C clock speed */
} ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED;

/*! ADMW1001 SPI mode options
 *
 *  @note applicable only for SPI sensors
 */
typedef enum
{
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE_0 = 0,
    /*!< SPI mode 0 Clock Polarity = 0 Clock Phase = 0 */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE_1,
    /*!< SPI mode 0 Clock Polarity = 0 Clock Phase = 1 */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE_2,
    /*!< SPI mode 0 Clock Polarity = 1 Clock Phase = 0 */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE_3,
    /*!< SPI mode 0 Clock Polarity = 1 Clock Phase = 1 */
} ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE;

/*! ADMW1001 SPI clock speed options
 *
 *  @note applicable only for SPI sensors
 */
typedef enum
{
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_13MHZ = 0,
    /*!< SPI Clock Speed configured to 13MHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_6_5MHZ,
    /*!< SPI Clock Speed configured to 6.5MHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_3_25MHZ,
    /*!< SPI Clock Speed configured to 3.25MHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_1_625MHZ,
    /*!< SPI Clock Speed configured to 1.625MHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_812KHZ,
    /*!< SPI Clock Speed configured to 812kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_406KHZ,
    /*!< SPI Clock Speed configured to 406kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_203KHZ,
    /*!< SPI Clock Speed configured to 203kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_101KHZ,
    /*!< SPI Clock Speed configured to 101kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_50KHZ,
    /*!< SPI Clock Speed configured to 50kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_25KHZ,
    /*!< SPI Clock Speed configured to 25kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_12KHZ,
    /*!< SPI Clock Speed configured to 12kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_6KHZ,
    /*!< SPI Clock Speed configured to 6kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_3KHZ,
    /*!< SPI Clock Speed configured to 3kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_1_5KHZ,
    /*!< SPI Clock Speed configured to 1.5kHz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_793HZ,
    /*!< SPI Clock Speed configured to 793hz */
  ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK_396HZ,
    /*!< SPI Clock Speed configured to 396hz */
} ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK;

/*! ADMW1001 Power Configuration options */
typedef struct {
    ADMW1001_POWER_MODE        powerMode;
    /*!< Power mode selection */
} ADMW1001_POWER_CONFIG;

/*! ADMW1001 Multi-Cycle Configuration options
 *
 * @note required only when ADMW1001_OPERATING_MODE_MULTICYCLE is selected
 *       as the operatingMode (@ref ADMW1001_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 */
} ADMW1001_MULTICYCLE_CONFIG;

/*! ADMW1001 Measurement Configuration options */
typedef struct {
    ADMW1001_OPERATING_MODE    operatingMode;
    /*!< Operating mode - specifies how measurement cycles are scheduled */
    ADMW1001_DATAREADY_MODE    dataReadyMode;
    /*!< Data read mode - specifies how output samples are stored for reading */
    ADMW1001_MULTICYCLE_CONFIG multiCycleConfig;
    /*!< Multi-Cycle configuration - specifies how bursts of measurement cycles
     *   are scheduled.  Applicable only when operatingMode is
     *   ADMW1001_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 ADMW1001_OPERATING_MODE_SINGLECYCLE
     */
#ifdef __V2_3_CFG_FMT__
    ADMW1001_FILTER_SETTLING   filterSettling;
    /*!< Analog filter settling - specifies the policy for settling time
     *   between consecutive measurements from an analog channel in a multi-
     *   channel configuration.  Note that, in single analog channel
     *   configurations, settling time is always skipped between consecutive
     *   measurements in a measurement cycle.
     */
#endif
    float32_t                        externalRef1Value;
    /*!< Resistance/voltage value connected to external reference input #1.
     *   Applicable only if the selected reference type is
     *   ADMW1001_ADC_REFERENCE_RESISTOR_EXTERNAL_1 or
     *   ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_1
     *   (see @ref ADMW1001_ADC_REFERENCE_TYPE)
     */    
    bool                             enableExternalFlash;
    /*!< Enable the use of external flash memory for storage of samples.
     */
} ADMW1001_MEASUREMENT_CONFIG;

/*! ADMW1001 ADC Excitation Current output configuration
 *
 *  @note applicable only to ADC analog sensor channels, and
 *        specific sensor types
 */
typedef struct {
    ADMW1001_ADC_EXC_STATE                excitationState;
    /*!< Excitation current state */
    ADMW1001_ADC_EXC_CURRENT              outputLevel;
    /*!< Excitation current output level */
    ADMW1001_ADC_EXC_CURRENT_DIODE_RATIO  diodeRatio;
    /*!< Excitation current output diode ratio */
} ADMW1001_ADC_EXC_CURRENT_CONFIG;

/*! ADMW1001 ADC Filter configuration
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef struct {
    ADMW1001_ADC_FILTER_TYPE   type;
    /*!< Filter type selection */
    uint32_t                    sf;
    /*!< SF value used along with filter type to determine speed */
    bool                  filterChop;
    /*!< Enable filter chop */
    bool                  notch1p2;
    /*!< Enable Notch 2 Filter Mode */
    ADMW1001_ADC_GND_SW             groundSwitch;
    /*!< Option to open or close sensor ground switch */
} ADMW1001_ADC_FILTER_CONFIG;

/*! ADMW1001 ADC Referemce configuration
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef struct {
    ADMW1001_ADC_REFERENCE_TYPE    type;
    /*!< Filter type selection */
} ADMW1001_ADC_REFERENCE_CONFIG;

/*! ADMW1001 ADC analog channel configuration details
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef struct {
    ADMW1001_ADC_SENSOR_TYPE        sensor;
    /*!< Sensor type selection */
    ADMW1001_ADC_RTD_CURVE          rtdCurve;
    /*!< Rtd curve selection */
    ADMW1001_ADC_GAIN               gain;
    /*!< ADC Gain selection */
    ADMW1001_ADC_EXC_CURRENT_CONFIG current;
    /*!< ADC Excitation Current configuration */
    ADMW1001_ADC_FILTER_CONFIG      filter;
    /*!< ADC Filter configuration */
    ADMW1001_ADC_REFERENCE_CONFIG   reference;
    /*!< ADC Reference configuration */
    bool                             enableVbias;
    /*!< Option to enable internal ADC voltage bias */
} ADMW1001_ADC_CHANNEL_CONFIG;

/*! ADMW1001 digital sensor data encoding
 *
 *  @note applicable only to SPI and I2C digital sensor channels
 */
typedef enum
{
    ADMW1001_DIGITAL_SENSOR_DATA_CODING_NONE,
    /**< None/Invalid - data format is ignored if coding is set to this value */
    ADMW1001_DIGITAL_SENSOR_DATA_CODING_UNIPOLAR,
    /**< Unipolar - unsigned integer values */
    ADMW1001_DIGITAL_SENSOR_DATA_CODING_TWOS_COMPLEMENT,
    /**< Twos-complement - signed integer values */
    ADMW1001_DIGITAL_SENSOR_DATA_CODING_OFFSET_BINARY,
    /**< Offset Binary - used to represent signed values with unsigned integers,
     *   with the mid-range value representing 0 */
} ADMW1001_DIGITAL_SENSOR_DATA_CODING;

/*! ADMW1001 digital sensor data format configuration
 *
 *  @note applicable only to SPI and I2C digital sensor channels
 */
typedef struct {
    ADMW1001_DIGITAL_SENSOR_DATA_CODING coding;
    /**< Data Encoding of Sensor Result */
    bool littleEndian;
    /**< Set as true if data format is little-endian, false otherwise */
    bool leftJustified;
    /**< Set as true if data is left-justified in the data frame, false otherwise */
    uint8_t frameLength;
    /**< Data frame length (number of bytes to read from the sensor) */
    uint8_t numDataBits;
    /**< Number of relevant data bits to extract from the data frame */
    uint8_t bitOffset;
    /**< Data bit offset, relative to data alignment within the data frame */
} ADMW1001_DIGITAL_SENSOR_DATA_FORMAT;

/*! ADMW1001 digital sensor command
 *
 *  @note applicable only to SPI and I2C digital sensor channels
 */
typedef struct {
    uint8_t command[ADMW1001_SENSOR_COMMAND_MAX_LENGTH];
    /*!< Optional command bytes to send to the device */
    uint8_t commandLength;
    /*!< Number of valid command bytes.  Set to 0 if unused */
} ADMW1001_DIGITAL_SENSOR_COMMAND;

/*! ADMW1001 digital sensor calibration param
 *
 *  @note applicable only to digital sensor channels
 */
typedef struct {
    uint32_t calibrationParam;
    /*!< Independently established environmental variable used during calibration
     *   of a digital sensor. Used only if the sensor supports calibration
     *   and expects an environmental parameter
     */
    bool enableCalibrationParam;
    /*!< Allow Calibration_Parameter to be used during calibration of any digital sensor */
} ADMW1001_DIGITAL_CALIBRATION_COMMAND;

/*! ADMW1001 digital sensor communication config
 *
 *  @note applicable only to digital sensor channels
 */
typedef struct {
    bool  useCustomCommsConfig;
    /*!< Optional parameter to enable user digital communication settings */
    ADMW1001_DIGITAL_SENSOR_COMMS_I2C_CLOCK_SPEED     i2cClockSpeed;
    /*!< Optional parameter to configure specific i2c speed for i2c sensor */
    ADMW1001_DIGITAL_SENSOR_COMMS_SPI_MODE            spiMode;
    /*!< Optional parameter to configure specific spi mode for spi sensor */
    ADMW1001_DIGITAL_SENSOR_COMMS_SPI_CLOCK           spiClock;
    /*!< Optional parameter to configure specific spi clock for spi sensor */
} ADMW1001_DIGITAL_SENSOR_COMMS;

/*! ADMW1001 I2C digital channel configuration details
 *
 *  @note applicable only to I2C digital sensor channels
 */
typedef struct {
    ADMW1001_I2C_SENSOR_TYPE        sensor;
    /*!< Sensor type selection */
    uint32_t                              deviceAddress;
    /*!< I2C device address (7-bit) */
    ADMW1001_DIGITAL_SENSOR_COMMAND configurationCommand;
    /*!< Optional configuration command to send to the device at start-up.
     *   A default configuration command will be used if this is not specified.
     *   Applicable only to specific I2C sensor types.
     */
    ADMW1001_DIGITAL_SENSOR_COMMAND dataRequestCommand;
    /*!< Optional data request command to send to the device for each sample.
     *   A default data request command will be used if this is not specified.
     *   Applicable only to specific I2C sensor types.
     */
    ADMW1001_DIGITAL_SENSOR_DATA_FORMAT dataFormat;
    /*!< Optional data format configuration to parse/extract data from the device.
     *   A default data format will be used if this is not specified.
     *   Applicable only to specific I2C sensor types
     */
    ADMW1001_DIGITAL_CALIBRATION_COMMAND digitalCalibrationParam;
    /*!< This is used to supply an independently established environmental variable
     *   that must be used during calibration of a [digital] sensor which a)
     *   supports calibration and b) expects an environmental parameter.
     *   An example is a CO2 sensor, which may require the CO2 concentration level
     *   when performing a calibration
     */
    ADMW1001_DIGITAL_SENSOR_COMMS configureComms;
    /*!< Optional configuration to setup a user communication config.
     *   A default configuration  will be used if this is not specified.
     *   Applicable only to specific I2C sensor types.
     */
} ADMW1001_I2C_CHANNEL_CONFIG;

/*! ADMW1001 SPI digital channel configuration details
 *
 *  @note applicable only to SPI digital sensor channels
 */
typedef struct {
    ADMW1001_SPI_SENSOR_TYPE        sensor;
    /*!< Sensor type selection */
    ADMW1001_DIGITAL_SENSOR_COMMAND configurationCommand;
    /*!< Optional configuration command to send to the device at start-up.
     *   A default configuration command will be used if this is not specified.
     *   Applicable only to specific SPI sensor types.
     */
    ADMW1001_DIGITAL_SENSOR_COMMAND dataRequestCommand;
    /*!< Optional data request command to send to the device for each sample.
     *   A default data request command will be used if this is not specified.
     *   Applicable only to specific SPI sensor types.
     */
    ADMW1001_DIGITAL_SENSOR_DATA_FORMAT dataFormat;
    /*!< Optional data format configuration to parse/extract data from the device.
     *   A default data format will be used if this is not specified.
     *   Applicable only to specific SPI sensor types
     */
    ADMW1001_DIGITAL_CALIBRATION_COMMAND digitalCalibrationParam;
    /*!< This is used to supply an independently established environmental variable
     *   that must be used during calibration of a [digital] sensor which a)
     *   supports calibration and b) expects an environmental parameter.
     *   An example is a CO2 sensor, which may require the CO2 concentration level
     *   when performing a calibration
     */
    ADMW1001_DIGITAL_SENSOR_COMMS configureComms;
    /*!< Optional configuration to setup a user communication config.
     *   A default configuration  will be used if this is not specified.
     *   Applicable only to specific SPI sensor types.
     */
} ADMW1001_SPI_CHANNEL_CONFIG;


/*! ADMW1001 Measurement Channel configuration details */
typedef struct {
    bool                                 enableChannel;
    /*!< Option to include this channel in normal measurement cycles */
    bool                                 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).
     */
    ADMW1001_CHANNEL_ID                compensationChannel;
    /*!< Optional compensation channel.  Set to ADMW1001_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" */
    bool                                 enableUnityLut;
    /*!< Option to choose the LUT for calculations, this implies that the
     * fundamental measurement for the sensor (typically mV or Ohms)
     * would be returned as the measurement result.
     */
    ADMW1001_MEASUREMENT_UNIT          measurementUnit;
    /*!< Optional measurement unit selection for conversion results.  Applicable
     *   only for certain sensor types.  Set to
     *   ADMW1001_MEASUREMENT_UNIT_DEFAULT if not applicable.
     */
    float32_t                            lowThreshold;
    /*!< 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                            highThreshold;
    /*!< 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.
     */
    float32_t                            offsetAdjustment;
    /*!< Optional offset adjustment value applied to each processed sample.
     *   Set to NaN or 0.0 if not required.
     */
    float32_t                            gainAdjustment;
    /*!< Optional gain adjustment value applied to each processed sample.
     *   Set to NaN or 1.0 if not required.
     */
    float32_t                            sensorParameter;
    /*!< Optional sensor parameter adjustment.
     *   Set to NaN or 0 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                             cycleSkipCount;
    /*!< Optional number of cycles to skip, such that this channel is included
     *   in the sequence in only one of every (cycleSkipCount + 1) cycles that
     *   occur.  If set to 0 (default), this channel is included in every cycle;
     *   if set to 1, this channel is included in every 2nd cycle; if set to 2,
     *   this channel is included in every 3rd cycle, and so on.
     */
    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.
     */
    ADMW1001_CHANNEL_PRIORITY          priority;
    /*!< By default, channels are arranged in the measurement sequence based on
     *   ascending order of channel ID.  However, a priority-level may be
     *   specified per channel to force a different ordering of the channels,
     *   with higher-priority channels appearing before lower-priority channels.
     *   Channels with equal priority are ordered by ascending order of channel
     *   ID.  Lower numbers indicate higher priority, with 0 being the highest.
     *   Set to 0 if not required.
     */
    union {
        ADMW1001_ADC_CHANNEL_CONFIG adcChannelConfig;
        /*!< ADC channel configuration - applicable only to ADC channels */
        ADMW1001_I2C_CHANNEL_CONFIG i2cChannelConfig;
        /*!< I2C channel configuration - applicable only to I2C channels */
        ADMW1001_SPI_CHANNEL_CONFIG spiChannelConfig;
        /*!< SPI channel configuration - applicable only to SPI channels */
    };
    /*!< Only one of adcChannelConfig, i2cChannelConfig, spiChannelConfig
     *  is required, depending on the channel designation
     *   (analog, I2C, SPI)
     */
} ADMW1001_CHANNEL_CONFIG;

/*! ADMW1001 Diagnostics configuration details */
typedef struct {
    bool                                   disableGlobalDiag;
    /*!< Option to disable the following diagnostic checks on the ADC:
     *   - Reference Detection errors
     *   - Input under-/over-voltage errors
     *   - Calibration, Conversion and Saturation errors
     */
    bool                                   disableMeasurementDiag;
    /*!< Option to disable additional checks per measurement channel:
     *   - High/low threshold limit violation
     */
#ifdef __V2_3_CFG_FMT__
    bool                                   disableCriticalTempAbort;
    /*!< Option to disable abort of measurement cycle if the operating
     *   temperature of the ADMW1001 has exceeded critical limits
     */
#endif
    ADMW1001_OPEN_SENSOR_DIAGNOSTICS osdFrequency;
    /*!< Option to enable Open-Circuit Detection at a selected cycle interval */
} ADMW1001_DIAGNOSTICS_CONFIG;

#ifdef __V2_3_CFG_FMT__
typedef uint16_t ADMW1001_ADVANCED_ACCESS_KEY;
#endif

/*! ADMW1001 Device configuration details */
typedef struct {
    ADMW1001_POWER_CONFIG           power;
    /*!< Power configuration details */
    ADMW1001_MEASUREMENT_CONFIG     measurement;
    /*!< Measurement configuration details */
    ADMW1001_DIAGNOSTICS_CONFIG     diagnostics;
    /*!< FFT configuration details */
    ADMW1001_CHANNEL_CONFIG         channels[ADMW1001_MAX_CHANNELS];
    /*!< Channel-specific configuration details */
#ifdef __V2_3_CFG_FMT__
    ADMW1001_ADVANCED_ACCESS_KEY    advancedAccessKey;
#endif
    /*!< Key to enable access to advanced sensor configuration options */
} ADMW1001_CONFIG;

#ifdef __cplusplus
}
#endif

/*!
 * @}
 */

#endif /* __ADMW1001_CONFIG_H__ */