Mbed FW update

inc/admw1001/admw1001_config.h

Committer:
Vkadaba
Date:
2019-06-05
Revision:
5:0728bde67bdb
Child:
6:9d393a9677f4

File content as of revision 5:0728bde67bdb:

/*
Copyright 2018 (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.
 */

/*
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.
*/

/*!
 ******************************************************************************
 * @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 calibration mode options */
typedef enum {
    ADMW1001_NO_CALIBRATION = 0,
    /*!< No full scale ADC calibration is performed after a latch command is sent.
     */
    ADMW1001_DO_CALIBRATION,
    /*!< Full scale ADC Calibration is performed after a latch command is sent.
     */
} ADMW1001_CALIBRATION_MODE;

/*! ADMW1001 power mode options */
typedef enum {
    ADMW1001_POWER_MODE_LOW = 1,
    /*!< Lowest ADC power consumption mode, with lowest conversion rate */
    ADMW1001_POWER_MODE_MID,
    /*!< Medium ADC power consumption mode, with medium conversion rate */
    ADMW1001_POWER_MODE_FULL,
    /*!< Highest ADC power consumption mode, with highest conversion rate */
} ADMW1001_POWER_MODE;

/*! ADMW1001 measurement cycle types */
typedef enum
{
    ADMW1001_CYCLE_TYPE_SWITCH = 0,
    /*!< Switch channels after every conversion */
    ADMW1001_CYCLE_TYPE_FULL   = 1
    /*!< Perform full number of requested conversions on a channel
     *   consecutively before switching to the next channel */
} ADMW1001_CYCLE_TYPE;

#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   = 1
    /*!< 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 1000 cycles */
} ADMW1001_OPEN_SENSOR_DIAGNOSTICS;

/*! 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 current output level options
 *
 *  @note applicable only to ADC analog sensor channels, and
 *        specific sensor types
 */
typedef enum {
    ADMW1001_ADC_EXC_CURRENT_NONE = 0,
    /*!< Excitation current disabled */
    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_750uA,
    /*!< 750uA 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_DEFAULT = 0,
    ADMW1001_ADC_EXC_CURRENT_IOUT_DIODE_MAX,
} 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 (10000 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 analog filter selection options
 *
 *  @note applicable only to ADC analog sensor channels
 */
typedef enum {
    ADMW1001_ADC_FILTER_SINC4 = 1,
    /*!< 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_FIR_20SPS,
    /*!< FIR post filter, producing a 20sps output sample rate */
    ADMW1001_ADC_FILTER_FIR_25SPS,
    /*!< FIR post filter, producing a 25sps output sample rate */
} ADMW1001_ADC_FILTER_TYPE;

/*! ADMW1001 FFT sequence mode options
 *
 *  @note applicable only for FFT measurement modes
 */
typedef enum {
    ADMW1001_FFT_MODE_SINGLE = 0,
    /*!< Performs a single sequence of FFTs on selected channels and stops */
    ADMW1001_FFT_MODE_CONTINUOUS,
    /*!< Performs continuous sequences of FFTs on selected channels */
} ADMW1001_FFT_MODE;

/*! ADMW1001 FFT size options (number of bins)
 *
 *  @note applicable only for FFT measurement modes
 */
typedef enum {
    ADMW1001_FFT_SIZE_256 = 0,
    /*!< 256 bins */
    ADMW1001_FFT_SIZE_512,
    /*!< 512 bins */
    ADMW1001_FFT_SIZE_1024,
    /*!< 1024 bins */
    ADMW1001_FFT_SIZE_2048,
    /*!< 2048 bins */
} ADMW1001_FFT_SIZE;

/*! ADMW1001 FFT window type options
 *
 *  @note applicable only for FFT measurement modes
 */
typedef enum {
    ADMW1001_FFT_WINDOW_NONE = 0,
    /*!< No Window */
    ADMW1001_FFT_WINDOW_HANN,
    /*!< Hann Window */
    ADMW1001_FFT_WINDOW_BLACKMAN_HARRIS,
    /*!< Blackman-Harris Window */
} ADMW1001_FFT_WINDOW;

/*! ADMW1001 FFT output format options
 *
 *  @note applicable only for FFT measurement modes
 */
typedef enum {
    ADMW1001_FFT_OUTPUT_FULL = 0,
    /*!< N/2-Term Amplitude Response */
    ADMW1001_FFT_OUTPUT_FULL_WITH_RAW,
    /**< N/2-Term Amplitude Response Plus N Raw ADC Samples */
    ADMW1001_FFT_OUTPUT_MAX16,
    /*!< Bin-Number and Amplitude of 16 Highest Peaks of Amplitude Response */
} ADMW1001_FFT_OUTPUT;

/*! 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 UART baud rate options
 *
 *  @note applicable only for UART sensors
 */
typedef enum
{
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_115200 = 0,
    /*!< 115200 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_57600,
    /*!< 57600 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_38400,
    /*!< 38400 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_19200,
    /*!< 19200 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_9600,
    /*!< 9600 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_4800,
    /*!< 4800 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_2400,
    /*!< 2400 UART baud rate */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE_1200,
    /*!< 1200 UART baud rate */
} ADMW1001_DIGITAL_SENSOR_COMMS_UART_BAUD_RATE;

/*! ADMW1001 UART line config options
 *
 *  @note applicable only for UART sensors
 */
typedef enum
{
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8N1 = 0,
    /*!< UART line control 8 data bits / no parity / 1 stop bit  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8N2,
    /*!< UART line control 8 data bits / no parity / 2 stop bits  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8N3,
    /*!< UART line control 8 data bits / no parity / 3 stop bits  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8E1,
    /*!< UART line control 8 data bits / even parity / 1 stop bit  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8E2,
    /*!< UART line control 8 data bits / even parity / 2 stop bits  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8E3,
    /*!< UART line control 8 data bits / even parity / 3 stop bits  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8O1,
    /*!< UART line control 8 data bits / odd parity / 1 stop bit  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8O2,
    /*!< UART line control 8 data bits / odd parity / 2 stop bits  */
  ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG_8O3,
    /*!< UART line control 8 data bits / odd parity / 3 stop bits  */
} ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG;

/*! 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_CALIBRATION_MODE calibrationMode;
    /*!< Calibration mode - specifies if adc calibration is performed after a latch command */
    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
     */
    ADMW1001_CYCLE_TYPE        cycleType;
    /*!< Cycle type - specifies how the channel list is traversed with each
     *   conversion during the cycle.
     */
#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)
     */
    float32_t                        externalRef2Value;
    /*!< Resistance/voltage value connected to external reference input #2.
     *   Applicable only if the selected reference type is
     *   ADMW1001_ADC_REFERENCE_RESISTOR_EXTERNAL_2 or
     *   ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_2
     *   (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_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                         fs;
    /*!< Number of input samples to accumulate and average in the filter.
     *   Applicable only when type is ADMW1001_ADC_FILTER_SINC4 */
} 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 */
    bool                              disableBuffer;
    /*!< Option to disable internal ADC reference buffer */
} 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_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_UART_BAUD_RATE      uartBaudRate;
    /*!< Optional parameter to configure specific uart baud rate for uart sensor */
    ADMW1001_DIGITAL_SENSOR_COMMS_UART_LINE_CONFIG    uartLineConfig;
    /*!< Optional parameter to configure specific uart line control for uart 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 UART digital channel configuration details
 *
 *  @note applicable only to UART digital sensor channels
 */
typedef struct {
    ADMW1001_UART_SENSOR_TYPE        sensor;
    /*!< Sensor type selection */
    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 UART sensor types.
     */
} ADMW1001_UART_CHANNEL_CONFIG;

/*! ADMW1001 Measurement Channel configuration details */
typedef struct {
    bool                                 enableChannel;
    /*!< Option to include this channel in normal measurement cycles */
    bool                                 enableFFT;
    /*!< Option to include this channel in FFT 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 */
        ADMW1001_UART_CHANNEL_CONFIG uartChannelConfig;
        /*!< UART channel configuration - applicable only to UART channels */
    };
    /*!< Only one of adcChannelConfig, i2cChannelConfig, spiChannelConfig or
     *   uartChannelConfig is required, depending on the channel designation
     *   (analog, I2C, SPI or UART)
     */
} 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;

/*! ADMW1001 FFT Measurement Mode configuration options */
typedef struct {
    ADMW1001_FFT_MODE               mode;
    /*!< FFT sequence mode */
    ADMW1001_FFT_SIZE               size;
    /*!< FFT size selection */
    ADMW1001_FFT_WINDOW             window;
    /*!< FFT window type selection */
    ADMW1001_FFT_OUTPUT             output;
    /*!< FFT output type selection */
} ADMW1001_FFT_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;
    /*!< Diagnostics configuration details */
    ADMW1001_FFT_CONFIG             fft;
    /*!< 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__ */