Sean Wilson
/
ADISense_ExampleFirmware
ADISense_ExampleFirmware
Revision 0:76fed7dd9235, committed 2018-01-25
- Comitter:
- seanwilson10
- Date:
- Thu Jan 25 16:00:23 2018 +0000
- Commit message:
- initial;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADISense1000_MBED.c Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,114 @@ +/*! + ****************************************************************************** + * @file: config.c + * @brief: + *----------------------------------------------------------------------------- + * +Copyright (c) 2017 Emutex Ltd. / 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. + * + *****************************************************************************/ + +#include "inc/adi_sense_config_types.h" + +ADI_SENSE_CONFIG config = { + .versionId = { .major = 1, .minor = 4 }, + .adisense1000 = { + .power = { + .powerMode = ADI_SENSE_1000_POWER_MODE_FULL, + .supplyVoltage = 3.3, + }, + .measurement = { + .operatingMode = ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS, + .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE, + .cycleInterval = 0, + }, + .channels = { + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = { + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_CJC_0, + .measurementsPerCycle = 1, + .extraSettlingTime = 0.0000, + .measurementUnit = ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS, + .adcChannelConfig = { + .sensor = ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_T_DEF_L1, + .gain = ADI_SENSE_1000_ADC_GAIN_128X, + .current = { + .outputLevel = ADI_SENSE_1000_ADC_EXC_CURRENT_NONE, + .swapOption = ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_NONE, + }, + .filter = { + .type = ADI_SENSE_1000_ADC_FILTER_SINC4, + .fs = 1920, + }, + .reference = { + .type = ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL, + .disableBuffer = false, + }, + .enableVbias = true, + }, + }, + [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = { + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE, + .measurementsPerCycle = 1, + .extraSettlingTime = 0.0000, + .measurementUnit = ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS, + .adcChannelConfig = { + .sensor = ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT100_DEF_L1, + .gain = ADI_SENSE_1000_ADC_GAIN_128X, + .current = { + .outputLevel = ADI_SENSE_1000_ADC_EXC_CURRENT_500uA, + .swapOption = ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_NONE, + }, + .filter = { + .type = ADI_SENSE_1000_ADC_FILTER_SINC4, + .fs = 1920, + }, + .reference = { + .type = ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_1, + .disableBuffer = false, + }, + .enableVbias = false, + }, + }, + }, + }, +}; +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/utils.c Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,389 @@ +#include <stdlib.h> + +#include "utils.h" +#include "inc/adi_sense_log.h" + +void utils_printStatus( + ADI_SENSE_STATUS *pStatus) +{ + ADI_SENSE_LOG_INFO("Status Summary:"); + + if (pStatus->deviceStatus == 0) + { + ADI_SENSE_LOG_INFO("\tNo errors detected"); + } + else + { + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_BUSY) + ADI_SENSE_LOG_INFO("\tCommand running"); + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_DATAREADY) + ADI_SENSE_LOG_INFO("\tData ready"); + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_ERROR) + ADI_SENSE_LOG_INFO("\tActive Errors - RESET REQUIRED"); + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_FIFO_ERROR) + ADI_SENSE_LOG_INFO("\tActive FIFO Errors - ATTENTION REQUIRED"); + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_CONFIG_ERROR) + ADI_SENSE_LOG_INFO("\tActive Configuration Errors - ATTENTION REQUIRED"); + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_LUT_ERROR) + ADI_SENSE_LOG_INFO("\tActive Look-Up Table Errors - ATTENTION REQUIRED"); + + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_ERROR) + { + ADI_SENSE_LOG_INFO("\tActive Errors - ATTENTION REQUIRED"); + ADI_SENSE_LOG_INFO("\t\tLast Error Code: %u (0x%X)", + pStatus->errorCode, pStatus->errorCode); + + if (pStatus->diagnosticsStatus == 0) + { + ADI_SENSE_LOG_INFO("\t\tNo diagnostics faults detected"); + } + else + { + ADI_SENSE_LOG_INFO("\t\tActive diagnostics faults:"); + + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_CHECKSUM_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tInternal Checksum fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_COMMS_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tInternal Communications fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_MONITOR_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tSupply Monitor fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_CAP_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tSupply Regulator Capacitor fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_AINM_UV_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tNegative Analog Input Under-Voltage fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_AINM_OV_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tNegative Analog Input Over-Voltage fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_AINP_UV_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tPositive Analog Input Under-Voltage fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_AINP_OV_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tPositive Analog Input Over-Voltage fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_CONVERSION_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tInternal ADC Conversions fault detected"); + if (pStatus->diagnosticsStatus & ADI_SENSE_DIAGNOSTICS_STATUS_CALIBRATION_ERROR) + ADI_SENSE_LOG_INFO("\t\t\tInternal Device Calibrations fault detected"); + } + } + + if (pStatus->deviceStatus & ADI_SENSE_DEVICE_STATUS_ALERT) + { + ADI_SENSE_LOG_INFO("\tActive Alerts - ATTENTION REQUIRED:"); + ADI_SENSE_LOG_INFO("\t\tLast Alert Code: %u (0x%X)", + pStatus->alertCode, pStatus->alertCode); + + for (unsigned i = 0; i < ADI_SENSE_1000_MAX_CHANNELS; i++) + { + if (pStatus->channelAlerts[i] == 0) + continue; + + ADI_SENSE_LOG_INFO("\t\tChannel #%u:", i); + ADI_SENSE_LOG_INFO("\t\t\tLast Alert Code: %u (0x%X)", + pStatus->channelAlertCodes[i], + pStatus->channelAlertCodes[i]); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_TIMEOUT) + ADI_SENSE_LOG_INFO("\t\t\tTimeout alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_UNDER_RANGE) + ADI_SENSE_LOG_INFO("\t\t\tUnder Range alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_OVER_RANGE) + ADI_SENSE_LOG_INFO("\t\t\tOver Range alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_LOW_LIMIT) + ADI_SENSE_LOG_INFO("\t\t\tLow limit alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_HIGH_LIMIT) + ADI_SENSE_LOG_INFO("\t\t\tHigh Limit alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_SENSOR_OPEN) + ADI_SENSE_LOG_INFO("\t\t\tSensor Fault alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_REF_DETECT) + ADI_SENSE_LOG_INFO("\t\t\tReference Detection alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_CONFIG_ERR) + ADI_SENSE_LOG_INFO("\t\t\tConfiguration Error alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_LUT_ERR) + ADI_SENSE_LOG_INFO("\t\t\tLook-Up Table Error alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_SENSOR_NOT_READY) + ADI_SENSE_LOG_INFO("\t\t\tSensor Not Ready alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_COMP_NOT_READY) + ADI_SENSE_LOG_INFO("\t\t\tCompensation Channel Not Ready alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_UNDER_VOLTAGE) + ADI_SENSE_LOG_INFO("\t\t\tUnder Voltage alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_OVER_VOLTAGE) + ADI_SENSE_LOG_INFO("\t\t\tOver Voltage alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_LUT_UNDER_RANGE) + ADI_SENSE_LOG_INFO("\t\t\tUnder Look-Up Table Range alert detected"); + if (pStatus->channelAlerts[i] & ADI_SENSE_CHANNEL_ALERT_LUT_OVER_RANGE) + ADI_SENSE_LOG_INFO("\t\t\tOver Look-Up Table Range alert detected"); + } + } + } +} + +void utils_printSamples( + ADI_SENSE_DATA_SAMPLE *pSampleBuffer, + uint32_t nNumSamples) +{ + for (uint32_t i = 0; i < nNumSamples; i++) + { + ADI_SENSE_LOG_INFO("Sample # %2d Channel # %2d :: Raw %8d :: Processed %.7f :: flags: %s %s", + i+1, + pSampleBuffer[i].channelId, + pSampleBuffer[i].rawValue, + pSampleBuffer[i].processedValue, + pSampleBuffer[i].status & ADI_SENSE_DEVICE_STATUS_ERROR ? "ERROR" : "", + pSampleBuffer[i].status & ADI_SENSE_DEVICE_STATUS_ALERT ? "ALERT" : ""); + } +} + +static void gpioCallbackFn(ADI_SENSE_GPIO_PIN ePinId, void * pArg) +{ + volatile bool_t *pbFlag = (volatile bool_t *)pArg; + *pbFlag = true; +} + +ADI_SENSE_RESULT utils_registerCallbacks( + ADI_SENSE_DEVICE_HANDLE hDevice, + volatile bool_t *pbDataReady, + volatile bool_t *pbError, + volatile bool_t *pbAlert) +{ + ADI_SENSE_RESULT res; + + res = adi_sense_RegisterGpioCallback(hDevice, ADI_SENSE_GPIO_PIN_DATAREADY, + gpioCallbackFn, (void *)pbDataReady); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to register DATAREADY callback"); + return res; + } + + res = adi_sense_RegisterGpioCallback(hDevice, ADI_SENSE_GPIO_PIN_ERROR, + gpioCallbackFn, (void *)pbError); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to register ERROR callback"); + return res; + } + + res = adi_sense_RegisterGpioCallback(hDevice, ADI_SENSE_GPIO_PIN_ALERT, + gpioCallbackFn, (void *)pbAlert); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to register ALERT callback"); + return res; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT utils_deregisterCallbacks( + ADI_SENSE_DEVICE_HANDLE hDevice) +{ + ADI_SENSE_RESULT res; + + res = adi_sense_RegisterGpioCallback(hDevice, ADI_SENSE_GPIO_PIN_DATAREADY, + NULL, NULL); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to deregister DATAREADY callback"); + return res; + } + + res = adi_sense_RegisterGpioCallback(hDevice, ADI_SENSE_GPIO_PIN_ERROR, + NULL, NULL); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to deregister ERROR callback"); + return res; + } + + res = adi_sense_RegisterGpioCallback(hDevice, ADI_SENSE_GPIO_PIN_ALERT, + NULL, NULL); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_INFO("Failed to deregister ALERT callback"); + return res; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT utils_runMeasurement( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_MEASUREMENT_MODE eMeasurementMode) +{ + ADI_SENSE_RESULT res; + + volatile bool_t bDataReady = false; + volatile bool_t bError = false; + volatile bool_t bAlert = false; + res = utils_registerCallbacks(hDevice, &bDataReady, &bError, &bAlert); + if (res != ADI_SENSE_SUCCESS) + return res; + + /* + * Retrieve the number of samples per cycle, per DATAREADY pulse, etc. for this configuration. + */ + ADI_SENSE_1000_OPERATING_MODE eOperatingMode; + ADI_SENSE_1000_DATAREADY_MODE eDataReadyMode; + uint32_t nSamplesPerDataready; + uint32_t nSamplesPerCycle; + res = adi_sense_1000_GetDataReadyModeInfo(hDevice, + eMeasurementMode, + &eOperatingMode, + &eDataReadyMode, + &nSamplesPerDataready, + &nSamplesPerCycle); + if (res != ADI_SENSE_SUCCESS) + return res; + + /* + * Allocate a buffer to store the samples retrieved on each DATAREADY pulse + * However, if the DATAREADY pulse is per-conversion, allocate a bigger buffer + * to accumulate a full cycle of samples before printing them + */ + ADI_SENSE_DATA_SAMPLE *pSampleBuffer; + if (eDataReadyMode == ADI_SENSE_1000_DATAREADY_PER_CONVERSION) + pSampleBuffer = malloc(sizeof(ADI_SENSE_DATA_SAMPLE) * nSamplesPerCycle); + else + pSampleBuffer = malloc(sizeof(ADI_SENSE_DATA_SAMPLE) * nSamplesPerDataready); + if (pSampleBuffer == NULL) + { + ADI_SENSE_LOG_ERROR("Failed to allocate sample buffer"); + return ADI_SENSE_NO_MEM; + } + + /* + * Kick off the measurement cycle(s) here + */ + res = adi_sense_StartMeasurement(hDevice, eMeasurementMode); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to start measurement"); + return res; + } + + /* + * Loop continuously unless operating mode is single-cycle + */ + do { + ADI_SENSE_STATUS status; + uint32_t nCurrentSamples; + uint32_t nReturned; + nCurrentSamples = 0; + + /* + * Accumulate the samples from a cycle and print them + * NOTE: requires a sufficient idle time between cycles to allow printing to occur + */ + do { + /* + * Wait for the cycle to complete, continuously checking DATAREADY until it is asserted + */ + while (! (bDataReady || bError)) + ; + + if (! bError) + { + /* + * Retrieve the data samples from the measurement cycle, if no error has occurred + */ + bDataReady = false; + res = adi_sense_GetData(hDevice, eMeasurementMode, &pSampleBuffer[nCurrentSamples], nSamplesPerDataready, &nReturned); + nCurrentSamples += nReturned; + if (res != ADI_SENSE_SUCCESS) + { + if (res == ADI_SENSE_INCOMPLETE) + { + /* For this case, let's get the device status and print + * any samples we did get */ + ADI_SENSE_LOG_WARN("Failed to retrieve all requested data samples"); + break; + } + else + { + ADI_SENSE_LOG_WARN("Failed to retrieve data samples from device"); + return res; + } + } + } + } while (!bError && (nCurrentSamples < nSamplesPerCycle)); + + /* + * Display the data samples + */ + utils_printSamples(pSampleBuffer, nCurrentSamples); + + /* + * Check and print device status if errors/alerts have been triggered + */ + if (bError || bAlert) + { + res = adi_sense_GetStatus(hDevice, &status); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to retrieve device status"); + return res; + } + + if (status.deviceStatus & + (ADI_SENSE_DEVICE_STATUS_ERROR | ADI_SENSE_DEVICE_STATUS_ALERT)) + { + utils_printStatus(&status); + + /* Break out of the loop if any errors are raised */ + if (bError) + break; + } + } + } while (eOperatingMode != ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE); + + res = adi_sense_StopMeasurement(hDevice); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to send stop measurement"); + return res; + } + + free(pSampleBuffer); + + res = utils_deregisterCallbacks(hDevice); + if (res != ADI_SENSE_SUCCESS) + return res; + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT utils_printCalTable( + ADI_SENSE_DEVICE_HANDLE hDevice) +{ + ADI_SENSE_RESULT res; + unsigned dataLen, nRows, nColumns, maxLen = 1024; + + float *pCalDataBuffer = malloc(maxLen); + if (pCalDataBuffer == NULL) + { + ADI_SENSE_LOG_ERROR("Failed to allocate calibration data buffer"); + return ADI_SENSE_NO_MEM; + } + + res = adi_sense_1000_ReadCalTable(hDevice, + pCalDataBuffer, maxLen, + &dataLen, &nRows, &nColumns); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to read calibration data"); + free(pCalDataBuffer); + return res; + } + + ADI_SENSE_LOG_INFO("Calibration Table:\r\n"); + ADI_SENSE_LOG_INFO("%6s| %10s | %10s | %10s |", "index", "25", "-40", "85"); + for (unsigned row = 0; row < nRows; row++) + { + ADI_SENSE_LOG_INFO("%6d| %10f | %10f | %10f |", + row, + pCalDataBuffer[(row * nColumns) + 0], + pCalDataBuffer[(row * nColumns) + 1], + pCalDataBuffer[(row * nColumns) + 2]); + } + + free(pCalDataBuffer); + return ADI_SENSE_SUCCESS; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/utils.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,46 @@ +#ifndef __UTILS_H__ +#define __UTILS_H__ + +#include "inc/adi_sense_api.h" +#include "inc/adi_sense_1000/adi_sense_1000_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Utility function to print the status read from the ADI Sense device */ +void utils_printStatus( + ADI_SENSE_STATUS *pStatus); + +/* Utility function to print data samples read from the ADI Sense device */ +void utils_printSamples( + ADI_SENSE_DATA_SAMPLE *pSampleBuffer, + uint32_t numSamples); + +/* Utility function to register callbacks for ADI Sense device notification signals */ +ADI_SENSE_RESULT utils_registerCallbacks( + ADI_SENSE_DEVICE_HANDLE hDevice, + volatile bool_t *pbDataReady, + volatile bool_t *pbError, + volatile bool_t *pbAlert); + +/* Utility function to de-register callbacks for ADI Sense device notification signals */ +ADI_SENSE_RESULT utils_deregisterCallbacks( + ADI_SENSE_DEVICE_HANDLE hDevice); + +/* Utility function to run measurements on ADI Sense device, according to its current + * configuration, and display data samples and device status following each cycle */ +ADI_SENSE_RESULT utils_runMeasurement( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_MEASUREMENT_MODE eMeasurementMode); + +/* Utility function to retrieve and print the factory calibration coefficients table from the ADI Sense device */ +ADI_SENSE_RESULT utils_printCalTable( + ADI_SENSE_DEVICE_HANDLE hDevice); + +#ifdef __cplusplus +} +#endif + +#endif /* __UTILS_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/README.md Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,32 @@ +ADI Sense Host Library {#mainpage} +====================== + +Introduction +------------ +ADI Sense is a new product line created by Analog Device Inc. (ADI) which aims +to make it quicker and easier for its customers to develop hardware and firmware +solutions based on ADI’s Precision Measurement technology, by combining smart +online design tools and software-defined measurement processors which simplify +the development of sophisticated high-precision measurement solutions. + +The goal of the ADI Sense Host Library is to provide a high-level C/C++ +Application Programming Interface to demonstrate correct usage of the ADI Sense +processors and simplify their integration with end-user application stacks. + +Resources +--------- +In the following sections, you will find more detailed information on the +ADI Sense processors, ADI Sense Host Library API documentation, code examples, +and more: + +- [ADI Sense 1000 Overview](doc/adisense1000.md) provides details on the + features of the ADI Sense 1000 processor module. +- [API Reference](@ref ADI_Sense_Api) contains a detailed guide to the functions + and datatypes provided on the ADI Sense Host Library API +- [Examples](doc/examples.md) provides a guide to the various code examples + provided as part of the ADI Sense Host Library +- [Key Topics](doc/key_topics.md) offers more detailed information on a number of key + topics such as processor configuration and dynamic characteristics +- [Porting Guide](doc/porting.md) includes useful information for anyone who wishes + to port the ADI Sense Host Library to a new host processor platform +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/adisense1000.md Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,94 @@ +ADI Sense 1000 Overview +======================= + +[TOC] + +ADI Sense 1000 +-------------- + +# Overview {#overview} +The ADI Sense 1000 is a first-generation ADI Sense measurement processor which +combines high-precision analog sensor inputs, SPI/I2C digital I/O interfaces +and integrated DSP algorithms which transform the raw sensor input data into +measurement values expressed in standard units ready for application use. + +The ADI Sense 1000 processor is designed to run as a slave device, connected +to and controlled by a separate host application processor. + +The ADI Sense Host Application library currently includes support for the +ADI Sense 1000 processor module, used in conjuction with the ST Nucleo F411RE +host application processor running Mbed OS. Support for additional ADI Sense +modules and host application processor platforms will be added in the future. + +# Interfaces {#interfaces} +## Host Communication Interfaces {#interfaces_hostcommunication} +The interfaces in this section enable the connectivity with the host application +processor which is responsible for configuration and control of the ADI Sense +1000 device. Platform-specific host connection parameters may be specified via +the [ADI_SENSE_CONNECTION](@ref ADI_SENSE_CONNECTION) structure on the +[ADI Sense API](@ref ADI_Sense_Api) and low-level connectivity is accessed +via the [ADI Sense Host Portability Layer](@ref ADI_Sense_Host). + +* SPI + + Standard 4-wire SPI interface (SCLK, MOSI, MISO, SS) + + Mode 0 (CPOL=0, CPHA=0) + + SCLK speeds up to 1.6MHz +* Signals + + ERROR + - active-high digital output + - signals an unrecoverable error condition to the host processor + + ALERT + - active-high digital output + - signals a warning/alert condition to the host processor + + DATAREADY + - active-high digital output + - signals a data ready condition to the host processor + + RESET + - active-low digital input + - pulse low for at least 4 microseconds to trigger a hardware reset of the module + +## Sensor Interfaces {#interfaces_sensor} +The following is an overview of the sensors interfaces available on the ADI Sense 1000 +module. For latest information on the sensors currently supported by this library, +please refer to the [ADI Sense 1000 API](@ref ADI_Sense_1000_Api) + +* Analog Sensor Interfaces + + CJC 1-2 + - Intended for connecting 2-wire reference temperature sensors + - Analog sensor types currently supported: + - 2-wire PT100 RTD + - 2-wire PT1000 RTD + + SENSOR 0-3 + - Intended for connecting a wide variety of precision analog sensors + - Analog sensor types currently supported: + - 2/3/4-wire PT100 RTD temperature sensors + - 2/3/4-wire PT1000 RTD temperature sensors + - Type-T/K/J Thermocouple temperature sensors + - 4/6-wire bridge tranducer temperature/pressure sensors + - 10k NTC Thermistor temperature sensors + + I\_MEAS + - Intended for connecting 4-20mA analog current sensors + + V\_MEAS + - Intended for connecting 0-10V analog voltage sensors +* Digital Sensor Interfaces + + SPI + - Intended for connecting support SPI digital sensors + - SPI digital sensor types currently supported: + - Honeywell TruStability HSC pressure sensors + - Analog Devices ADXL362 3-Axis MEMS accelerometer + + I2C + - Intended for connecting support SPI digital sensors + - SPI digital sensor types currently supported: + - Honeywell HumidIcon HIH9000 Series humidity sensors + - Sensirion SHT3x Series humidity sensors + +## Ancillary Interfaces {#interfaces_ancillary} +* External Reference Inputs + + REF 1-2 + - Optional external reference inputs, for use with analog sensors +* Voltage Reference Outputs + + AVDD + - Analog voltage reference output (typically 3.3V) + + VDD + - Digital voltage reference output (typically 3.3V) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/examples.md Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,109 @@ +Examples +======== + +[TOC] + +# Overview {#overview} + +# Getting Started {#getting_started} + +## ST Nucleo F411RE / Mbed OS {#stnucleo_mbed} + +### Hardware Setup + +The following examples assume that the ADI Sense 1000 module is connected to the +ST Nucleo FR11RE as follows: + +ADI Sense 1000 | ST Nucleo FR11RE +--------------- | ------------- +SPI\_SLAVE\_CS | D10 +SPI\_SLAVE\_MOSI | D11 +SPI\_SLAVE\_MISO | D12 +RESET | D6 +ERROR | D3 +ALERT | D4 +DRDY | D5 + +### Software Setup + +### Building an example + +#### Using mbed online tools +An mbed online account is required. For more information, +see (https://developer.mbed.org/account/signup/). + +Once logged into mbed, visit the following URL to locate the ADI Sense Host Library repository: +(https://os.mbed.com/teams/AnalogDevices/code/AdiSense1000) + +Select the "Import into Compiler" option to add this library to your project. + +Navigate to one of the examples (e.g. AdiSense1000/examples/sensors/) and click +to open the source file named 'main.cpp'. Then click on compile at the top of +the page to build the binary image. This will download the binary to your PC. + +#### Using mbed-cli (command line interface) tools +Follow the instructions at (https://github.com/ARMmbed/mbed-cli) to download and +install the mbed-cli. + +In a command-line terminal window, navigate to the directory containing one of +the examples included in the ADI Sense Host Library software package, set up the +mbed-os environment, and build the code: + + cd <path_to_library>/examples/sensors/ + mbed deploy + mbed new . + mbed compile -m nucleo_f411re -t GCC_ARM + +The resulting binary image will be created as: + + <path_to_library>/examples/sensors/BUILD/nucleo_f411re/GCC_ARM/sensors.bin + +### Running an example +Assuming the Nucleo board is plugged in to your PC via a micro-USB cable, copy +the binary image (built in the previous step) to the "NODE_F411RE" USB storage +device. The programming LED on the F411RE should flash for a few seconds while +the program is being loaded, and the device should then automatically reboot +and start running the example. + +Output messages from the example are transmitted on UART6 (pins PA\_11, PA\_12) +by default. This pins may be routed via the micro-USB cable COM/serial +by connecting PA\_11 and PA\_12 to the RX and TX pins on CN3 of the F411RE board. +Alternatively, it is possible to specify a different UART by modifying the +following file and rebuilding the example: + + <path_to_library>/host/src/mbed/adi_sense_log.cpp + +# API Usage Examples {#api_examples} +The following examples are intended to demonstrate the correct usage of the [ADI Sense API](@ref ADI_Sense_Api) in a variety of scenarios and configurations. + +## Sensors {#api_examples_sensors} +The "sensors" example demonstrates configurations that may be used to enable a +selection of analog and digital sensors which may be connected to the ADI Sense +1000 module and used in various modes of operation. Different configurations +may be selected by modifying the value of 'pSelectedConfig' in main.cpp. The +example application code will show how the selected configuration is loaded to +the ADI Sense 1000 device and applied before measurement cycles are started. + +## User-Defined Look-Up Table Data {#api_examples_user_lut_data} +The "user_lut_data" example aims to show how a user may specify sensor +correction data to linearise the raw results from a custom sensor (a +thermocouple and bridge sensor in this case). The data is encapsulated in a +series of individual tables and corresponding descriptors +(see 'sample\_lut\_data.c') which are assembled into a single monolithic Look-Up +Table (LUT) data structure. That LUT data structure is loaded onto the ADI +Sense 1000 module and applied as part of the module configuration before any +measurement cycles are started. + +## Save/Restore Configuration {#api_examples_save_restore} +The "save_restore_config" example demonstrates how configuration settings may be +saved to non-volatile memory on the ADI Sense module. Saved settings are loaded +automatically when the module is subsequently powered on, and may also be +loaded (restored) at any time by the user if required. Note that settings must +always be applied explicitly with @ref adi_sense_ApplyConfigUpdates before they +take effect. + +## Diagnostics {#api_examples_diagnostics} +The "diagnostics" example demonstrates how some of the various diagnostic +functions of the ADI Sense module can be utilised to detect error conditions +such as disconnected or mis-wired sensors. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/key_topics.md Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,437 @@ +Key Topics +========== + +[TOC] + +# Register Interface {#registerinterface} +The ADI Sense module provides a register-style interface for the purpose +of exchanging configuration, status, and data with the host application +processor. + +## Overview {#registerinterface_overview} +The registers can be divided broadly into the following categories: +* Command input register + - This special register is used to issue commands to the module. + - New commands are typically ignored until the running command + has completed (as indicated via the Status registers) +* Configuration input registers + - Configuration registers are used to specify configuration parameters + for use by the module, typically specifying details such as operating + mode, sensor information, limits, and many other options. + - Changes to configuration input registers are typically ignored until a + command is issued to "apply" the configuration on the device. +* Status output registers + - Status information is provided by the module via these read-only registers + - Dedicated output signals (e.g. ERROR and ALERT) may be linked with this + status information + - The host application processor may acknowledge and reset/clear the status + indicators by reading the relevant status registers. The status indicators + will be set again if the underlying condition is subsequently detected again +* Data output registers + - Measurement data samples produced by the module are typically accessed via + a FIFO-style register which may be read repeatedly until all available data + has been consumed. + - Data samples are provided in a pre-determined format according to the + measurement mode, and typically comprise a processed measurement value, + status flags, measurement channel identifier and, optionally, the raw + (unprocessed) data sample retrieved from the sensor input channel. +* Keyhole access registers + - Access to large internal memory regions within the module is typically + provided via an pair of "keyhole" registers, consisting of an address + register and a data register. An address (i.e. an starting offset within + the region) must first be written to the address register, then the + companion data register may be accessed repeatedly to read/write data to + the corresponding region. The address is automatically incremented with + each access to the data register, so that data can be transferred in a + single burst for efficiency. + +# Configuration {#configuration} +The ADI Sense module is a flexible measurement processor which must be +configured via the [register interface](@ref #registerinterface) before it +can be used to acquire data from its external sensor inputs. + +## Overview {#configuration_overview} +A configuration consists of the following elements: +* Global configuration register settings, such as: + - Operating modes + - Power configuration + - Measurement cycle timing + - External reference values +* Channel-specific register settings, such as: + - measurement count + - connected sensor type + - sensor configuration details + - settling time + - filter options + - threshold limits + - calibration adjustments +* Optional user-defined analog sensor linearisation data + - used to compensate for inherent non-linear characteristics of analog sensors + - supplied via a Look-Up Table data structure with a specific format + - allows the user to leverage the data acquisition and processing features + of the ADI Sense module for use with non-standard or unsupported sensors + +## Configuration data structure {#configuration_data} +Although the module can be configured and managed directly via the +[register interface](@ref #registerinterface), the ADI Sense Host Library +provides a level of abstraction above this which allows a more simplified +programming paradigm for the device. + +A single C-language configuration data structure can be used to define all +configuration values for the ADI Sense module. This can be passed to the +relevant ADI Sense Host Library API functions, which will do the work of +translating the configuration details into the appropriate register values +and sending them to the module via its host communication interface. + +The [examples](doc/examples.md) provided with the ADI Sense Host Library +demonstrate this configuration method. Individual configurations are stored +and compiled as .c files, and a configuration may be selected and loaded by +the application code. Note that only the essential configuration fields are +filled, depending on the specific sensor configuration and operating mode +required. + +## Loading and Applying a configuration {#configuration_loading} +Configuration data must first be loaded via the @ref adi_sense_SetConfig API +function - which updates the registers on the module according to the supplied +configuration details - and then applied by calling the @ref +adi_sense_ApplyConfigUpdates function which issues a special command to instruct +the module to apply the new configuration. If user-defined linearisation data +is also required, this must also be loaded via the @ref +adi_sense_1000_SetLutData function _before_ applying the new configuration. + +To avoid loading the configuration details to the module every time it is +powered on, it is possible to save it to non-volatile memory on the module +using @ref adi_sense_SaveConfig and @ref adi_sense_SaveLutData. The saved +configuration is automatically restored by default when the module is +subsequently reset or powered on, and can also be reloaded on demand if required +using the @ref adi_sense_RestoreConfig and @ref adi_sense_RestoreLutData +functions. Note that, in all cases, @ref adi_sense_ApplyConfigUpdates _must_ +be called to instruct the module to apply the configuration before will be used. + +Once a valid configuration has been loaded and applied, the user may issue +commands to the module to initiate measurement cycles, internal calibration, or +diagnostic routines (all of which depend on a valid configuration being applied +in advance). + +## Configuration errors {#configuration_errors} +Attempts to load invalid configuration details will be flagged via the relevant +status registers and signals. After calling @ref adi_sense_ApplyConfigUpdates, +it is advisable to check the status of the module by calling @ref +adi_sense_GetStatus and examining the relevant status information returned from +the module. Subsequent commands issued to the module may not execute correctly +in the presence of unresolved configuration errors. + +# Measurement Cycles {#measurementcycles} +## Overview {#measurementcycles_overview} +Conversions are carried out sequentially across each of the enabled channels in +a predictable pattern which has a defined order and user-specified number of +conversions per channel. This is typically referred to as the _Measurement +Sequence_. + +A _Measurement Cycle_ essentially consists of a single _Measurement Sequence_ +which may be repeated at specified time intervals. + +The configuration parameters required to define the Measurement Cycle and +Sequence are as follows: +* Cycle interval time (specified in microseconds/milliseconds/seconds) +* For each enabled sensor input channel: + - Number of conversions-per-cycle + - Extra settling time (specified in microseconds) + +In addition to the cycle time, the following operating modes dictate when and +how many cycles should be executed: +* **Single-Cycle Mode** + - Executes a single Measurement Cycle and stops +* **Continuous Mode** + - Executes Measurement Cycles continuously until stopped by the host + application processor +* **Multi-Cycle Mode** + - Executes a specified number (burst) of Measurement Cycles and stores the + results in a buffer for retrieval by the host. + - Repeats this indefinitely at specified intervals (multi-cycle burst + interval) until stopped by the host application processor. + +## Executing Measurement Cycles {#measurementcycles_executing} +Once a valid configuration is loaded (see @ref #configuration), +Measurement Cycles are initiated by the host application processor via @ref +adi_sense_StartMeasurement, and may be stopped if necessary via @ref +adi_sense_StopMeasurement. These functions issue the relevant commands to the +ADI Sense module via its dedicate command register. + +Certain auxiliary tasks may also be carried out internally by the module on a +per-cycle basis, such as Calibration and Diagnostics. These are discussed in +in later sections below. + +## Sequence Order {#measurementcycles_sequence} +The sequence is constructed according to which channels are enabled and how many +measurements must be performed per channel. The arrangement is similar to +round-robin scheduling - a measurement is carried out on each enabled channel, in +ascending channel order, and then the loop is repeated until the requested number +of measurements on each channel has been satisfied. + +For example, lets say channels [0, 3, 4, 5] are enabled, with measurementsPerCycle +set as follows: + +channelId | measurementsPerCycle +--------- | -------------------- + CJC_1 | 4 + SENSOR_0 | 2 + I2C_1 | 3 + SPI_0 | 1 + +The length of the sequence would be 10 measurements in total, and the order in +which the channel measurements appear in the sequence would look like this: + +| **CJC_1** | **SENSOR_0** | **I2C_1** | **SPI_0** | **CJC_1** | **SENSOR_0** | **I2C_1** | **CJC_1** | **I2C_1** | **CJC_1** | + +When measurement data samples are retrieved from the ADI Sense by the host +application, this is the order in which those data samples will appear. + +The ADI Sense 1000 provides up to 13 measurement channels, and allows a maximum +measurementsPerCycle of 128, so a single cycle can produce a maximum of 1664 +measurements. In other words, the maximum length of the sequence is 1664. + +## Sequence Timing {#measurementcycles_timing} +The timing of each measurement within the sequence depends on a number of factors: +* **Settling time** + - A settling time is applied when switching between each channel (unless only + a single channel in the sequence), particularly to allow the analog + front-end circuit to stabilise before a conversion is performed. + - Each channel is subject to a minimum settling time (e.g. 500 microseconds) + - Additional settling time can be configured per-channel if required + - As the analog sensor channels are multi-plexed into a single physical input + channel, with different front-end circuit configurations for each, the + settling and conversion of the analog channels must be done one-at-a-time in + series. Their settling time starts only when the channel is reached in the + sequence. + - Digital sensors operate independently, and so are activated in parallel to + other sensors. Consequently, their settling time may start at the start of + a cycle, or immediately after a previous conversion result has been obtained + from the sensor. +* **Conversion time** + - Once the settling time has passed, a conversion is initiated to obtain a raw + measurement value from the sensor input. + - The time required for the conversion may be influenced by factors such as + filter configuration (in the case of analog channels) or specific digital + sensor performance characteristics and configuration options. +* **Processing time** + - Once the raw conversion result is obtained, it is subjected to further + processing to apply correction for non-linear sensors, calibration + adjustments, and conversion into standard measurement units + - The processing time varies depending on the sensor type and correction + algorithms to be applied, but a standard budget of processing time (e.g. + 500 microseconds) is allocated to each channel to produce consistent and + predictable time separation between the measurement results. + +So, to summarise, the distinct phases for each measurement on each channel +typically look like this: + +**settling** > **conversion** > **processing** > **publishing** + +Taking the sequence example in the previous section, let's assume a base +settling time (_Ts_) and processing time (_Tp_) of 500 microseconds for each channel +and the following variable timing parameters _Te_ and _Tc_ (in units of microseconds): + +channelId | extraSettlingTime (_Te_) | conversionTime (_Tc_) | sum (_Ts_ + _Te_ + _Tc_ + _Tp_) | measurementsPerCycle | total +--------- | ------------------------ | --------------------- | ------------------------------- | -------------------- | ----- + CJC_1 | 4000 | 50000 | 55000 | 4 | 220000 + SENSOR_0 | 1000 | 50000 | 52000 | 2 | 104000 + I2C_1 | 20000 | 1000 | 22000 | 3 | 66000 + SPI_0 | 0 | 800 | 1800 | 1 | 1800 + +To clarify: _Te_ above comes directly from the channel configuration. _Tc_, however, +is dictated by the sensor and its configuration. + +The minimum time required for the cycle to complete is, in the above example, +391800 microseconds. + +If the selected operating mode is Continuous or Multi-Cycle mode, the +configuration must also specify the interval between successive cycles +(cycleInterval). If this is less than the actual time required to +complete the cycle, the next cycle will start immediately after the +completion of the previous one; if it is more, there will be a delay +until the next cycle is started. + +## Measurement Results storage and retrieval {#measurementcycles_publishing} +As part of module configuration, a data-ready mode must be selected to decide +how measurements results are made available and retained for consuming by the +host application processor: + +* **Per-Conversion** + - In this mode, each measurement result (a.k.a. data sample) is made available + as soon as it is ready. + - Only a single result is stored, and it is overwritten when the next + measurement result becomes ready. Only the latest result is retained. + - The host application processor must, therefore, consume each single + measurement result (by reading the DATA_FIFO register) as soon as the + result becomes available. +* **Per-Cycle** + - In this mode, the measurement results from a full cycle (10 data samples, + in the example above) are made available only when the measurement cycle is + complete. + - The results are overwritten when the next measurement cycle (if any) + is completed. + - The host application processor must consume the measurement results in a + batch as soon as they become available. +* **Per-Multicycle-Burst** + - In this mode, the measurement results from a burst of measurement cycles + are made available only when thise measurement cycles are completed. + - The results are overwritten when the next burst of measurement cycles + are completed. + - The host application processor must consume the measurement results in a + batch as soon as they become available. + - Note that this data-ready mode is only available when the Multi-Cycle + operating mode is also selected. + +When new measurement results are ready for retrieval, the DRDY output signal +is asserted. The host application may check this signal continuously, or attach +an interrupt notification to this signal, to ensure that measurement results are +retrieved in a timely fashion before they are subsequently overwritten by the +next conversion/cycle. Alternatively, the host application may also read the +STATUS register to check the DRDY status indicator. + +The ADI Sense Host Library API provides the following functions which are +relevant for data retrieval: +* @ref adi_sense_RegisterGpioCallback for recieving DRDY interrupt notifications +* @ref adi_sense_GetGpioState for polling the state of the DRDY signal +* @ref adi_sense_GetStatus for reading the module status registers +* @ref adi_sense_GetData for retrieveing the measurement results from the module + +The @ref adi_sense_1000_GetDataReadyModeInfo API function, specific to the ADI +Sense 1000, is also useful for obtaining information on the number of +measurement results to expect when the DRDY indicator is asserted, based on the +operating and data-ready mode configuration settings currently set in the module +registers. + +# Calibration {#calibration} +The ADI Sense module incorporates a number of calibration measures to ensure +the accuracy of measurement results, described in the following sections. These +mostly pertain to the analog measurement channels, but some provisions are also +included for calibration of digital sensors. + +## Factory calibration {#calibration_factory} +Calibration is performed during factory production for error introduced by +components (e.g. resistors, switches) present on the signal paths of the +module's analog front-end. Calibration offset and gain values are calculated +and stored in non-volatile memory within the module as part of the production +process. These are applied automatically without intervention from the host +application. + +## Internal auto-calibration {#calibration_internal} +The high-accuracy ADC incorporated within the ADI Sense module includes +internal calibration functions to assist in removing offset or gain errors +internal to that ADC. As this is a time-consuming process, it is invoked +only in the following circumstances: +* The host application issues a self-calibration command (@ref + adi_sense_RunCalibration) +* The host application updates the module configuration and the module + determines, based on the configuration changes, that re-calibration is + required. In this case, the calibration is carried out at the point + where the new configuration settings are applied (@ref + adi_sense_ApplyConfigUpdates) + +In all cases, a valid configuration must be set and it used as part of the +calibration process. External sensors and reference circuits must be +connected for calibration to work correctly. + +## User calibration {#calibration_user} +Additional gain and offset correction parameters may be specified per-channel as +part of the module configuration. These are applied as a final step to each +measurement result from the channel during the final stages of processing before +the data sample is made available to the host processor. + +# Diagnostics {#diagnostics} +The ADC within the ADI Sense module includes a range of sophisticated diagnostic +features to automatically detect error conditions such as under-/over-voltage on +analog input signals, supply voltage errors, reference detection errors and more. +These are enabled by default and, if triggered, will result in an ERROR or ALERT +signal being asserted by the module. Diagnostic status can be queried via the +module status registers (@ref adi_sense_GetStatus). + +Additional diagnostic tests may be executed by the module to detect additional +error conditions such as a disconnected or mis-wired sensor. These tests are +typically time-consuming, and so are carried out only if selected by the user: +* Sensor diagnostics may be requested by executing a dedicated diagnostics + command (@ref adi_sense_RunDiagnostics) +* Sensor diagnostics may be optionally executed at the start of each measurement + cycle, at a frequency determined by the user through the configuration + parameters (see @ref ADI_SENSE_1000_DIAGNOSTICS_CONFIG) + +# Sensor Linearisation {#linearisation} +Analog sensors typically produce an output which is not completely linear or +directly proportional with respect to their input. Different sensor types +generally have different linearity characteristics, each requiring different +correction methods or coefficients for accurate translation of the sensor output +back to the corresponding input. Typical methods include use of linearisation +formulae (e.g. polynomial equations with variable coefficients), or tables of +sample input values and their corresponding outputs which can be used with +interpolation to perform the translation. + +The ADI Sense module performs linearisation and calibration correction of the +analog sensor measurements, and incorporates the linearisation functions +complete with coefficients or translation tables for a range of supported sensor +types. On the ADI Sense 1000, for example, measurement results from any +[sensor types](@ref ADI_SENSE_1000_ADC_SENSOR_TYPE) named with the +"_L1" suffix or with a specific sensor model name (e.g. @ref +ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X) will be +automatically linearised using built-in linearisation functions and coefficients +or translation tables. + +It is also possible to have ADI Sense perform linearisation on other sensor +types. A range of [sensor type IDs](@ref ADI_SENSE_1000_ADC_SENSOR_TYPE) named +with an "_L2" suffix are reserved for this purpose. By specifying one of these +sensor types, and by providing the necessary linearisation information for that +sensor type as part of a "look-up table" data structure loaded via the @ref +adi_sense_1000_SetLutData API function, the ADI Sense module can be extended to +work with sensor variants which require a different linearisation what is +already provided through built-in methods. Linearisation data may be provided +in the form of a coefficient list for a polynomial equation, or as a +translation table, depending on what is most appropriate for that sensor. + +Translation tables can be expressed in a number of formats, such as 1- or +2-Dimensional tables, with equally- or non-equally-spaced vectors. 2-D tables +are used where the sensor output is affected by both the sensor input and +another factor such as the operating temperature of the sensor itself. If the +sensor output values can be captured for an equally-spaced set of input values +(i.e. values separated by a constant increment, such as 3,6,9,12,etc.), the +equally-spaced table formats allow for a more compact represenation as only the +ouput values need to be listed individually. + +Multiple coefficient lists can be specified for a given sensor type, along with +an applicable range of input values, as it may be necessary to apply different +equations depending on the input range. For example, RTD sensors feature a +different linearity curve for input ranges above/below 0 degrees Celsius. + +The ADI Sense 1000 allows a flexible look-up table (LUT) data structure up to a +[maximum size](@ref ADI_SENSE_LUT_MAX_SIZE) to be loaded by the user for use +with custom "L2" sensor types. The LUT data structure format, defined as @ref +ADI_SENSE_1000_LUT, allows for a variable set of tables of different formats +to be included as part of the overall data structure. Each table is preceeded +by a descriptor which specifies the format of the following table. A single +top-level header at the start of the LUT specifies how many tables are contained +within. The LUT structure basically looks like this: + + |---------------------| + | top-level header | + |---------------------| + | table #0 descriptor | + | table #0 data | + |---------------------| + | table #1 descriptor | + | table #1 data | + |---------------------| + ~~~ + |---------------------| + | table #N descriptor | + | table #N data | + |---------------------| + +To cater for this flexibility, the data structure definition is inherently +complex. To absorb some of this complexity, a supplementary API function named +@ref adi_sense_1000_AssembleLutData is provided. By providing a list of +pointers to descriptors and data elements for each table to be included in the +LUT structure, along with buffer of allocated memory, this function constructs +the top-level header and appends each table and also fills some fields within +the table descriptors (e.g. length, CRC). Please refer to the "user_lut_data" +application example for an illustration of how this function can be used. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/porting.md Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,22 @@ +Porting Guide +============= +[ADI Sense Host Portability Layer](@ref ADI_Sense_Host) describes a portability +API layer which encapsulates the host platform-specific functions used by the +ADI Sense Host Library to communicate with the ADI Sense module. + +Porting the ADI Sense Host Library to a new hardware platform and/or operating +system (OS) should involve replacing only the portability layer API functions +with a suitable implementation for the target platform. + +A fully-functional communication interface implementation (i.e. @ref +ADI_Sense_Spi) is required, as is @ref ADI_Sense_Time which provides time-delay +functions for the ADI Sense Host Library. However, other elements of the +portability layer, such as @ref ADI_Sense_Gpio and @ref ADI_Sense_Log, may be +substituted with dummy implementations if necessary (though some +[examples](doc/examples.md) may not function correctly as a result). + +Source code for the ST Nucleo / mbed portability layer implementation is located +in the following sub-directory within the ADI Sense Host Library source package: + + <path_to_library>/host/src/mbed/ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_api.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,401 @@ +/*! + ****************************************************************************** + * @file: adi_sense_api.h + * @brief: ADI Sense Host Library Application Programming Interface (API) + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_1000_API_H__ +#define __ADI_SENSE_1000_API_H__ + +#include "inc/adi_sense_types.h" +#include "inc/adi_sense_config_types.h" +#include "inc/adi_sense_platform.h" +#include "adi_sense_1000_config.h" +#include "adi_sense_1000_lut_data.h" + +/*! @ingroup ADI_Sense_Api */ + +/*! @defgroup ADI_Sense_1000_Api ADI Sense 1000 Host Library API + * ADI Sense 1000 device-specific API function prototypes. + * These are supplementary to the common ADI Sense Host Library API. + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * @brief Read one or more device registers at the specified register address. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] nAddress Register map address to read from + * @param[out] pData Pointer to return the register map data + * @param[in] nLength Number of bytes of data to read from the register map + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Provides direct byte-level read access to the device register map. + * The size and format of the register(s) must be known. + * + * @note Reads from special "keyhole" or "FIFO" registers will be handled + * according to documentation for those registers. + */ +ADI_SENSE_RESULT adi_sense_1000_ReadRegister( + ADI_SENSE_DEVICE_HANDLE const hDevice, + uint16_t const nAddress, + void * const pData, + unsigned const nLength); + +/*! + * @brief Write one or more device registers at the specified register address. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] nAddress Register map address to read from + * @param[out] pData Pointer to return the register map data + * @param[in] nLength Number of bytes of data to read from the register map + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Provides direct byte-level write access to the device register map. + * The size and format of the register(s) must be known. + * + * @note Writes to read-only registers will be ignored by the device. + * @note Writes to special "keyhole" registers will be handled according to + * documentation for those registers. + */ +ADI_SENSE_RESULT adi_sense_1000_WriteRegister( + ADI_SENSE_DEVICE_HANDLE const hDevice, + uint16_t const nAddress, + void * const pData, + unsigned const nLength); + +/*! + * @brief Update power configuration settings on the device. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] pPowerConfig Power configuration details + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetPowerConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_POWER_CONFIG *pPowerConfig); + +/*! + * @brief Update measurement configuration settings on the device. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] pMeasurementConfig Measurement configuration details + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetMeasurementConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_MEASUREMENT_CONFIG *pMeasurementConfig); + +/*! + * @brief Update diagnostics configuration settings on the device. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] pDiagnosticsConfig Diagnostics configuration details + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetDiagnosticsConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_DIAGNOSTICS_CONFIG *pDiagnosticsConfig); + +/*! + * @brief Update channel configuration settings for a specific channel. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] eChannelId Selects the channel to be updated + * @param[in] pChannelConfig Channel configuration details + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * Allows individual channel configuration details to be dynamically + * adjusted without rewriting the full device configuration. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetChannelConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_CHANNEL_CONFIG *pChannelConfig); + +/*! + * @brief Update number of measurements-per-cycle for a specific channel. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] eChannelId Selects the channel to be updated + * @param[in] nMeasurementsPerCycle Specifies the number of measurements to be + * obtained from this channel in each + * measurement cycle. Set as 0 to disable the + * channel (omit from measurement cycle). + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * Allows individual channels to be dynamically enabled/disabled, and + * measurements-per-cycle to be adjusted. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetChannelCount( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + uint32_t nMeasurementsPerCycle); + +/*! + * @brief Update the measurement threshold limits for a specified channel. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] eChannelId Selects the channel to be updated + * @param[in] fHighThresholdLimit 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. + * @param[in] fLowThresholdLimit 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. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * Allows individual channel thresholds to be dynamically adjusted. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetChannelThresholdLimits( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + float32_t fHighThresholdLimit, + float32_t fLowThresholdLimit); + +/*! + * @brief Update the extra settling time for a specified channel. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] eChannelId Selects the channel to be updated + * @param[in] nSettlingTime A minimum settling time is applied internally for + * each channel, based on the sensor type. However, + * additional settling time (microseconds) can + * optionally be specified here. Set to 0 if not + * required. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * Allows individual channel settling times to be dynamically adjusted. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetChannelSettlingTime( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + uint32_t nSettlingTime); + +/*! + * @brief Assemble a list of separate Look-Up Tables into a single buffer + * + * @param[out] pLutBuffer Pointer to the Look-Up Table data buffer where + * the assembled Look-Up Table data will be placed + * @param[in] nLutBufferSize Allocated size, in bytes, of the output data buffer + * @param[in] nNumTables Number of tables to add to the Look-Up Table buffer + * @param[in] ppDesc Array of pointers to the table descriptors to be added + * @param[in] ppData Array of pointers to the table data to be added + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details This utiliity function fills the Look-up Table header fields; then + * walks through the array of individual table descriptor and data + * pointers provided, appending (copying) each one to the Look-Up Table + * data buffer. The length and crc16 fields of each table descriptor + * will be calculated and filled by this function, but other fields in + * the descriptor structure must be filled by the caller beforehand. + * + * @note The assembled LUT data buffer filled by this function can then be + * written to the device memory using @adi_sense_1000_SetLutData. + */ +ADI_SENSE_RESULT adi_sense_1000_AssembleLutData( + ADI_SENSE_1000_LUT * pLutBuffer, + unsigned nLutBufferSize, + unsigned const nNumTables, + ADI_SENSE_1000_LUT_DESCRIPTOR * const ppDesc[], + ADI_SENSE_1000_LUT_TABLE_DATA * const ppData[]); + +/*! + * @brief Write Look-Up Table data to the device memory + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pLutData Pointer to the Look-Up Table data structure + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Validates the Look-Up Table data format and loads it into + * device memory via dedicated keyhole registers. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetLutData( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_1000_LUT * const pLutData); + +/*! + * @brief Write Look-Up Table raw data to the device memory + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pLutData Pointer to the Look-Up Table raw data structure + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details This can be used instead of @adi_sense_1000_SetLutData for + * loading LUT data from the alternative raw data format. See + * @adi_sense_1000_SetLutData for more information. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetLutDataRaw( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_1000_LUT_RAW * const pLutData); + +/*! + * @brief Get the number of samples available when DATAREADY status is asserted. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] bMeasurementMode Must be set to the same value used for @ref + * adi_sense_StartMeasurement(). + * @param[out] peOperatingMode Pointer to return the configured operating mode + * @param[out] peDataReadMode Pointer to return the configured data publishing mode + * @param[out] pnSamplesPerDataready Pointer to return the calculated number of samples + * available when DATAREADY is asserted + * @param[out] pnSamplesPerCycle Pointer to return the calculated number of samples + * produced per measurement cycle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Examines the current configuration settings in the device registers + * to calculate the number of samples available whenever the DATAREADY + * signal is asserted, along with other related information. This may + * be used to allocate buffers to store samples and to determine how + * many samples to retrieve whenever the DATAREADY status is asserted. + */ +ADI_SENSE_RESULT adi_sense_1000_GetDataReadyModeInfo( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode, + ADI_SENSE_1000_OPERATING_MODE * const peOperatingMode, + ADI_SENSE_1000_DATAREADY_MODE * const peDataReadyMode, + uint32_t * const pnSamplesPerDataready, + uint32_t * const pnSamplesPerCycle); + +/*! + * @brief Read the contents of the ADI Sense internal factory calibration table + * + * Calibration coefficients/gains/offsets are stored internally in a 2D table of + * 32-bit floating point values. Refer to product documentation for details of + * the rows and columns. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] pfBuffer Pointer to destination buffer for the calibration data + * @param[in] nMaxLen The buffer capacity in bytes (e.g. 672 for 56x3 table) + * @param[out] pnDataLen The number of bytes written to the buffer + * @param[out] pnRows Pointer to return the number of table rows (e.g. 56) + * @param[out] pnColumns Pointer to return the number of table columns (e.g. 3) + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_FAILURE + * - #ADI_SENSE_INVALID_OPERATION Invalid register identifier. + */ +ADI_SENSE_RESULT adi_sense_1000_ReadCalTable( + ADI_SENSE_DEVICE_HANDLE hDevice, + float *pfBuffer, + unsigned nMaxLen, + unsigned *pnDataLen, + unsigned *pnRows, + unsigned *pnColumns); + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_1000_API_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_calibration.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,120 @@ +/*! + ****************************************************************************** + * @file: adi_sense_1000_calibration.h + * @brief: Constants defining a table of calibration constants for the device + *----------------------------------------------------------------------------- + * +Copyright 2017 (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. + * + *****************************************************************************/ + +#ifndef __ADI_SENSE_1000_CALIBRATION_H__ +#define __ADI_SENSE_1000_CALIBRATION_H__ + +#include "adi_sense_types.h" + +typedef enum { + ADI_SENSE_1000_CAL_INTERNAL_REFERENCE_ABSOLUTE_VALUE_CAL_COEFFICIENT, + ADI_SENSE_1000_CAL_EXCITATION_CURRENT_MISMATCH_CAL_COEFFICIENT_1MA, + ADI_SENSE_1000_CAL_EXCITATION_CURRENT_MISMATCH_CAL_COEFFICIENT_750UA, + ADI_SENSE_1000_CAL_EXCITATION_CURRENT_MISMATCH_CAL_COEFFICIENT_500UA, + ADI_SENSE_1000_CAL_EXCITATION_CURRENT_MISMATCH_CAL_COEFFICIENT_250UA, + ADI_SENSE_1000_CAL_EXCITATION_CURRENT_MISMATCH_CAL_COEFFICIENT_100UA, + ADI_SENSE_1000_CAL_EXCITATION_CURRENT_MISMATCH_CAL_COEFFICIENT_50UA, + ADI_SENSE_1000_CAL_REFERENCE_RESISTER1_CAL_COEFFICIENT, + ADI_SENSE_1000_CAL_REFERENCE_RESISTER2_CAL_COEFFICIENT, + + ADI_SENSE_1000_CAL_TC_TYPE_AFE_OFFSET_MEASURE0, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_GAIN_MEASURE0, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_OFFSET_MEASURE1, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_GAIN_MEASURE1, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_OFFSET_MEASURE2, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_GAIN_MEASURE2, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_OFFSET_MEASURE3, + ADI_SENSE_1000_CAL_TC_TYPE_AFE_GAIN_MEASURE3, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_OFFSET_MEASURE0, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_GAIN_MEASURE0, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_OFFSET_MEASURE1, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_GAIN_MEASURE1, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_OFFSET_MEASURE2, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_GAIN_MEASURE2, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_OFFSET_MEASURE3, + ADI_SENSE_1000_CAL_RTD_4_WIRE_TYPE_AFE_GAIN_MEASURE3, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_OFFSET_MEASURE0, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_GAIN_MEASURE0, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_OFFSET_MEASURE1, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_GAIN_MEASURE1, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_OFFSET_MEASURE2, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_GAIN_MEASURE2, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_OFFSET_MEASURE3, + ADI_SENSE_1000_CAL_RTD_3_WIRE_TYPE_AFE_GAIN_MEASURE3, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_OFFSET_MEASURE_CJC0, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_GAIN_MEASURE_CJC0, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_OFFSET_MEASURE_CJC1, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_GAIN_MEASURE_CJC1, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_OFFSET_MEASURE0, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_GAIN_MEASURE0, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_OFFSET_MEASURE1, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_GAIN_MEASURE1, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_OFFSET_MEASURE2, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_GAIN_MEASURE2, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_OFFSET_MEASURE3, + ADI_SENSE_1000_CAL_RTD_2_WIRE_TYPE_AFE_GAIN_MEASURE3, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_OFFSET_MEASURE0, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_GAIN_MEASURE0, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_OFFSET_MEASURE1, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_GAIN_MEASURE1, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_OFFSET_MEASURE2, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_GAIN_MEASURE2, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_OFFSET_MEASURE3, + ADI_SENSE_1000_CAL_10K_THERMISTOR_TYPE_AFE_GAIN_MEASURE3, + ADI_SENSE_1000_CAL_I_CHANNEL_TYPE_AFE_OFFSET, + ADI_SENSE_1000_CAL_I_CHANNEL_TYPE_AFE_GAIN, + ADI_SENSE_1000_CAL_V_CHANNEL_TYPE_AFE_OFFSET, + ADI_SENSE_1000_CAL_V_CHANNEL_TYPE_AFE_GAIN, + + ADI_SENSE_1000_CAL_NUM_TABLES, /**< Counter of the enum */ + ADI_SENSE_1000_CAL_NOT_VALID +} ADI_SENSE_1000_CAL_CONSTANTS; + + +typedef enum { + ADI_SENSE_1000_CAL_TEMP_P25, + ADI_SENSE_1000_CAL_TEMP_M40, + ADI_SENSE_1000_CAL_TEMP_P85, + ADI_SENSE_1000_CAL_NUM_TEMPS, /**< Counter of the enum */ +} ADI_SENSE_1000_CAL_TEMP; + +#endif /* __ADI_SENSE_1000_CALIBRATION_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_config.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,575 @@ +/*! + ****************************************************************************** + * @file: adi_sense_1000_config.h + * @brief: Configuration type definitions for ADI Sense 1000. + *----------------------------------------------------------------------------- + */ + +/* +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_1000_CONFIG_H__ +#define __ADI_SENSE_1000_CONFIG_H__ + +#include "adi_sense_platform.h" +#include "adi_sense_1000_sensor_types.h" + +/*! @addtogroup ADI_Sense_1000_Api ADI Sense 1000 Host Library API + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! Maximum length allowed for a digital sensor command */ +#define ADI_SENSE_1000_SENSOR_COMMAND_MAX_LENGTH 7 + +/*! ADI Sense 1000 operating mode options */ +typedef enum { + ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE = 1, + /*!< Executes a single measurement cycle and stops */ + ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS, + /*!< Continuously executes measurement cycles */ + ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE, + /*!< Executes a burst of measurement cycles, repeated at defined intervals */ +} ADI_SENSE_1000_OPERATING_MODE; + +/*! ADI Sense 1000 data ready mode options */ +typedef enum { + ADI_SENSE_1000_DATAREADY_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_1000_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 + */ + ADI_SENSE_1000_DATAREADY_PER_MULTICYCLE_BURST, + /*!< The DATAREADY signal is asserted after completion of each burst of + * measurement cycles + * - applicable only when @ref ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE + * is also selected + * - data samples only from the lastest completed burst of measurement + * cycles are stored in this mode + */ +} ADI_SENSE_1000_DATAREADY_MODE; + +/*! ADI Sense 1000 data power mode options */ +typedef enum { + ADI_SENSE_1000_POWER_MODE_LOW = 1, + /*!< Lowest ADC power consumption mode, with lowest conversion rate */ + ADI_SENSE_1000_POWER_MODE_MID, + /*!< Medium ADC power consumption mode, with medium conversion rate */ + ADI_SENSE_1000_POWER_MODE_FULL, + /*!< Highest ADC power consumption mode, with highest conversion rate */ +} ADI_SENSE_1000_POWER_MODE; + +/*! ADI Sense 1000 measurement unit options + * + * Optionally select a measurement unit for final conversion results. + * Currently applicable only to specific temperature sensor types. + */ +typedef enum { + ADI_SENSE_1000_MEASUREMENT_UNIT_DEFAULT = 0, + /*!< No measurement unit specified - implied by sensor type selection */ + ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS, + /*!< Celsius temperature unit - applicable to temperature sensors only */ + ADI_SENSE_1000_MEASUREMENT_UNIT_FAHRENHEIT, + /*!< Fahrenheit temperature unit - applicable to temperature sensors only */ +} ADI_SENSE_1000_MEASUREMENT_UNIT; + +/*! ADI Sense 1000 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 { + ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_DISABLED = 0, + /*!< No Open-Sensor Detection is performed */ + ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_PER_CYCLE, + /*!< No Open-Sensor Detection is performed prior to each cycle */ + ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_PER_100_CYCLES, + /*!< No Open-Sensor Detection is performed at intervals of 100 cycles */ + ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_PER_1000_CYCLES, + /*!< No Open-Sensor Detection is performed at intervals of 1000 cycles */ +} ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS; + +/*! ADI Sense 1000 analog input signal amplification gain options + * + * @note applicable only to ADC analog sensor channels + */ +typedef enum { + ADI_SENSE_1000_ADC_GAIN_1X = 0, + /*!< no amplification gain */ + ADI_SENSE_1000_ADC_GAIN_2X, + /*!< x2 amplification gain */ + ADI_SENSE_1000_ADC_GAIN_4X, + /*!< x4 amplification gain */ + ADI_SENSE_1000_ADC_GAIN_8X, + /*!< x8 amplification gain */ + ADI_SENSE_1000_ADC_GAIN_16X, + /*!< x16 amplification gain */ + ADI_SENSE_1000_ADC_GAIN_32X, + /*!< x32 amplification gain */ + ADI_SENSE_1000_ADC_GAIN_64X, + /*!< x64 amplification gain */ + ADI_SENSE_1000_ADC_GAIN_128X, + /*!< x128 amplification gain */ +} ADI_SENSE_1000_ADC_GAIN; + +/*! ADI Sense 1000 analog sensor excitation current output level options + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef enum { + ADI_SENSE_1000_ADC_EXC_CURRENT_NONE = 0, + /*!< Excitation current disabled */ + ADI_SENSE_1000_ADC_EXC_CURRENT_50uA, + /*!< 50uA excitation current enabled */ + ADI_SENSE_1000_ADC_EXC_CURRENT_100uA, + /*!< 100uA excitation current */ + ADI_SENSE_1000_ADC_EXC_CURRENT_250uA, + /*!< 250uA excitation current enabled */ + ADI_SENSE_1000_ADC_EXC_CURRENT_500uA, + /*!< 500uA excitation current enabled */ + ADI_SENSE_1000_ADC_EXC_CURRENT_750uA, + /*!< 750uA excitation current enabled */ + ADI_SENSE_1000_ADC_EXC_CURRENT_1000uA, + /*!< 1mA excitation current enabled */ +} ADI_SENSE_1000_ADC_EXC_CURRENT; + +/*! ADI Sense 1000 analog sensor excitation current swap options + * + * @note applicable only to ADC analog sensor types where 2 excitation current + * sources may be enabled (e.g. 3-wire RTD sensors) + */ +typedef enum { + ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_DYNAMIC = 0, + /*!< 2 measurements are performed, one with excitation currents output on + * default output pins, then another with the current outputs swapped, + * and these measurements are averaged to provide a single result. + */ + ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_STATIC, + /*!< Excitation current output pin assignments are swapped from defaults */ + ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_NONE, + /*!< Excitation current output on default pins (IOUT0->AIN0, IOUT1->AIN3) */ +} ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP; + +/*! ADI Sense 1000 analog reference selection options + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef enum { + ADI_SENSE_1000_ADC_REFERENCE_NONE = 0, + /*!< No reference is selected */ + + ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_1, + /*!< Internal reference resistor #1 (4320 ohms) is selected */ + ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_2, + /*!< Internal reference resistor #2 (10000 ohms) is selected */ + ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL, + /*!< Internal ADC voltage reference (2.5V) is selected */ + ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_AVDD, + /*!< Analag Supply Voltage AVDD reference (typically 3.3V) is selected */ + + ADI_SENSE_1000_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_1000_MEASUREMENT_CONFIG) */ + ADI_SENSE_1000_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_1000_MEASUREMENT_CONFIG) */ + ADI_SENSE_1000_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_1000_MEASUREMENT_CONFIG) */ + ADI_SENSE_1000_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_1000_MEASUREMENT_CONFIG) */ + ADI_SENSE_1000_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 ADI_SENSE_1000_ADC_SENSOR_TYPE) */ +} ADI_SENSE_1000_ADC_REFERENCE_TYPE; + +/*! ADI Sense 1000 analog filter selection options + * + * @note applicable only to ADC analog sensor channels + */ +typedef enum { + ADI_SENSE_1000_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_1000_ADC_FILTER_CONFIG) + * The fs value affects the output sample rate and settling times + * of the ADC */ + ADI_SENSE_1000_ADC_FILTER_FIR_20SPS, + /*!< FIR post filter, producing a 20sps output sample rate */ + ADI_SENSE_1000_ADC_FILTER_FIR_25SPS, + /*!< FIR post filter, producing a 25sps output sample rate */ +} ADI_SENSE_1000_ADC_FILTER_TYPE; + +/*! ADI Sense 1000 Power Configuration options */ +typedef struct { + ADI_SENSE_1000_POWER_MODE powerMode; + /*!< Power mode selection */ + float32_t supplyVoltage; + /*!< AVDD analog supply voltage (e.g. 3.3V)*/ +} ADI_SENSE_1000_POWER_CONFIG; + +/*! ADI Sense 1000 Multi-Cycle Configuration options + * + * @note required only when ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE is selected + * as the operatingMode (@ref ADI_SENSE_1000_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_1000_MULTICYCLE_CONFIG; + +/*! ADI Sense 1000 Measurement Configuration options */ +typedef struct { + ADI_SENSE_1000_OPERATING_MODE operatingMode; + /*!< Operating mode - specifies how measurement cycles are scheduled */ + ADI_SENSE_1000_DATAREADY_MODE dataReadyMode; + /*!< Data read mode - specifies how output samples are stored for reading */ + ADI_SENSE_1000_MULTICYCLE_CONFIG multiCycleConfig; + /*!< Multi-Cycle configuration - specifies how bursts of measurement cycles + * are scheduled. Applicable only when operatingMode is + * ADI_SENSE_1000_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_1000_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_1000_ADC_REFERENCE_RESISTOR_EXTERNAL_1 or + * ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_EXTERNAL_1 + * (see @ref ADI_SENSE_1000_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_1000_ADC_REFERENCE_RESISTOR_EXTERNAL_2 or + * ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_EXTERNAL_2 + * (see @ref ADI_SENSE_1000_ADC_REFERENCE_TYPE) + */ +} ADI_SENSE_1000_MEASUREMENT_CONFIG; + +/*! ADI Sense 1000 ADC Excitation Current output configuration + * + * @note applicable only to ADC analog sensor channels, and + * specific sensor types + */ +typedef struct { + ADI_SENSE_1000_ADC_EXC_CURRENT outputLevel; + /*!< Excitation current output level */ + ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP swapOption; + /*!< Excitation current output source options */ +} ADI_SENSE_1000_ADC_EXC_CURRENT_CONFIG; + +/*! ADI Sense 1000 ADC Filter configuration + * + * @note applicable only to ADC analog sensor channels + */ +typedef struct { + ADI_SENSE_1000_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_1000_ADC_FILTER_SINC4 */ +} ADI_SENSE_1000_ADC_FILTER_CONFIG; + +/*! ADI Sense 1000 ADC Referemce configuration + * + * @note applicable only to ADC analog sensor channels + */ +typedef struct { + ADI_SENSE_1000_ADC_REFERENCE_TYPE type; + /*!< Filter type selection */ + bool_t disableBuffer; + /*!< Option to disable internal ADC reference buffer */ +} ADI_SENSE_1000_ADC_REFERENCE_CONFIG; + +/*! ADI Sense 1000 ADC analog channel configuration details + * + * @note applicable only to ADC analog sensor channels + */ +typedef struct { + ADI_SENSE_1000_ADC_SENSOR_TYPE sensor; + /*!< Sensor type selection */ + ADI_SENSE_1000_ADC_GAIN gain; + /*!< ADC Gain selection */ + ADI_SENSE_1000_ADC_EXC_CURRENT_CONFIG current; + /*!< ADC Excitation Current configuration */ + ADI_SENSE_1000_ADC_FILTER_CONFIG filter; + /*!< ADC Filter configuration */ + ADI_SENSE_1000_ADC_REFERENCE_CONFIG reference; + /*!< ADC Reference configuration */ + bool_t enableVbias; + /*!< Option to enable internal ADC voltage bias */ +} ADI_SENSE_1000_ADC_CHANNEL_CONFIG; + +/*! ADI Sense 1000 digital sensor data encoding + * + * @note applicable only to SPI and I2C digital sensor channels + */ +typedef enum +{ + ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_NONE, + /**< None/Invalid - data format is ignored if coding is set to this value */ + ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_UNIPOLAR, + /**< Unipolar - unsigned integer values */ + ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_TWOS_COMPLEMENT, + /**< Twos-complement - signed integer values */ + ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_OFFSET_BINARY, + /**< Offset Binary - used to represent signed values with unsigned integers, + * with the mid-range value representing 0 */ +} ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING; + +/*! ADI Sense 1000 digital sensor data format configuration + * + * @note applicable only to SPI and I2C digital sensor channels + */ +typedef struct { + ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING coding; + /**< Data Encoding of Sensor Result */ + bool_t littleEndian; + /**< Set as true if data format is little-endian, false otherwise */ + bool_t 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 */ +} ADI_SENSE_1000_DIGITAL_SENSOR_DATA_FORMAT; + +/*! ADI Sense 1000 digital sensor command + * + * @note applicable only to SPI and I2C digital sensor channels + */ +typedef struct { + uint8_t command[ADI_SENSE_1000_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 */ +} ADI_SENSE_1000_DIGITAL_SENSOR_COMMAND; + +/*! ADI Sense 1000 I2C digital channel configuration details + * + * @note applicable only to I2C digital sensor channels + */ +typedef struct { + ADI_SENSE_1000_I2C_SENSOR_TYPE sensor; + /*!< Sensor type selection */ + uint32_t deviceAddress; + /*!< I2C device address (7-bit) */ + ADI_SENSE_1000_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. + */ + ADI_SENSE_1000_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. + */ + ADI_SENSE_1000_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 + */ +} ADI_SENSE_1000_I2C_CHANNEL_CONFIG; + +/*! ADI Sense 1000 SPI digital channel configuration details + * + * @note applicable only to SPI digital sensor channels + */ +typedef struct { + ADI_SENSE_1000_SPI_SENSOR_TYPE sensor; + /*!< Sensor type selection */ + ADI_SENSE_1000_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. + */ + ADI_SENSE_1000_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. + */ + ADI_SENSE_1000_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 + */ +} ADI_SENSE_1000_SPI_CHANNEL_CONFIG; + +/*! ADI Sense 1000 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_1000_CHANNEL_ID compensationChannel; + /*!< Optional compensation channel. Set to ADI_SENSE_1000_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_1000_MEASUREMENT_UNIT measurementUnit; + /*!< Optional measurement unit selection for conversion results. Applicable + * only for certain sensor types. Set to + * ADI_SENSE_1000_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. + */ + 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_1000_ADC_CHANNEL_CONFIG adcChannelConfig; + /*!< ADC channel configuration - applicable only to ADC channels */ + ADI_SENSE_1000_I2C_CHANNEL_CONFIG i2cChannelConfig; + /*!< I2C channel configuration - applicable only to I2C channels */ + ADI_SENSE_1000_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_1000_CHANNEL_CONFIG; + +/*! ADI Sense 1000 Diagnostics configuration details */ +typedef struct { + bool_t 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_t disableMeasurementDiag; + /*!< Option to disable additional checks per measurement channel: + * - High/low threshold limit violation + */ + ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS osdFrequency; + /*!< Option to enable Open-Circuit Detection at a selected cycle interval */ +} ADI_SENSE_1000_DIAGNOSTICS_CONFIG; + +/*! ADI Sense 1000 Device configuration details */ +typedef struct { + ADI_SENSE_1000_POWER_CONFIG power; + /*!< Power configuration details */ + ADI_SENSE_1000_MEASUREMENT_CONFIG measurement; + /*!< Measurement configuration details */ + ADI_SENSE_1000_DIAGNOSTICS_CONFIG diagnostics; + /*!< Diagnostics configuration details */ + ADI_SENSE_1000_CHANNEL_CONFIG channels[ADI_SENSE_1000_MAX_CHANNELS]; + /*!< Channel-specific configuration details */ +} ADI_SENSE_1000_CONFIG; + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_1000_CONFIG_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_lut_data.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,369 @@ +/*! + ****************************************************************************** + * @file: adi_sense_lut_data_types.h + * @brief: Look-Up Table data-type definitions for ADI Sense API. + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_1000_LUT_DATA_H__ +#define __ADI_SENSE_1000_LUT_DATA_H__ + +#include "adi_sense_types.h" +#include "adi_sense_1000_sensor_types.h" + +/*! @addtogroup ADI_Sense_1000_Api ADI Sense 1000 Host Library API + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! LUT data validation signature */ +#define ADI_SENSE_LUT_SIGNATURE 0x4C555473 + +/*! LUT data CRC-16-CCITT seed value */ +#define ADI_SENSE_LUT_CRC_SEED 0x4153 + +/*! LUT maximum allowed size */ +#define ADI_SENSE_LUT_MAX_SIZE 12288U + +/*! Linearisation look-up table / co-efficient list geometry */ +typedef enum { + ADI_SENSE_1000_LUT_GEOMETRY_RESERVED = 0x00, + /**< reserved - for internal use only */ + ADI_SENSE_1000_LUT_GEOMETRY_COEFFS = 0x01, + /**< 1-dimensional equation coefficient list */ + ADI_SENSE_1000_LUT_GEOMETRY_NES_1D = 0x02, + /**< 1-dimensional not-equally-spaced look-up table */ + ADI_SENSE_1000_LUT_GEOMETRY_NES_2D = 0x03, + /**< 2-dimensional not-equally-spaced look-up table */ + ADI_SENSE_1000_LUT_GEOMETRY_ES_1D = 0x04, + /**< 1-dimensional equally-spaced look-up table */ + ADI_SENSE_1000_LUT_GEOMETRY_ES_2D = 0x05, + /**< 2-dimensional equally-spaced look-up table */ +} ADI_SENSE_1000_LUT_GEOMETRY; + +/*! Linearisation equation type */ +typedef enum { + ADI_SENSE_1000_LUT_EQUATION_POLYN, + /**< Polynomial equation, typically used for Thermocouple and RTD + * linearisation */ + ADI_SENSE_1000_LUT_EQUATION_POLYNEXP, + /**< Polynomial + exponential equation, typically used for Thermocouple + * inverse linearisation */ + ADI_SENSE_1000_LUT_EQUATION_QUADRATIC, + /**< Quadratic linearisation equation, typically used for RTD + * linearisation */ + ADI_SENSE_1000_LUT_EQUATION_STEINHART, + /**< Steinhart-Hart equation, typically used for Thermistor + * linearisation */ + ADI_SENSE_1000_LUT_EQUATION_LOGARITHMIC, + /**< Beta-based logarithmic equation, typically used for Thermistor + * linearisation */ + ADI_SENSE_1000_LUT_EQUATION_EXPONENTIAL, + /**< Exponential equation */ + ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN, + /**< Bi-variate polynomial equation, typically used for bridge pressure + * sensor linearisation + * @note 2nd-degree is the maximum currently supported + */ + ADI_SENSE_1000_LUT_EQUATION_COUNT, + /**< Enum count value - for internal use only */ + ADI_SENSE_1000_LUT_EQUATION_LUT, + /**< Hard-coded Look-Up Table - for internal use only */ +} ADI_SENSE_1000_LUT_EQUATION; + +typedef enum { + ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD, + /**< Thermocouple forward (mV to Celsius) linearisation + * Use this value by default for non-thermocouple sensors */ + ADI_SENSE_1000_LUT_TC_DIRECTION_BACKWARD, + /**< Thermocouple inverse (Celsius to mV) linearisation */ + ADI_SENSE_1000_LUT_TC_DIRECTION_COUNT, + /**< Enum count value - for internal use only */ +} ADI_SENSE_1000_LUT_TC_DIRECTION; + +/*! Linearisation data vector format */ +typedef enum { + ADI_SENSE_1000_LUT_DATA_TYPE_RESERVED = 0, + /**< Reserved - for internal use only */ + ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32 = 1, + /**< Single-precision 32-bit floating-point */ + ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT64 = 2, + /**< Double-precision 64-bit floating-point */ +} ADI_SENSE_1000_LUT_DATA_TYPE; + +/*! Struct for a list of coefficients to be used in an equation */ +typedef struct __attribute__((packed, aligned(4))){ + uint32_t nCoeffs; + /**< number of coefficients */ + float32_t rangeMin; + /**< look-up table range - minimum */ + float32_t rangeMax; + /**< look-up table range - maximum */ + float64_t coeffs[]; + /**< C99 flexible array: sorted by ascending exponent in polynomials */ +} ADI_SENSE_1000_LUT_COEFF_LIST; + +/*! Struct for a 1-dimensional equally-spaced look-up table */ +typedef struct __attribute__((packed, aligned(4))){ + uint32_t nElements; + /**< number of elements. */ + float32_t initInputValue; + /**< initial input value, corresponding to first table element */ + float32_t inputValueIncrement; + /**< interval between successive input values */ + float32_t lut[]; + /**< C99 flexible array */ +} ADI_SENSE_1000_LUT_1D_ES; + +/*! Struct for a 1-dimensional not-equally-spaced look-up table */ +typedef struct __attribute__((packed, aligned(4))){ + uint32_t nElements; + /**< number of elements of each array. */ + float32_t lut[]; + /**< C99 flexible array, first X's array then Y's array*/ +} ADI_SENSE_1000_LUT_1D_NES; + +/*! Struct for a 2-dimensional equally-spaced look-up table */ +typedef struct __attribute__((packed, aligned(4))){ + uint16_t nElementsX; + /**< number of elements for input X. */ + uint16_t nElementsY; + /**< number of elements for input Y. */ + float32_t initInputValueX; + /**< initial X input value */ + float32_t inputValueIncrementX; + /**< interval between successive X input values */ + float32_t initInputValueY; + /**< initial Y input value */ + float32_t inputValueIncrementY; + /**< interval between successive Y input values */ + float32_t lut[]; + /**< C99 flexible array, Z matrix[y][x] */ +} ADI_SENSE_1000_LUT_2D_ES; + +/*! Struct for a 2-dimensional not-equally-spaced look-up table */ +typedef struct __attribute__((packed, aligned(4))){ + uint16_t nElementsX; + /**< number of elements in array X. */ + uint16_t nElementsY; + /**< number of elements in array Y. */ + float32_t lut[]; + /**< C99 flexible array, Order: X's array, Y's array, Z matrix[y][x] */ +} ADI_SENSE_1000_LUT_2D_NES; + +/*! Struct for a 2-dimensional list of coefficients to be used in a + * bi-variate polynomial equation */ +typedef struct __attribute__((packed, aligned(4))){ + uint32_t maxDegree; + /**< number of coefficients */ + float32_t rangeMinX; + /**< look-up table range - minimum X input value */ + float32_t rangeMaxX; + /**< look-up table range - maximum X input value */ + float32_t rangeMinY; + /**< look-up table range - minimum Y input value */ + float32_t rangeMaxY; + /**< look-up table range - maximum Y input value */ + float64_t coeffs[]; + /**< C99 flexible array: sorted by ascending X degree then sorted by + * ascending Y exponent */ +} ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST; + +/*! Macro to calculate the number of elements in + * a @ref ADI_SENSE_1000_LUT_COEFF_LIST table */ +#define ADI_SENSE_1000_LUT_COEFF_LIST_NELEMENTS(_t) \ + ((_t).nCoeffs) + +/*! Macro to calculate the number of elements in + * a @ref ADI_SENSE_1000_LUT_1D_ES table */ +#define ADI_SENSE_1000_LUT_1D_ES_NELEMENTS(_t) \ + ((_t).nElements) + +/*! Macro to calculate the number of elements in + * a @ref ADI_SENSE_1000_LUT_1D_NES table */ +#define ADI_SENSE_1000_LUT_1D_NES_NELEMENTS(_t) \ + ((_t).nElements * 2) + +/*! Macro to calculate the number of elements in + * a @ref ADI_SENSE_1000_LUT_2D_ES table */ +#define ADI_SENSE_1000_LUT_2D_ES_NELEMENTS(_t) \ + ((_t).nElementsX * (_t).nElementsX) + +/*! Macro to calculate the number of elements in + * a @ref ADI_SENSE_1000_LUT_2D_NES table */ +#define ADI_SENSE_1000_LUT_2D_NES_NELEMENTS(_t) \ + ((_t).nElementsX + (_t).nElementsY + ((_t).nElementsX * (_t).nElementsY)) + +/*! Macro to calculate the number of elements in + * a @ref ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST table */ +#define ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_NELEMENTS(_t) \ + (((_t).maxDegree + 1) * ((_t).maxDegree + 2) / 2) + +/*! Macro to calculate the storage size in bytes of + * a @ref ADI_SENSE_1000_LUT_COEFF_LIST table */ +#define ADI_SENSE_1000_LUT_COEFF_LIST_SIZE(_t) \ + (sizeof(_t) + (sizeof(float64_t) * ADI_SENSE_1000_LUT_COEFF_LIST_NELEMENTS(_t))) + +/*! Macro to calculate the storage size in bytes of + * a @ref ADI_SENSE_1000_LUT_1D_ES table */ +#define ADI_SENSE_1000_LUT_1D_ES_SIZE(_t) \ + (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_1D_ES_NELEMENTS(_t))) + +/*! Macro to calculate the storage size in bytes of + * a @ref ADI_SENSE_1000_LUT_1D_NES table */ +#define ADI_SENSE_1000_LUT_1D_NES_SIZE(_t) \ + (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_1D_NES_NELEMENTS(_t))) + +/*! Macro to calculate the storage size in bytes of + * a @ref ADI_SENSE_1000_LUT_2D_ES table */ +#define ADI_SENSE_1000_LUT_2D_ES_SIZE(_t) \ + (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_2D_ES_NELEMENTS(_t))) + +/*! Macro to calculate the storage size in bytes of + * a @ref ADI_SENSE_1000_LUT_2D_NES table */ +#define ADI_SENSE_1000_LUT_2D_NES_SIZE(_t) \ + (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_2D_NES_NELEMENTS(_t))) + +/*! Macro to calculate the storage size in bytes of + * a @ref ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST table */ +#define ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_SIZE(_t) \ + (sizeof(_t) + (sizeof(float64_t) * ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_NELEMENTS(_t))) + +/*! Look-Up Table descriptor */ +typedef union __attribute__((packed, aligned(4))) { + struct { + ADI_SENSE_1000_LUT_GEOMETRY geometry : 6; + /**< Table geometry */ + ADI_SENSE_1000_LUT_EQUATION equation : 6; + /**< Equation type */ + ADI_SENSE_1000_LUT_TC_DIRECTION dir : 4; + /**< Thermocouple linearisation direction */ + ADI_SENSE_1000_ADC_SENSOR_TYPE sensor : 12; + /**< Sensor Type ID */ + ADI_SENSE_1000_LUT_DATA_TYPE dataType : 4; + /**< Table vector data type */ + uint16_t length; + /**< Length in bytes of table data section + * (excluding this header) */ + uint16_t crc16; + /**< CRC-16-CCITT of the data */ + }; + uint64_t value64; +} ADI_SENSE_1000_LUT_DESCRIPTOR; + +/*! Look-Up Table geometry-specific data structures */ +typedef union { + ADI_SENSE_1000_LUT_COEFF_LIST coeffList; + /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_COEFFS geometry + * except where equation is ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN */ + ADI_SENSE_1000_LUT_1D_ES lut1dEs; + /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_ES_1D geometry */ + ADI_SENSE_1000_LUT_1D_NES lut1dNes; + /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_NES_1D geometry */ + ADI_SENSE_1000_LUT_2D_ES lut2dEs; + /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_ES_2D geometry */ + ADI_SENSE_1000_LUT_2D_NES lut2dNes; + /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_NES_2D geometry */ + ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST coeffList2d; + /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_COEFFS geometry + * and ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN equation */ +} ADI_SENSE_1000_LUT_TABLE_DATA; + +/*! Look-Up Table structure */ +typedef struct __attribute__((packed, aligned(4))) { + ADI_SENSE_1000_LUT_DESCRIPTOR descriptor; + /**< Look-Up Table descriptor */ + ADI_SENSE_1000_LUT_TABLE_DATA data; + /**< Look-Up Table data */ +} ADI_SENSE_1000_LUT_TABLE; + +/*! LUT data format versions */ +typedef struct __attribute__((packed, aligned(4))) { + uint8_t major; /*!< Major version number */ + uint8_t minor; /*!< Minor version number */ +} ADI_SENSE_1000_LUT_VERSION; + +/*! LUT data header structure */ +typedef struct __attribute__((packed, aligned(4))) { + uint32_t signature; + /**< Hard-coded signature value (@ref ADI_SENSE_LUT_SIGNATURE) */ + ADI_SENSE_1000_LUT_VERSION version; + /**< LUT data format version (@ref ADI_SENSE_LUT_VERSION) */ + uint16_t numTables; + /**< Total number of tables */ + uint32_t totalLength; + /**< Total length (in bytes) of all table descriptors and data + * (excluding this header) + * This, plus the header length, must not exceed ADI_SENSE_LUT_MAX_SIZE + */ +} ADI_SENSE_1000_LUT_HEADER; + +/*! LUT data top-level structure */ +typedef struct __attribute__((packed, aligned(4))) { + ADI_SENSE_1000_LUT_HEADER header; + /*!< LUT data top-level header structure */ + ADI_SENSE_1000_LUT_TABLE tables[]; + /*!< Variable-length array of one-or-more look-up table structures */ +} ADI_SENSE_1000_LUT; + +/*! Alternative top-level structure for raw LUT data representation + * + * @note This is intended to be used for encapsulating the storage of static + * LUT data declarations in C files. The rawTableData can be cast + * to the ADI_SENSE_LUT type for further parsing/processing. + */ +typedef struct __attribute__((packed, aligned(4))) { + ADI_SENSE_1000_LUT_HEADER header; + /*!< LUT data top-level header structure */ + uint8_t rawTableData[]; + /*!< Variable-length byte array of look-up tables in raw binary format */ +} ADI_SENSE_1000_LUT_RAW; + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_1000_LUT_DATA_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_sensor_types.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,701 @@ +/*! + ****************************************************************************** + * @file: adi_sense_1000_sensor_types.h + * @brief: Sensor type definitions for ADI Sense 1000. + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_1000_SENSOR_TYPES_H__ +#define __ADI_SENSE_1000_SENSOR_TYPES_H__ + +/*! @addtogroup ADI_Sense_1000_Api ADI Sense 1000 Host Library API + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! ADI Sense 1000 measurement channel identifiers */ +typedef enum { + ADI_SENSE_1000_CHANNEL_ID_NONE = -1, + /*!< Used to indicate when no channel is selected (e.g. compensation channel) */ + + ADI_SENSE_1000_CHANNEL_ID_CJC_0 = 0, + /*!< Cold-Juction Compensation channel #0 */ + ADI_SENSE_1000_CHANNEL_ID_CJC_1, + /*!< Cold-Juction Compensation channel #1 */ + ADI_SENSE_1000_CHANNEL_ID_SENSOR_0, + /*!< Analog Sensor channel #0 */ + ADI_SENSE_1000_CHANNEL_ID_SENSOR_1, + /*!< Analog Sensor channel #1 */ + ADI_SENSE_1000_CHANNEL_ID_SENSOR_2, + /*!< Analog Sensor channel #2 */ + ADI_SENSE_1000_CHANNEL_ID_SENSOR_3, + /*!< Analog Sensor channel #3 */ + ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0, + /*!< Analog 0-10V Voltage Sensor channel #0 */ + ADI_SENSE_1000_CHANNEL_ID_CURRENT_0, + /*!< Analog 4-20mA Current Sensor channel #0 */ + ADI_SENSE_1000_CHANNEL_ID_I2C_0, + /*!< Digital I2C Sensor channel #0 */ + ADI_SENSE_1000_CHANNEL_ID_I2C_1, + /*!< Digital I2C Sensor channel #1 */ + ADI_SENSE_1000_CHANNEL_ID_SPI_0, + /*!< Digital SPI Sensor channel #0 */ + ADI_SENSE_1000_CHANNEL_ID_SPI_1, + /*!< Digital SPI Sensor channel #1 */ + ADI_SENSE_1000_CHANNEL_ID_SPI_2, + /*!< Digital SPI Sensor channel #2 */ + + ADI_SENSE_1000_MAX_CHANNELS, + /*!< Maximum number of measurement channels on the ADI Sense 1000 */ +} ADI_SENSE_1000_CHANNEL_ID; + +/*! ADI Sense 1000 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 The sensor type name may include a classification suffix: + * - _DEF_L1: pre-defined sensor using built-in linearisation data + * - _DEF_L2: pre-defined sensor using user-supplied linearisation data + * Where the suffix is absent, assume the _DEF_L1 classification above. + */ +typedef enum { + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_T_DEF_L1 = 0, + /*!< Standard T-type Thermocouple temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_J_DEF_L1 = 1, + /*!< Standard J-type Thermocouple temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_K_DEF_L1 = 2, + /*!< Standard K-type Thermocouple temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_1_DEF_L2 = 12, + /*!< Standard thermocouple temperature sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_2_DEF_L2 = 13, + /*!< Standard thermocouple temperature sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_3_DEF_L2 = 14, + /*!< Standard thermocouple temperature sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_4_DEF_L2 = 15, + /*!< Standard thermocouple temperature sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_T_ADV_L1 = 16, + /*!< T-type thermocouple temperature sensor with default linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_K_ADV_L1 = 17, + /*!< T-type thermocouple temperature sensor with default linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_J_ADV_L1 = 18, + /*!< T-type thermocouple temperature sensor with default linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_1_ADV_L2 = 28, + /*!< Thermocouple temperature sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_2_ADV_L2 = 29, + /*!< Thermocouple temperature sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_3_ADV_L2 = 30, + /*!< Thermocouple temperature sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_4_ADV_L2 = 31, + /*!< Thermocouple temperature sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT100_DEF_L1 = 32, + /*!< Standard 2-wire PT100 RTD temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT1000_DEF_L1 = 33, + /*!< Standard 2-wire PT1000 RTD temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_1_DEF_L2 = 44, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_2_DEF_L2 = 45, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_3_DEF_L2 = 46, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_4_DEF_L2 = 47, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT100_ADV_L1 = 48, + /*!< Standard 2-wire PT100 RTD temperature sensor with default + * linearisation and advanced configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT1000_ADV_L1 = 49, + /*!< Standard 2-wire PT1000 RTD temperature sensor with default + * linearisation and advanced configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_1_ADV_L2 = 60, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_2_ADV_L2 = 61, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_3_ADV_L2 = 62, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_4_ADV_L2 = 63, + /*!< 2-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Cold-Juction Compensation and Analog Sensor channels + * only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT100_DEF_L1 = 64, + /*!< Standard 3-wire PT100 RTD temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT1000_DEF_L1 = 65, + /*!< Standard 3-wire PT1000 RTD temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_1_DEF_L2 = 76, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_2_DEF_L2 = 77, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_3_DEF_L2 = 78, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_4_DEF_L2 = 79, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT100_ADV_L1 = 80, + /*!< Standard 3-wire PT100 RTD temperature sensor with default + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT1000_ADV_L1 = 81, + /*!< Standard 3-wire PT1000 RTD temperature sensor with default + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_1_ADV_L2 = 92, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_2_ADV_L2 = 93, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_3_ADV_L2 = 94, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_4_ADV_L2 = 95, + /*!< 3-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT100_DEF_L1 = 96, + /*!< Standard 4-wire PT100 RTD temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT1000_DEF_L1 = 97, + /*!< Standard 4-wire PT1000 RTD temperature sensor with default + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_1_DEF_L2 = 108, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_2_DEF_L2 = 109, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_3_DEF_L2 = 110, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_4_DEF_L2 = 111, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT100_ADV_L1 = 112, + /*!< Standard 4-wire PT100 RTD temperature sensor with default + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT1000_ADV_L1 = 113, + /*!< Standard 4-wire PT1000 RTD temperature sensor with default + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_1_ADV_L2 = 124, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_2_ADV_L2 = 125, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_3_ADV_L2 = 126, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_4_ADV_L2 = 127, + /*!< 4-wire RTD temperature sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_A_10K_DEF_L1 = 128, + /*!< Standard 10kOhm NTC Thermistor temperature sensor with Steinhart–Hart + * linearisation equation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_B_10K_DEF_L1 = 129, + /*!< Standard 10kOhm NTC Thermistor temperature sensor with Beta + * linearisation equation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_1_DEF_L2 = 140, + /*!< Thermistor sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_2_DEF_L2 = 141, + /*!< Thermistor sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_3_DEF_L2 = 142, + /*!< Thermistor sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_4_DEF_L2 = 143, + /*!< Thermistor sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_A_10K_ADV_L1 = 144, + /*!< 10kOhm NTC Thermistor temperature sensor with Steinhart–Hart + * linearisation equation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_B_10K_ADV_L1 = 145, + /*!< 10kOhm NTC Thermistor temperature sensor with Beta + * linearisation equation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_1_ADV_L2 = 156, + /*!< Thermistor sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_2_ADV_L2 = 157, + /*!< Thermistor sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_3_ADV_L2 = 158, + /*!< Thermistor sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_4_ADV_L2 = 159, + /*!< Thermistor sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2 = 160, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2 = 161, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_3_DEF_L2 = 162, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_4_DEF_L2 = 163, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_ADV_L2 = 176, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_ADV_L2 = 177, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_3_ADV_L2 = 178, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_4_ADV_L2 = 179, + /*!< Standard 4-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_1_DEF_L2 = 192, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_2_DEF_L2 = 193, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_3_DEF_L2 = 194, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_4_DEF_L2 = 195, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_1_ADV_L2 = 208, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_2_ADV_L2 = 209, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_3_ADV_L2 = 210, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_4_ADV_L2 = 211, + /*!< Standard 6-wire Bridge Transducer sensor with user-defined + * linearisation and advanced configuration options + * + * @note For use with Analog Sensor channels only + * @note Bridge Excition Voltage must be selected as reference + */ + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE = 256, + /*!< Generic voltage sensor with no linearisation applied + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY = 272, + /*!< Honeywell Pressure voltage sensor (HSCMRNN1.6BAAA3) with default + * linearisation and default configuration options + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X = 273, + /*!< Amphenol Pressure voltage sensor (NPA-300B-015A) with default + * linearisation and default configuration options + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_3_DEF = 274, + /*!< Generic pressure voltage sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog 0-10V Voltage Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_CURRENT = 384, + /*!< Generic current sensor with no linearisation applied + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2 = 385, + /*!< Honeywell Pressure current sensor (PX2CN2XX100PACH) with default + * linearisation and default configuration options + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_2_DEF = 386, + /*!< Generic pressure current sensor with user-defined + * linearisation and default configuration options + * + * @note For use with Analog 4-20mA Current Sensor channels only + */ +} ADI_SENSE_1000_ADC_SENSOR_TYPE; + +/*! ADI Sense 1000 I2C digital sensor type options + * + * Select the sensor type that is connected to an I2C digital measurement + * channel. + * + * @note These are pre-defined sensors using built-in linearisation data + */ +typedef enum { + ADI_SENSE_1000_I2C_SENSOR_HUMIDITY_HONEYWELL_HUMIDICON = 2112, + /*!< Honeywell HiH9000-series humidity sensor with default linearisation + * and default configuration options + * + * @note For use with I2C Digital Sensor channels only + */ + ADI_SENSE_1000_I2C_SENSOR_HUMIDITY_SENSIRION_SHT3X = 2113, + /*!< Sensirion SHT35-DIS-B humidity sensor with default linearisation + * and default configuration options + * + * @note For use with I2C Digital Sensor channels only + */ +} ADI_SENSE_1000_I2C_SENSOR_TYPE; + +/*! ADI Sense 1000 SPI digital sensor type options + * + * Select the sensor type that is connected to an SPI digital measurement + * channel. + * + * @note These are pre-defined sensors using built-in linearisation data + */ +typedef enum { + ADI_SENSE_1000_SPI_SENSOR_PRESSURE_HONEYWELL_TRUSTABILITY = 3072, + /*!< Honeywell HSCDRNN1.6BASA3 pressure sensor with default linearisation + * and default configuration options + * + * @note For use with SPI Digital Sensor channels only + */ + ADI_SENSE_1000_SPI_SENSOR_ACCELEROMETER_ADI_ADXL362 = 3200, + /*!< Analog Devices ADxL362 3-axis accelerometer sensor with default + * linearisation and default configuration options(*) + * + * @note (*) Custom configuration command can be optionally specified + * + * @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_1000_SPI_SENSOR_TYPE; + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_1000_SENSOR_TYPES_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_api.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,587 @@ +/*! + ****************************************************************************** + * @file: adi_sense_api.h + * @brief: ADI Sense Host Library Application Programming Interface (API) + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_API_H__ +#define __ADI_SENSE_API_H__ + +#include "inc/adi_sense_types.h" +#include "inc/adi_sense_config_types.h" +#include "inc/adi_sense_platform.h" +#include "inc/adi_sense_gpio.h" +#include "inc/adi_sense_spi.h" +#include "inc/adi_sense_log.h" +#include "inc/adi_sense_time.h" + +/*! @defgroup ADI_Sense_Api ADI Sense Host Library API + * Host library API common to the ADI Sense product line. + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! The maximum number of channels supported by this API + * @note Specific ADI Sense products may implement a lower number of channels */ +#define ADI_SENSE_MAX_CHANNELS 16 + +/*! A handle used in all API functions to identify the ADI Sense device. */ +typedef void* ADI_SENSE_DEVICE_HANDLE; + +/*! Supported connection types for communication with the ADI Sense device. */ +typedef enum { + ADI_SENSE_CONNECTION_TYPE_SPI = 1, + /*!< Serial Peripheral Interface (SPI) connection type */ +} ADI_SENSE_CONNECTION_TYPE; + +/*! Connection details for communication with a ADI Sense device instance. */ +typedef struct { + ADI_SENSE_CONNECTION_TYPE type; + /*!< Connection type selection */ + ADI_SENSE_PLATFORM_SPI_CONFIG spi; + /*!< SPI connection parameters, required if SPI connection type is used */ + ADI_SENSE_PLATFORM_GPIO_CONFIG gpio; + /*!< GPIO connection parameters, for device reset and status I/O signals */ +} ADI_SENSE_CONNECTION; + +/*! Bit masks (flags) for the different device status indicators. */ +typedef enum { + ADI_SENSE_DEVICE_STATUS_BUSY = (1 << 0), + /*!< Indicates that a command is currently running on the device */ + ADI_SENSE_DEVICE_STATUS_DATAREADY = (1 << 1), + /*!< Indicates the availability of measurement data for retrieval */ + ADI_SENSE_DEVICE_STATUS_ERROR = (1 << 2), + /*!< Indicates that an error condition has been detected by the device */ + ADI_SENSE_DEVICE_STATUS_ALERT = (1 << 3), + /*!< Indicates that an alert condition has been detected by the device */ + ADI_SENSE_DEVICE_STATUS_FIFO_ERROR = (1 << 4), + /*!< Indicates that a FIFO error condition has been detected by the device */ + ADI_SENSE_DEVICE_STATUS_CONFIG_ERROR = (1 << 5), + /*!< Indicates that a configuration error condition has been detected by the device */ + ADI_SENSE_DEVICE_STATUS_LUT_ERROR = (1 << 6), + /*!< Indicates that a look-up table error condition has been detected by the device */ +} ADI_SENSE_DEVICE_STATUS_FLAGS; + +/*! Bit masks (flags) for the different diagnostics status indicators. */ +typedef enum { + ADI_SENSE_DIAGNOSTICS_STATUS_CHECKSUM_ERROR = (1 << 0), + /*!< Indicates Error on Internal Checksum Calculations */ + ADI_SENSE_DIAGNOSTICS_STATUS_COMMS_ERROR = (1 << 1), + /*!< Indicates Error on Internal Device Communications */ + ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_MONITOR_ERROR = (1 << 2), + /*!< Indicates Low Voltage on Internal Supply Voltages */ + ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_CAP_ERROR = (1 << 3), + /*!< Indicates Fault on Internal Supply Regulator Capacitor */ + ADI_SENSE_DIAGNOSTICS_STATUS_AINM_UV_ERROR = (1 << 4), + /*!< Indicates Under-Voltage Error on Negative Analog Input */ + ADI_SENSE_DIAGNOSTICS_STATUS_AINM_OV_ERROR = (1 << 5), + /*!< Indicates Over-Voltage Error on Negative Analog Input */ + ADI_SENSE_DIAGNOSTICS_STATUS_AINP_UV_ERROR = (1 << 6), + /*!< Indicates Under-Voltage Error on Positive Analog Input */ + ADI_SENSE_DIAGNOSTICS_STATUS_AINP_OV_ERROR = (1 << 7), + /*!< Indicates Over-Voltage Error on Positive Analog Input */ + ADI_SENSE_DIAGNOSTICS_STATUS_CONVERSION_ERROR = (1 << 8), + /*!< Indicates Error During Internal ADC Conversions */ + ADI_SENSE_DIAGNOSTICS_STATUS_CALIBRATION_ERROR = (1 << 9), + /*!< Indicates Error During Internal Device Calibrations */ +} ADI_SENSE_DIAGNOSTICS_STATUS_FLAGS; + +/*! Bit masks (flags) for the different channel alert indicators. */ +typedef enum { + ADI_SENSE_CHANNEL_ALERT_TIMEOUT = (1 << 0), + /*!< Indicates timeout condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_UNDER_RANGE = (1 << 1), + /*!< Indicates raw sample under valid input range, possibly clamped */ + ADI_SENSE_CHANNEL_ALERT_OVER_RANGE = (1 << 2), + /*!< Indicates raw sample over valid input range, possibly clamped */ + ADI_SENSE_CHANNEL_ALERT_LOW_LIMIT = (1 << 3), + /*!< Indicates measurement result was below configured minimum threshold */ + ADI_SENSE_CHANNEL_ALERT_HIGH_LIMIT = (1 << 4), + /*!< Indicates measurement result was above configured maximum threshold */ + ADI_SENSE_CHANNEL_ALERT_SENSOR_OPEN = (1 << 5), + /*!< Indicates open circuit or mis-wire condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_REF_DETECT = (1 << 6), + /*!< Indicates reference-detect error condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_CONFIG_ERR = (1 << 7), + /*!< Indicates configuration error condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_LUT_ERR = (1 << 8), + /*!< Indicates look-up table error condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_SENSOR_NOT_READY = (1 << 9), + /*!< Indicates digital sensor not-ready error condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_COMP_NOT_READY = (1 << 10), + /*!< Indicates compensation channel not-ready error condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_UNDER_VOLTAGE = (1 << 11), + /*!< Indicates under-voltage condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_OVER_VOLTAGE = (1 << 12), + /*!< Indicates over-voltage condition detected on the channel */ + ADI_SENSE_CHANNEL_ALERT_LUT_UNDER_RANGE = (1 << 13), + /*!< Indicates raw sample was under the available LUT/equation range */ + ADI_SENSE_CHANNEL_ALERT_LUT_OVER_RANGE = (1 << 14), + /*!< Indicates raw sample was over the available LUT/equation range */ +} ADI_SENSE_CHANNEL_ALERT_FLAGS; + +/*! Status details retreived from the ADI Sense device. */ +typedef struct { + ADI_SENSE_DEVICE_STATUS_FLAGS deviceStatus; + /*!< General summary status information from the device */ + ADI_SENSE_DIAGNOSTICS_STATUS_FLAGS diagnosticsStatus; + /*!< Diagnostic error status information from the device */ + ADI_SENSE_CHANNEL_ALERT_FLAGS channelAlerts[ADI_SENSE_MAX_CHANNELS]; + /*!< Per-channel alert status information from the device */ + uint32_t errorCode; + /*!< Code identifying the last error signalled by the device */ + uint32_t alertCode; + /*!< Code identifying the last alert signalled by the device */ + uint32_t channelAlertCodes[ADI_SENSE_MAX_CHANNELS]; + /*!< Per-channel code identifying the last alert signalled for each channel */ +} ADI_SENSE_STATUS; + +/*! Data sample details retreived from the ADI Sense device. */ +typedef struct { + ADI_SENSE_DEVICE_STATUS_FLAGS status; + /*!< Device summary status snapshot when the sample was recorded */ + uint32_t channelId; + /*!< The measurement channel from which this sample was obtained */ + uint32_t rawValue; + /*!< The raw (unprocessed) value obtained directly from the measurement + * channel, if available + */ + float32_t processedValue; + /*!< The processed value obtained from the measurement channel, as a final + * measurement value, following calibration and linearisation correction, + * and conversion into an appropriate unit of measurement. + */ +} ADI_SENSE_DATA_SAMPLE; + +/*! Measurement mode options for the ADI Sense device. + * @ref adi_sense_StartMeasurement + */ +typedef enum { + ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK = 1, + /*!< In this mode, a special health-check measurement cycle is executed, + * carrying out a single conversion per channel with measurement + * diagnostics enabled, intended for use as a system health check. */ + ADI_SENSE_MEASUREMENT_MODE_NORMAL, + /*!< In this mode, normal measurement cycle(s) are executed and data samples + * are returned with raw measurement values included. */ + ADI_SENSE_MEASUREMENT_MODE_OMIT_RAW, + /*!< In this mode, normal measurement cycle(s) are executed and data samples + * are returned with raw measurement values omitted for efficiency. */ +} ADI_SENSE_MEASUREMENT_MODE; + + +/****************************************************************************** + * ADI Sense High-Level API function prototypes + *****************************************************************************/ + +/*! + * @brief Open ADI Sense device handle and set up communication interface. + * + * @param[in] nDeviceIndex Zero-based index number identifying this device + * instance. Note that this will be used to + * retrieve a specific device configuration for + * this device (see @ref adi_sense_SetConfig + * and @ref ADI_SENSE_CONFIG) + * @param[in] pConnectionInfo Host-specific connection details (e.g. SPI, GPIO) + * @param[out] phDevice Pointer to return an ADI Sense device handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_NO_MEM Failed to allocate memory resources. + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid device index specified + * + * @details Configure and initialise the Log interface and the SPI/GPIO + * communication interface to the ADISense module. + */ +ADI_SENSE_RESULT adi_sense_Open( + unsigned const nDeviceIndex, + ADI_SENSE_CONNECTION * const pConnectionInfo, + ADI_SENSE_DEVICE_HANDLE * const phDevice); + +/*! + * @brief Close ADI Sense device context and free resources. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + */ +ADI_SENSE_RESULT adi_sense_Close( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Get the current state of the specified GPIO input signal. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] ePin GPIO pin to query + * @param[out] pbError Pointer to return the state of the status signal GPIO pin + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified. + * + * @details Sets *pbAsserted to true if the status signal is asserted, or false + * otherwise. + */ +ADI_SENSE_RESULT adi_sense_GetGpioState( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_GPIO_PIN const ePinId, + bool_t * const pbAsserted); + +/*! + * @brief Register an application-defined callback function for GPIO interrupts + * + * @param[in] hDevice ADI Sense context handle (@ref adi_sense_Open) + * @param[in] ePin GPIO pin on which to enable/disable interrupts + * @param[in] callbackFunction Function to be called when an interrupt occurs. + * Specify NULL here to disable interrupts. + * @param[in] pCallbackParam Optional opaque parameter passed to the callback + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified. + */ +ADI_SENSE_RESULT adi_sense_RegisterGpioCallback( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_GPIO_PIN const ePinId, + ADI_SENSE_GPIO_CALLBACK const callbackFunction, + void * const pCallbackParam); + +/*! + * @brief Reset the ADI Sense device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Trigger a hardware-reset of the ADI Sense device. + * + * @note The device may require several seconds before it is ready for use + * again. @ref adi_sense_GetDeviceReadyState may be used to check if + * the device is ready. + */ +ADI_SENSE_RESULT adi_sense_Reset( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Check if the device is ready, following power-up or a reset. + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pbReady Pointer to return true if the device is ready, or false + * otherwise + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details This function attempts to read a fixed-value device register via + * the communication interface. + */ +ADI_SENSE_RESULT adi_sense_GetDeviceReadyState( + ADI_SENSE_DEVICE_HANDLE const hDevice, + bool_t * const pbReady); + +/*! + * @brief Obtain the product ID from the device. + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pProductId Pointer to return the product ID value + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Reads the product ID registers on the device and returns the value. + */ +ADI_SENSE_RESULT adi_sense_GetProductID( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_PRODUCT_ID * const pProductId); + +/*! + * @brief Write full configuration settings to the device registers. + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pConfig Pointer to the configuration data structure + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_SetConfig( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_CONFIG * const pConfig); + +/*! + * @brief Apply the configuration settings currently stored in device registers + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to reload and apply configuration + * from the device configuration registers. Changes to configuration + * registers are ignored by the device until this function is called. + * + * @note No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_ApplyConfigUpdates( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Store the configuration settings to persistent memory on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to save the current contents of its + * device configuration registers to non-volatile memory. + * + * @note No other command must be running when this is called. + * @note Do not power down the device while this command is running. + */ +ADI_SENSE_RESULT adi_sense_SaveConfig( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Restore configuration settings from persistent memory on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to restore the contents of its + * device configuration registers from non-volatile memory. + * + * @note No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RestoreConfig( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Store the LUT data to persistent memory on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to save the current contents of its + * LUT data buffer, set using @ref adi_sense_SetLutData(), to + * non-volatile memory. + * + * @note No other command must be running when this is called. + * @note Do not power down the device while this command is running. + */ +ADI_SENSE_RESULT adi_sense_SaveLutData( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Restore LUT data from persistent memory on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to restore the contents of its + * LUT data, previously stored with @ref adi_sense_SaveLutData, from + * non-volatile memory. + * + * @note No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RestoreLutData( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Start the measurement cycles on the device. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] bMeasurementMode Allows a choice of special modes for the + * measurement. See @ref ADI_SENSE_MEASUREMENT_MODE + * for further information. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to start executing measurement cycles + * according to the current applied configuration settings. The + * DATAREADY status signal will be asserted whenever new measurement + * data is published, according to selected settings. + * Measurement cycles may be stopped by calling @ref + * adi_sense_StopMeasurement. + * + * @note No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_StartMeasurement( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode); + +/*! + * @brief Stop the measurement cycles on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to stop executing measurement cycles. + * The command may be delayed until the current conversion, if any, has + * been completed and published. + * + * @note To be used only if a measurement command is currently running. + */ +ADI_SENSE_RESULT adi_sense_StopMeasurement( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Run built-in diagnostic checks on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to execute its built-in diagnostic + * tests, on any enabled measurement channels, according to the current + * applied configuration settings. Device status registers will be + * updated to indicate if any errors were detected by the diagnostics. + * + * @note No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RunDiagnostics( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Run built-in calibration on the device. + * + * @param[in] hDevice ADI Sense device context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Instructs the ADI Sense device to execute its self-calibration + * routines, on any enabled measurement channels, according to the + * current applied configuration settings. Device status registers + * will be updated to indicate if any errors were detected. + * + * @note No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RunCalibration( + ADI_SENSE_DEVICE_HANDLE const hDevice); + +/*! + * @brief Read the current status from the device registers. + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pStatus Pointer to return the status summary obtained from the + * device. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Reads the status registers and extracts the relevant information + * to return to the caller. + * + * @note This may be called at any time, assuming the device is ready. + */ +ADI_SENSE_RESULT adi_sense_GetStatus( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_STATUS * const pStatus); + +/*! + * @brief Read measurement data samples from the device registers. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] bMeasurementMode Must be set to the same value used for @ref + * adi_sense_StartMeasurement(). + * @param[out] pSamples Pointer to return a set of requested data samples. + * @param[in] nRequested Number of requested data samples. + * @param[out] pnReturned Number of valid data samples successfully retrieved. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Reads the status registers and extracts the relevant information + * to return to the caller. + * + * @note This is intended to be called only when the DATAREADY status signal + * is asserted. + */ +ADI_SENSE_RESULT adi_sense_GetData( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode, + ADI_SENSE_DATA_SAMPLE * const pSamples, + uint32_t const nRequested, + uint32_t * const pnReturned); + +/*! + * @brief Check if a command is currently running on the device. + * + * @param[in] hDevice ADI Sense device context handle + * @param[out] pbCommandRunning Pointer to return the command running status + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Reads the device status register to check if a command is running. + */ +ADI_SENSE_RESULT adi_sense_GetCommandRunningState( + ADI_SENSE_DEVICE_HANDLE hDevice, + bool_t *pbCommandRunning); + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_API_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_config_types.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,103 @@ +/*! + ****************************************************************************** + * @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" +#include "adi_sense_1000/adi_sense_1000_config.h" + +/*! @addtogroup ADI_Sense_Api ADI Sense Host Library API + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! A list of supported product identifiers */ +typedef enum { + ADI_SENSE_PRODUCT_ID_1000 = 0x0020, + /*!< ADI Sense 1000 */ +} ADI_SENSE_PRODUCT_ID; + +/*! ADI Sense Configuration schema version */ +typedef struct { + uint8_t major; /*!< Major version number */ + uint8_t minor; /*!< Minor version number */ +} ADI_SENSE_CONFIG_VERSION_ID; + +/*! ADI Sense UUID string length */ +#define ADI_SENSE_UUID_LEN 36 + +/*! ADI Sense global configuration details */ +typedef struct { + const char configUuid[ADI_SENSE_UUID_LEN]; + /*!< Optional unique identifier for this configuration */ + ADI_SENSE_CONFIG_VERSION_ID versionId; + /*!< Identifies the schema version for this configuration */ + ADI_SENSE_PRODUCT_ID productId; + /*!< Identify the product type for which this configuration is valid */ + union + { + ADI_SENSE_1000_CONFIG adisense1000; + /*!< ADI Sense 1000 product configuration parameters. Used if productId + * selected is ADI_SENSE_PRODUCT_ID_1000 */ + }; + /*!< Product-specific configuration parameters, selected based on productId. + * @note Other product variants may be added here in the future */ +} ADI_SENSE_CONFIG; + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_CONFIG_TYPES_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_gpio.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,177 @@ +/*! + ****************************************************************************** + * @file: adi_sense_gpio.h + * @brief: ADI Sense OS-dependent wrapper layer for GPIO interface + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_GPIO_H__ +#define __ADI_SENSE_GPIO_H__ + +#include "inc/adi_sense_types.h" +#include "inc/adi_sense_platform.h" + +/*! @ingroup ADI_Sense_Host */ + +/*! @addtogroup ADI_Sense_Gpio ADI Sense Host GPIO interface functions + * @{ + */ + +/*! GPIO pin identifiers */ +typedef enum +{ + ADI_SENSE_GPIO_PIN_RESET = 0, /*!< RESET GPIO output signal */ + ADI_SENSE_GPIO_PIN_ERROR, /*!< ERROR GPIO input signal */ + ADI_SENSE_GPIO_PIN_ALERT, /*!< ALERT GPIO input signal */ + ADI_SENSE_GPIO_PIN_DATAREADY, /*!< DATAREADY GPIO input signal */ +} ADI_SENSE_GPIO_PIN; + +/*! + * GPIO callback function signature + * + * @param[in] ePinId The GPIO pin which triggered the interrupt notification + * @param[in] pArg Optional opaque parameter to be passed to the callback + */ +typedef void (*ADI_SENSE_GPIO_CALLBACK)( + ADI_SENSE_GPIO_PIN ePinId, + void * pArg); + +/*! A handle used in all API functions to identify the GPIO interface context */ +typedef void* ADI_SENSE_GPIO_HANDLE; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*! + * @brief Open the SPI interface and allocate resources + * + * @param[in] pConfig Pointer to platform-specific GPIO interface details + * @param[out] phDevice Pointer to return a GPIO interface context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_NO_MEM Failed to allocate memory for interface context + */ +ADI_SENSE_RESULT adi_sense_GpioOpen( + ADI_SENSE_PLATFORM_GPIO_CONFIG * pConfig, + ADI_SENSE_GPIO_HANDLE * phDevice); + +/*! + * @brief Close GPIO interface and free resources + * + * @param[in] hDevice GPIO interface context handle (@ref adi_sense_GpioOpen) + */ +void adi_sense_GpioClose( + ADI_SENSE_GPIO_HANDLE hDevice); + +/*! + * @brief Get the state of the specified GPIO pin + * + * @param[in] hDevice GPIO interface context handle (@ref adi_sense_GpioOpen) + * @param[in] ePinId GPIO pin to be read + * @param[out] pbState Pointer to return the state of the GPIO pin + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified + */ +ADI_SENSE_RESULT adi_sense_GpioGet( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinID, + bool_t * bState); + +/*! + * @brief Set the state of the specified GPIO pin + * + * @param[in] hDevice GPIO interface context handle (@ref adi_sense_GpioOpen) + * @param[in] ePinId GPIO pin to be set + * @param[in] bState The state to set for GPIO pin + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified + */ +ADI_SENSE_RESULT adi_sense_GpioSet( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinID, + bool_t bState); + +/*! + * @brief Enable interrupt notifications on the specified GPIO pin + * + * @param[in] hDevice GPIO interface context handle (@ref adi_sense_GpioOpen) + * @param[in] ePinId GPIO pin on which to enable interrupt notifications + * @param[in] callback Callback function to invoke when the GPIO is asserted + * @param[in] arg Optional opaque parameter to be passed to the callback + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified + */ +ADI_SENSE_RESULT adi_sense_GpioIrqEnable( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinID, + ADI_SENSE_GPIO_CALLBACK callback, + void * arg); + +/*! + * @brief Disable interrupt notifications on the specified GPIO pin + * + * @param[in] hDevice GPIO interface context handle (@ref adi_sense_GpioOpen) + * @param[in] ePinId GPIO pin on which to disable interrupt notifications + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified + */ +ADI_SENSE_RESULT adi_sense_GpioIrqDisable( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinID); + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_GPIO_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_log.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,120 @@ +/*! + ****************************************************************************** + * @file: adi_sense_log.h + * @brief: ADI Sense OS-dependent wrapper layer for log functions + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_LOG_H__ +#define __ADI_SENSE_LOG_H__ + +#include "inc/adi_sense_types.h" + +/*! @ingroup ADI_Sense_Host */ + +/*! @addtogroup ADI_Sense_Log ADI Sense Host Logging functions + * @{ + */ + +/*! Macro function for logging an error message */ +#define ADI_SENSE_LOG_ERROR(...) \ + adi_sense_Log(ADI_SENSE_LOG_LEVEL_ERROR, "[ERROR] " __VA_ARGS__) +/*! Macro function for logging a warning message */ +#define ADI_SENSE_LOG_WARN(...) \ + adi_sense_Log(ADI_SENSE_LOG_LEVEL_WARN, "[WARN] " __VA_ARGS__) +/*! Macro function for logging an information message */ +#define ADI_SENSE_LOG_INFO(...) \ + adi_sense_Log(ADI_SENSE_LOG_LEVEL_INFO, "[INFO] " __VA_ARGS__) +/*! Macro function for logging a debug message */ +#define ADI_SENSE_LOG_DEBUG(...) \ + adi_sense_Log(ADI_SENSE_LOG_LEVEL_DEBUG, "[DEBUG] " __VA_ARGS__) + +/*! + * Log message priority levels + */ +typedef enum +{ + ADI_SENSE_LOG_LEVEL_ERROR = 0, /*!< Error message priority */ + ADI_SENSE_LOG_LEVEL_WARN, /*!< Warning message priority */ + ADI_SENSE_LOG_LEVEL_INFO, /*!< Information message priority */ + ADI_SENSE_LOG_LEVEL_DEBUG, /*!< Debug message priority */ +} ADI_SENSE_LOG_LEVEL; + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*! + * @brief Initialise the Log interface and allocate resources. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_NO_MEM Failed to allocate memory for device context. + */ +ADI_SENSE_RESULT adi_sense_LogOpen( + void); + +/*! + * @brief Close the Log interface and free resources. + */ +void adi_sense_LogClose( + void); + +/*! + * @brief Print a log message to the platform log interface. + * + * @param[in] level Log message priority level + * @param[in] format Format string and variable argument list, if any + */ +void adi_sense_Log( + ADI_SENSE_LOG_LEVEL level, + const char * format, + ...); + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_LOG_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_platform.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,66 @@ +/*! + ****************************************************************************** + * @file: adi_sense_platform.h + * @brief: Platform-specific 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_PLATFORM_H__ +#define __ADI_SENSE_PLATFORM_H__ + +#include <stddef.h> +#include <stdint.h> +#include <stdbool.h> + +/*! @defgroup ADI_Sense_Host ADI Sense Host Portability Layer */ + +typedef char char_t; +typedef float float32_t; +typedef double float64_t; +typedef uint8_t bool_t; + +#ifdef __MBED__ +#include "inc/mbed/adi_sense_platform.h" +#endif + +#endif /* __ADI_SENSE_PLATFORM_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_spi.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,114 @@ +/*! + ****************************************************************************** + * @file: adi_sense_spi.h + * @brief: ADI Sense OS-dependent wrapper layer for SPI interface + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_SPI_H__ +#define __ADI_SENSE_SPI_H__ + +#include "inc/adi_sense_types.h" +#include "inc/adi_sense_platform.h" + +/*! @ingroup ADI_Sense_Host */ + +/*! @addtogroup ADI_Sense_Spi ADI Sense Host SPI interface functions + * @{ + */ + +/*! A handle used in all API functions to identify the SPI interface context */ +typedef void * ADI_SENSE_SPI_HANDLE; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*! + * @brief Open the SPI interface and allocate resources + * + * @param[in] pConfig Pointer to platform-specific SPI interface details + * @param[out] phDevice Pointer to return a SPI interface context handle + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_NO_MEM Failed to allocate memory for interface context + */ +ADI_SENSE_RESULT adi_sense_SpiOpen( + ADI_SENSE_PLATFORM_SPI_CONFIG * pConfig, + ADI_SENSE_SPI_HANDLE * phDevice); + +/*! + * @brief Close SPI interface and free resources + * + * @param[in] hDevice SPI interface context handle (@ref adi_sense_SpiOpen) + */ +void adi_sense_SpiClose( + ADI_SENSE_SPI_HANDLE hDevice); + +/*! + * @brief Transfer data to slave device + * + * @param[in] hDevice SPI interface context handle (@ref adi_sense_SpiOpen) + * @param[in] pTxData Transmit data buffer, or NULL for read-only transfers + * @param[in] pRxData Receive data buffer, or NULL for write-only transfers + * @param[in] nLength Number of bytes to transfer + * @param[in] bCsHold Leave the chip-select asserted when the transfer is done + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully + * - #ADI_SENSE_FAILURE Failed to complete SPI transfer + */ +ADI_SENSE_RESULT adi_sense_SpiTransfer( + ADI_SENSE_SPI_HANDLE hDevice, + void * pTxData, + void * pRxData, + unsigned nLength, + bool bCsHold); + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_SPI_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_time.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,76 @@ +/*! + ****************************************************************************** + * @file: adi_sense_time.h + * @brief: ADI Sense OS Dependant wrapper layer for time functions + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_TIME_H__ +#define __ADI_SENSE_TIME_H__ + +#include "inc/adi_sense_types.h" + +/*! @ingroup ADI_Sense_Host */ + +/*! @addtogroup ADI_Sense_Time ADI Sense Host Time functions + * @{ + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*! + * @brief Wait for a specified number of microseconds + * + * @param[in] microseconds Number of microseconds to wait + */ +void adi_sense_TimeDelayUsec( + const unsigned microseconds); + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* __ADI_SENSE_TIME_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_types.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,106 @@ +/*! + ****************************************************************************** + * @file: adi_sense_types.h + * @brief: Type definitions for ADI Sense API. + *----------------------------------------------------------------------------- + */ + +/* +Copyright 2017 (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. +*/ + +#ifndef __ADI_SENSE_TYPES_H__ +#define __ADI_SENSE_TYPES_H__ + +#include "inc/adi_sense_platform.h" + +/*! + ***************************************************************************** + * \enum ADI_SENSE_RESULT + * + * ADI Sense API Error Codes. #ADI_SENSE_SUCCESS is always zero + * The return value of all ADI Sense APIs returning #ADI_SENSE_RESULT + * should always be tested at the application level for success or failure. + * + *****************************************************************************/ +typedef enum +{ + /*! Generic success. */ + ADI_SENSE_SUCCESS, + /*! Generic Failure. */ + ADI_SENSE_FAILURE, + /*! Operation incomplete, call again */ + ADI_SENSE_INCOMPLETE, + /*! Device is already initialized. */ + ADI_SENSE_IN_USE, + /*! Invalid device handle. */ + ADI_SENSE_INVALID_HANDLE, + /*! Invalid device ID. */ + ADI_SENSE_INVALID_DEVICE_NUM, + /*! Device is uninitialized. */ + ADI_SENSE_ERR_NOT_INITIALIZED, + /*! NULL data pointer not allowed. */ + ADI_SENSE_INVALID_POINTER, + /*! Parameter is out of range. */ + ADI_SENSE_INVALID_PARAM, + /*! Unsupported mode of operation. */ + ADI_SENSE_UNSUPPORTED_MODE, + /*! Invalid operation */ + ADI_SENSE_INVALID_OPERATION, + /*! No data available, or buffer full */ + ADI_SENSE_NO_DATA, + /*! No buffer space available */ + ADI_SENSE_NO_SPACE, + /*! Square root of a negative number */ + ADI_SENSE_NEGATIVE_SQRT, + /*! Division by 0 or 0.0 */ + ADI_SENSE_DIVIDE_BY_ZERO, + /*! Invalid signature */ + ADI_SENSE_INVALID_SIGNATURE, + /*! Wrong size */ + ADI_SENSE_WRONG_SIZE, + /*! Sample Out of the dsp data limits */ + ADI_SENSE_OUT_OF_RANGE, + /*! Unable to operate with not a number */ + ADI_SENSE_NAN_FOUND, + /*! Timeout error */ + ADI_SENSE_TIMEOUT, + /*! Memory allocation error */ + ADI_SENSE_NO_MEM, + /*! CRC validation error */ + ADI_SENSE_CRC_ERROR, +} ADI_SENSE_RESULT; + +#endif /* __ADI_SENSE_TYPES_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/mbed/adi_sense_platform.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,69 @@ +/*! + ****************************************************************************** + * @file: adi_sense_platform.h + * @brief: mbed platform-specific 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_PLATFORM_MBED_H__ +#define __ADI_SENSE_PLATFORM_MBED_H__ + +/*! Maximum number of ADI Sense device instances supported on this platform */ +#define ADI_SENSE_PLATFORM_MAX_DEVICES 1 + +typedef struct { + int mosiPin; + int misoPin; + int sckPin; + int csPin; + int maxSpeedHz; +} ADI_SENSE_PLATFORM_SPI_CONFIG; + +typedef struct { + int resetPin; + int errorPin; + int alertPin; + int datareadyPin; +} ADI_SENSE_PLATFORM_GPIO_CONFIG; + +#endif /* __ADI_SENSE_PLATFORM_MBED_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,145 @@ +/* + ****************************************************************************** + * file: main.cpp + *----------------------------------------------------------------------------- + * +Copyright 2017 (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. + * + *****************************************************************************/ +#include "mbed.h" +#include "inc/adi_sense_api.h" +#include "inc/adi_sense_1000/adi_sense_1000_api.h" +#include "inc/adi_sense_log.h" +#include "common/utils.h" + +extern ADI_SENSE_CONFIG config; + +/* Change the following pointer to select any of the configurations above */ +static ADI_SENSE_CONFIG *pSelectedConfig = &config; + +static ADI_SENSE_CONNECTION connectionInfo = { + .type = ADI_SENSE_CONNECTION_TYPE_SPI, + .spi = { + .mosiPin = SPI_MOSI, + .misoPin = SPI_MISO, + .sckPin = SPI_SCK, + .csPin = D10, + .maxSpeedHz = 2000000, + }, + .gpio = { + .resetPin = D6, + .errorPin = D3, + .alertPin = D4, + .datareadyPin = D5, + }, +}; + +int main() +{ + ADI_SENSE_RESULT res; + ADI_SENSE_DEVICE_HANDLE hDevice; + ADI_SENSE_MEASUREMENT_MODE eMeasurementMode = ADI_SENSE_MEASUREMENT_MODE_NORMAL; + bool_t bDeviceReady; + + /* + * Open an ADI Sense device instance. + */ + res = adi_sense_Open(0, &connectionInfo, &hDevice); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to open device instance"); + return res; + } + + /* + * Reset the given ADI Sense device.... + */ + ADI_SENSE_LOG_INFO("Resetting ADI Sense device, please wait..."); + res = adi_sense_Reset(hDevice); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to reset device"); + return res; + } + /* + * ...and wait until the device is ready. + */ + do { + wait_ms(100); + res = adi_sense_GetDeviceReadyState(hDevice, &bDeviceReady); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to get device ready-state"); + return res; + } + } while (! bDeviceReady); + ADI_SENSE_LOG_INFO("ADI Sense device ready"); + + /* + * Write configuration settings to the device registers. + * Settings are not applied until adi_sense_ApplyConfigUpdates() is called. + */ + ADI_SENSE_LOG_INFO("Setting device configuration"); + res = adi_sense_SetConfig(hDevice, pSelectedConfig); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set device configuration"); + return res; + } + res = adi_sense_ApplyConfigUpdates(hDevice); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to apply device configuration"); + return res; + } + + /* + * Kick off the measurement cycle here + */ + ADI_SENSE_LOG_INFO("Configuration completed, starting measurement cycles"); + utils_runMeasurement(hDevice, eMeasurementMode); + + /* + * Clean up and exit + */ + res = adi_sense_Close(hDevice); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to close device instance"); + return res; + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#96d9a00d0a1d25095b330095fa81c40f7741777c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/adi_sense_1000.c Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,2404 @@ +/*! + ****************************************************************************** + * @file: adi_sense_1000.c + * @brief: ADI Sense API implementation for ADI Sense 1000 + *----------------------------------------------------------------------------- + */ + +/****************************************************************************** +Copyright 2017 (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. + * + *****************************************************************************/ +#include <float.h> +#include <math.h> +#include <string.h> + +#include "inc/adi_sense_platform.h" +#include "inc/adi_sense_api.h" +#include "inc/adi_sense_1000/adi_sense_1000_api.h" + +#include "adi_sense_1000/ADISENSE1000_REGISTERS_typedefs.h" +#include "adi_sense_1000/ADISENSE1000_REGISTERS.h" +#include "adi_sense_1000/adi_sense_1000_lut_data.h" +#include "adi_sense_1000/adi_sense_1000_calibration.h" + +#include "crc16.h" + +/* + * The host is expected to transfer a 16-bit command, followed by data bytes, in 2 + * separate transfers delineated by the CS signal and a short delay in between. + * + * The 16-bit command contains a right-justified 11-bit register address (offset), + * and the remaining upper 5 bits are reserved as command bits assigned as follows: + * [15:11] 10000b = write command, 01000b = read command, anything else is invalid + * [10:0] register address (0-2047) + */ + +/* Register address space is limited to 2048 bytes (11 bit address) */ +#define REG_COMMAND_MASK 0xF800 +#define REG_ADDRESS_MASK 0x07FF + +/* + * The following commands are currently supported, anything else is treated + * as an error + */ +#define REG_WRITE_COMMAND 0x8000 +#define REG_READ_COMMAND 0x4000 + +/* + * The following bytes are sent back to the host when a command is recieved, + * to be used by the host to verify that we were ready to receive the command. + */ +#define REG_COMMAND_RESP_0 0xF0 +#define REG_COMMAND_RESP_1 0xE1 + +/* + * The following minimum delay must be inserted after each SPI transfer to allow + * time for it to be processed by the device + */ +#define POST_SPI_TRANSFER_DELAY_USEC (20) + +/* + * The following macros are used to encapsulate the register access code + * to improve readability in the functions further below in this file + */ +#define STRINGIFY(name) #name + +/* Expand the full name of the reset value macro for the specified register */ +#define REG_RESET_VAL(_name) REG_ADISENSE_##_name##_RESET + +/* Checks if a value is outside the bounds of the specified register field */ +#define CHECK_REG_FIELD_VAL(_field, _val) \ + do { \ + uint32_t _mask = BITM_ADISENSE_##_field; \ + uint32_t _shift = BITP_ADISENSE_##_field; \ + if ((((_val) << _shift) & ~(_mask)) != 0) { \ + ADI_SENSE_LOG_ERROR("Value 0x%08X invalid for register field %s", \ + (uint32_t)(_val), \ + STRINGIFY(ADISENSE_##_field)); \ + return ADI_SENSE_INVALID_PARAM; \ + } \ + } while(false) + +/* + * Encapsulates the write to a specified register + * NOTE - this will cause the calling function to return on error + */ +#define WRITE_REG(_hdev, _val, _name, _type) \ + do { \ + ADI_SENSE_RESULT _res; \ + _type _regval = _val; \ + _res = adi_sense_1000_WriteRegister((_hdev), \ + REG_ADISENSE_##_name, \ + &_regval, sizeof(_regval)); \ + if (_res != ADI_SENSE_SUCCESS) \ + return _res; \ + } while(false) + +/* Wrapper macro to write a value to a uint32_t register */ +#define WRITE_REG_U32(_hdev, _val, _name) \ + WRITE_REG(_hdev, _val, _name, uint32_t) +/* Wrapper macro to write a value to a uint16_t register */ +#define WRITE_REG_U16(_hdev, _val, _name) \ + WRITE_REG(_hdev, _val, _name, uint16_t) +/* Wrapper macro to write a value to a uint8_t register */ +#define WRITE_REG_U8(_hdev, _val, _name) \ + WRITE_REG(_hdev, _val, _name, uint8_t) +/* Wrapper macro to write a value to a float32_t register */ +#define WRITE_REG_FLOAT(_hdev, _val, _name) \ + WRITE_REG(_hdev, _val, _name, float32_t) + +/* + * Encapsulates the read from a specified register + * NOTE - this will cause the calling function to return on error + */ +#define READ_REG(_hdev, _val, _name, _type) \ + do { \ + ADI_SENSE_RESULT _res; \ + _type _regval; \ + _res = adi_sense_1000_ReadRegister((_hdev), \ + REG_ADISENSE_##_name, \ + &_regval, sizeof(_regval)); \ + if (_res != ADI_SENSE_SUCCESS) \ + return _res; \ + _val = _regval; \ + } while(false) + +/* Wrapper macro to read a value from a uint32_t register */ +#define READ_REG_U32(_hdev, _val, _name) \ + READ_REG(_hdev, _val, _name, uint32_t) +/* Wrapper macro to read a value from a uint16_t register */ +#define READ_REG_U16(_hdev, _val, _name) \ + READ_REG(_hdev, _val, _name, uint16_t) +/* Wrapper macro to read a value from a uint8_t register */ +#define READ_REG_U8(_hdev, _val, _name) \ + READ_REG(_hdev, _val, _name, uint8_t) +/* Wrapper macro to read a value from a float32_t register */ +#define READ_REG_FLOAT(_hdev, _val, _name) \ + READ_REG(_hdev, _val, _name, float32_t) + +/* + * Wrapper macro to write an array of values to a uint8_t register + * NOTE - this is intended only for writing to a keyhole data register + */ +#define WRITE_REG_U8_ARRAY(_hdev, _arr, _len, _name) \ + do { \ + ADI_SENSE_RESULT _res; \ + _res = adi_sense_1000_WriteRegister(_hdev, \ + REG_ADISENSE_##_name, \ + _arr, _len); \ + if (_res != ADI_SENSE_SUCCESS) \ + return _res; \ + } while(false) + +/* + * Wrapper macro to read an array of values from a uint8_t register + * NOTE - this is intended only for reading from a keyhole data register + */ +#define READ_REG_U8_ARRAY(_hdev, _arr, _len, _name) \ + do { \ + ADI_SENSE_RESULT _res; \ + _res = adi_sense_1000_ReadRegister((_hdev), \ + REG_ADISENSE_##_name, \ + _arr, _len); \ + if (_res != ADI_SENSE_SUCCESS) \ + return _res; \ + } while(false) + +#define ADI_SENSE_1000_CHANNEL_IS_ADC(c) \ + ((c) >= ADI_SENSE_1000_CHANNEL_ID_CJC_0 && (c) <= ADI_SENSE_1000_CHANNEL_ID_CURRENT_0) + +#define ADI_SENSE_1000_CHANNEL_IS_ADC_CJC(c) \ + ((c) >= ADI_SENSE_1000_CHANNEL_ID_CJC_0 && (c) <= ADI_SENSE_1000_CHANNEL_ID_CJC_1) + +#define ADI_SENSE_1000_CHANNEL_IS_ADC_SENSOR(c) \ + ((c) >= ADI_SENSE_1000_CHANNEL_ID_SENSOR_0 && (c) <= ADI_SENSE_1000_CHANNEL_ID_SENSOR_3) + +#define ADI_SENSE_1000_CHANNEL_IS_ADC_VOLTAGE(c) \ + ((c) == ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0) + +#define ADI_SENSE_1000_CHANNEL_IS_ADC_CURRENT(c) \ + ((c) == ADI_SENSE_1000_CHANNEL_ID_CURRENT_0) + +#define ADI_SENSE_1000_CHANNEL_IS_VIRTUAL(c) \ + ((c) == ADI_SENSE_1000_CHANNEL_ID_SPI_1 || (c) == ADI_SENSE_1000_CHANNEL_ID_SPI_2) + +typedef struct +{ + unsigned nDeviceIndex; + ADI_SENSE_SPI_HANDLE hSpi; + ADI_SENSE_GPIO_HANDLE hGpio; +} ADI_SENSE_DEVICE_CONTEXT; + +static ADI_SENSE_DEVICE_CONTEXT gDeviceCtx[ADI_SENSE_PLATFORM_MAX_DEVICES]; + +/* + * Open an ADI Sense device instance. + */ +ADI_SENSE_RESULT adi_sense_Open( + unsigned const nDeviceIndex, + ADI_SENSE_CONNECTION * const pConnectionInfo, + ADI_SENSE_DEVICE_HANDLE * const phDevice) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx; + ADI_SENSE_RESULT eRet; + + if (nDeviceIndex >= ADI_SENSE_PLATFORM_MAX_DEVICES) + return ADI_SENSE_INVALID_DEVICE_NUM; + + pCtx = &gDeviceCtx[nDeviceIndex]; + pCtx->nDeviceIndex = nDeviceIndex; + + eRet = adi_sense_LogOpen(); + if (eRet != ADI_SENSE_SUCCESS) + return eRet; + + eRet = adi_sense_GpioOpen(&pConnectionInfo->gpio, &pCtx->hGpio); + if (eRet != ADI_SENSE_SUCCESS) + return eRet; + + eRet = adi_sense_SpiOpen(&pConnectionInfo->spi, &pCtx->hSpi); + if (eRet != ADI_SENSE_SUCCESS) + return eRet; + + *phDevice = pCtx; + return ADI_SENSE_SUCCESS; +} + +/* + * Get the current state of the specified GPIO input signal. + */ +ADI_SENSE_RESULT adi_sense_GetGpioState( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_GPIO_PIN const ePinId, + bool_t * const pbAsserted) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + + return adi_sense_GpioGet(pCtx->hGpio, ePinId, pbAsserted); +} + +/* + * Register an application-defined callback function for GPIO interrupts. + */ +ADI_SENSE_RESULT adi_sense_RegisterGpioCallback( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_GPIO_PIN const ePinId, + ADI_SENSE_GPIO_CALLBACK const callbackFunction, + void * const pCallbackParam) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + + if (callbackFunction) + { + return adi_sense_GpioIrqEnable(pCtx->hGpio, ePinId, callbackFunction, + pCallbackParam); + } + else + { + return adi_sense_GpioIrqDisable(pCtx->hGpio, ePinId); + } +} + +/* + * Reset the specified ADI Sense device. + */ +ADI_SENSE_RESULT adi_sense_Reset( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + ADI_SENSE_RESULT eRet; + + /* Pulse the Reset GPIO pin low for a minimum of 4 microseconds */ + eRet = adi_sense_GpioSet(pCtx->hGpio, ADI_SENSE_GPIO_PIN_RESET, false); + if (eRet != ADI_SENSE_SUCCESS) + return eRet; + + adi_sense_TimeDelayUsec(4); + + eRet = adi_sense_GpioSet(pCtx->hGpio, ADI_SENSE_GPIO_PIN_RESET, true); + if (eRet != ADI_SENSE_SUCCESS) + return eRet; + + return ADI_SENSE_SUCCESS; +} + + +/*! + * @brief Get general status of ADISense module. + * + * @param[in] + * @param[out] pStatus : Pointer to CORE Status struct. + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_FAILURE If status register read fails. + * + * @details Read the general status register for the ADISense + * module. Indicates Error, Alert conditions, data ready + * and command running. + * + */ +ADI_SENSE_RESULT adi_sense_GetStatus( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_STATUS * const pStatus) +{ + ADI_ADISENSE_CORE_Status_t statusReg; + READ_REG_U8(hDevice, statusReg.VALUE8, CORE_STATUS); + + memset(pStatus, 0, sizeof(*pStatus)); + + if (!statusReg.Cmd_Running) /* Active-low, so invert it */ + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_BUSY; + if (statusReg.Drdy) + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_DATAREADY; + if (statusReg.FIFO_Error) + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_FIFO_ERROR; + if (statusReg.Alert_Active) + { + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_ALERT; + + ADI_ADISENSE_CORE_Alert_Code_t alertCodeReg; + READ_REG_U16(hDevice, alertCodeReg.VALUE16, CORE_ALERT_CODE); + pStatus->alertCode = alertCodeReg.Alert_Code; + + ADI_ADISENSE_CORE_Channel_Alert_Status_t channelAlertStatusReg; + READ_REG_U16(hDevice, channelAlertStatusReg.VALUE16, + CORE_CHANNEL_ALERT_STATUS); + + for (unsigned i = 0; i < ADI_SENSE_1000_MAX_CHANNELS; i++) + { + if (channelAlertStatusReg.VALUE16 & (1 << i)) + { + ADI_ADISENSE_CORE_Alert_Code_Ch_t channelAlertCodeReg; + READ_REG_U16(hDevice, channelAlertCodeReg.VALUE16, CORE_ALERT_CODE_CHn(i)); + pStatus->channelAlertCodes[i] = channelAlertCodeReg.Alert_Code_Ch; + + ADI_ADISENSE_CORE_Alert_Detail_Ch_t alertDetailReg; + READ_REG_U16(hDevice, alertDetailReg.VALUE16, + CORE_ALERT_DETAIL_CHn(i)); + + if (alertDetailReg.Time_Out) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_TIMEOUT; + if (alertDetailReg.Under_Range) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_UNDER_RANGE; + if (alertDetailReg.Over_Range) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_OVER_RANGE; + if (alertDetailReg.Low_Limit) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_LOW_LIMIT; + if (alertDetailReg.High_Limit) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_HIGH_LIMIT; + if (alertDetailReg.Sensor_Open) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_SENSOR_OPEN; + if (alertDetailReg.Ref_Detect) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_REF_DETECT; + if (alertDetailReg.Config_Err) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_CONFIG_ERR; + if (alertDetailReg.LUT_Error_Ch) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_LUT_ERR; + if (alertDetailReg.Sensor_Not_Ready) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_SENSOR_NOT_READY; + if (alertDetailReg.Comp_Not_Ready) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_COMP_NOT_READY; + if (alertDetailReg.Under_Voltage) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_UNDER_VOLTAGE; + if (alertDetailReg.Over_Voltage) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_OVER_VOLTAGE; + if (alertDetailReg.Correction_UnderRange) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_LUT_UNDER_RANGE; + if (alertDetailReg.Correction_OverRange) + pStatus->channelAlerts[i] |= ADI_SENSE_CHANNEL_ALERT_LUT_OVER_RANGE; + } + } + + ADI_ADISENSE_CORE_Alert_Status_2_t alert2Reg; + READ_REG_U16(hDevice, alert2Reg.VALUE16, CORE_ALERT_STATUS_2); + if (alert2Reg.Configuration_Error) + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_CONFIG_ERROR; + if (alert2Reg.LUT_Error) + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_LUT_ERROR; + } + + if (statusReg.Error) + { + pStatus->deviceStatus |= ADI_SENSE_DEVICE_STATUS_ERROR; + + ADI_ADISENSE_CORE_Error_Code_t errorCodeReg; + READ_REG_U16(hDevice, errorCodeReg.VALUE16, CORE_ERROR_CODE); + pStatus->errorCode = errorCodeReg.Error_Code; + + ADI_ADISENSE_CORE_Diagnostics_Status_t diagStatusReg; + READ_REG_U16(hDevice, diagStatusReg.VALUE16, CORE_DIAGNOSTICS_STATUS); + + if (diagStatusReg.Diag_Checksum_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_CHECKSUM_ERROR; + if (diagStatusReg.Diag_Comms_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_COMMS_ERROR; + if (diagStatusReg.Diag_Supply_Monitor_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_MONITOR_ERROR; + if (diagStatusReg.Diag_Supply_Cap_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_CAP_ERROR; + if (diagStatusReg.Diag_Ainm_UV_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_AINM_UV_ERROR; + if (diagStatusReg.Diag_Ainm_OV_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_AINM_OV_ERROR; + if (diagStatusReg.Diag_Ainp_UV_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_AINP_UV_ERROR; + if (diagStatusReg.Diag_Ainp_OV_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_AINP_OV_ERROR; + if (diagStatusReg.Diag_Conversion_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_CONVERSION_ERROR; + if (diagStatusReg.Diag_Calibration_Error) + pStatus->diagnosticsStatus |= ADI_SENSE_DIAGNOSTICS_STATUS_CALIBRATION_ERROR; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_GetCommandRunningState( + ADI_SENSE_DEVICE_HANDLE hDevice, + bool_t *pbCommandRunning) +{ + ADI_ADISENSE_CORE_Status_t statusReg; + + READ_REG_U8(hDevice, statusReg.VALUE8, CORE_STATUS); + + /* We should never normally see 0xFF here if the module is operational */ + if (statusReg.VALUE8 == 0xFF) + return ADI_SENSE_ERR_NOT_INITIALIZED; + + *pbCommandRunning = !statusReg.Cmd_Running; /* Active-low, so invert it */ + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT executeCommand( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_ADISENSE_CORE_Command_Special_Command const command, + bool_t const bWaitForCompletion) +{ + ADI_ADISENSE_CORE_Command_t commandReg; + bool_t bCommandRunning; + ADI_SENSE_RESULT eRet; + + /* + * Don't allow another command to be issued if one is already running, but + * make an exception for ADISENSE_CORE_COMMAND_NOP which can be used to + * request a running command to be stopped (e.g. continuous measurement) + */ + if (command != ADISENSE_CORE_COMMAND_NOP) + { + eRet = adi_sense_GetCommandRunningState(hDevice, &bCommandRunning); + if (eRet) + return eRet; + + if (bCommandRunning) + return ADI_SENSE_IN_USE; + } + + commandReg.Special_Command = command; + WRITE_REG_U8(hDevice, commandReg.VALUE8, CORE_COMMAND); + + if (bWaitForCompletion) + { + do { + /* Allow a minimum 50usec delay for status update before checking */ + adi_sense_TimeDelayUsec(50); + + eRet = adi_sense_GetCommandRunningState(hDevice, &bCommandRunning); + if (eRet) + return eRet; + } while (bCommandRunning); + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_ApplyConfigUpdates( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_LATCH_CONFIG, true); +} + +/*! + * @brief Start a measurement cycle. + * + * @param[out] + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * - #ADI_SENSE_FAILURE + * + * @details Sends the latch config command. Configuration for channels in + * conversion cycle should be completed before this function. + * Channel enabled bit should be set before this function. + * Starts a conversion and configures the format of the sample. + * + */ +ADI_SENSE_RESULT adi_sense_StartMeasurement( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode) +{ + switch (eMeasurementMode) + { + case ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK: + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_SYSTEM_CHECK, false); + case ADI_SENSE_MEASUREMENT_MODE_NORMAL: + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_CONVERT_WITH_RAW, false); + case ADI_SENSE_MEASUREMENT_MODE_OMIT_RAW: + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_CONVERT, false); + default: + ADI_SENSE_LOG_ERROR("Invalid measurement mode %d specified", + eMeasurementMode); + return ADI_SENSE_INVALID_PARAM; + } +} + +/* + * Store the configuration settings to persistent memory on the device. + * No other command must be running when this is called. + * Do not power down the device while this command is running. + */ +ADI_SENSE_RESULT adi_sense_SaveConfig( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_SAVE_CONFIG, true); +} + +/* + * Restore the configuration settings from persistent memory on the device. + * No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RestoreConfig( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_LOAD_CONFIG, true); +} + +/* + * Store the LUT data to persistent memory on the device. + * No other command must be running when this is called. + * Do not power down the device while this command is running. + */ +ADI_SENSE_RESULT adi_sense_SaveLutData( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_SAVE_LUT2, true); +} + +/* + * Restore the LUT data from persistent memory on the device. + * No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RestoreLutData( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_LOAD_LUT, true); +} + +/* + * Stop the measurement cycles on the device. + * To be used only if a measurement command is currently running. + */ +ADI_SENSE_RESULT adi_sense_StopMeasurement( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_NOP, true); +} + +/* + * Run built-in diagnostic checks on the device. + * Diagnostics are executed according to the current applied settings. + * No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RunDiagnostics( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_RUN_DIAGNOSTICS, true); +} + +/* + * Run self-calibration routines on the device. + * Calibration is executed according to the current applied settings. + * No other command must be running when this is called. + */ +ADI_SENSE_RESULT adi_sense_RunCalibration( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_SELF_CALIBRATION, true); +} + +/* + * Read a set of data samples from the device. + * This may be called at any time. + */ +ADI_SENSE_RESULT adi_sense_GetData( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode, + ADI_SENSE_DATA_SAMPLE * const pSamples, + uint32_t const nRequested, + uint32_t * const pnReturned) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + uint16_t command = REG_READ_COMMAND | + (REG_ADISENSE_CORE_DATA_FIFO & REG_ADDRESS_MASK); + uint8_t commandData[2] = { + command >> 8, + command & 0xFF + }; + uint8_t commandResponse[2]; + unsigned nValidSamples = 0; + ADI_SENSE_RESULT eRet = ADI_SENSE_SUCCESS; + + do { + eRet = adi_sense_SpiTransfer(pCtx->hSpi, commandData, commandResponse, + sizeof(command), false); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to send read command for FIFO register"); + return eRet; + } + + adi_sense_TimeDelayUsec(POST_SPI_TRANSFER_DELAY_USEC); + } while ((commandResponse[0] != REG_COMMAND_RESP_0) || + (commandResponse[1] != REG_COMMAND_RESP_1)); + + for (unsigned i = 0; i < nRequested; i++) + { + ADI_ADISENSE_CORE_Data_FIFO_t dataFifoReg; + bool_t bHoldCs = true; + unsigned readSampleSize = sizeof(dataFifoReg); + + if (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_OMIT_RAW) + readSampleSize -= 3; /* 3B raw value omitted in this case */ + + /* Keep the CS signal asserted for all but the last sample */ + if ((i + 1) == nRequested) + bHoldCs = false; + + eRet = adi_sense_SpiTransfer(pCtx->hSpi, NULL, &dataFifoReg, + readSampleSize, bHoldCs); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to read data from FIFO register"); + return eRet; + } + + if (! dataFifoReg.Ch_Valid) + { + /* + * Reading an invalid sample indicates that there are no + * more samples available or we've lost sync with the device. + * In the latter case, it might be recoverable, but return here + * to let the application check the device status and decide itself. + */ + eRet = ADI_SENSE_INCOMPLETE; + break; + } + + ADI_SENSE_DATA_SAMPLE *pSample = &pSamples[nValidSamples]; + + pSample->status = 0; + if (dataFifoReg.Ch_Error) + pSample->status |= ADI_SENSE_DEVICE_STATUS_ERROR; + if (dataFifoReg.Ch_Alert) + pSample->status |= ADI_SENSE_DEVICE_STATUS_ALERT; + + if (dataFifoReg.Ch_Raw) + pSample->rawValue = dataFifoReg.Raw_Sample; + else + pSample->rawValue = 0; + + pSample->channelId = dataFifoReg.Channel_ID; + pSample->processedValue = dataFifoReg.Sensor_Result; + + nValidSamples++; + } + *pnReturned = nValidSamples; + + adi_sense_TimeDelayUsec(POST_SPI_TRANSFER_DELAY_USEC); + + return eRet; +} + +/* + * Close the given ADI Sense device. + */ +ADI_SENSE_RESULT adi_sense_Close( + ADI_SENSE_DEVICE_HANDLE const hDevice) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + + adi_sense_GpioClose(pCtx->hGpio); + adi_sense_SpiClose(pCtx->hSpi); + adi_sense_LogClose(); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_WriteRegister( + ADI_SENSE_DEVICE_HANDLE hDevice, + uint16_t nAddress, + void *pData, + unsigned nLength) +{ + ADI_SENSE_RESULT eRet; + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + uint16_t command = REG_WRITE_COMMAND | (nAddress & REG_ADDRESS_MASK); + uint8_t commandData[2] = { + command >> 8, + command & 0xFF + }; + uint8_t commandResponse[2]; + + do { + eRet = adi_sense_SpiTransfer(pCtx->hSpi, commandData, commandResponse, + sizeof(command), false); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to send write command for register %u", + nAddress); + return eRet; + } + + adi_sense_TimeDelayUsec(POST_SPI_TRANSFER_DELAY_USEC); + } while ((commandResponse[0] != REG_COMMAND_RESP_0) || + (commandResponse[1] != REG_COMMAND_RESP_1)); + + eRet = adi_sense_SpiTransfer(pCtx->hSpi, pData, NULL, nLength, false); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to write data (%dB) to register %u", + nLength, nAddress); + return eRet; + } + + adi_sense_TimeDelayUsec(POST_SPI_TRANSFER_DELAY_USEC); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_ReadRegister( + ADI_SENSE_DEVICE_HANDLE hDevice, + uint16_t nAddress, + void *pData, + unsigned nLength) +{ + ADI_SENSE_RESULT eRet; + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + uint16_t command = REG_READ_COMMAND | (nAddress & REG_ADDRESS_MASK); + uint8_t commandData[2] = { + command >> 8, + command & 0xFF + }; + uint8_t commandResponse[2]; + + do { + eRet = adi_sense_SpiTransfer(pCtx->hSpi, commandData, commandResponse, + sizeof(command), false); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to send read command for register %u", + nAddress); + return eRet; + } + + adi_sense_TimeDelayUsec(POST_SPI_TRANSFER_DELAY_USEC); + } while ((commandResponse[0] != REG_COMMAND_RESP_0) || + (commandResponse[1] != REG_COMMAND_RESP_1)); + + eRet = adi_sense_SpiTransfer(pCtx->hSpi, NULL, pData, nLength, false); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to read data (%uB) from register %u", + nLength, nAddress); + return eRet; + } + + adi_sense_TimeDelayUsec(POST_SPI_TRANSFER_DELAY_USEC); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_GetDeviceReadyState( + ADI_SENSE_DEVICE_HANDLE const hDevice, + bool_t * const bReady) +{ + ADI_ADISENSE_SPI_Chip_Type_t chipTypeReg; + + READ_REG_U8(hDevice, chipTypeReg.VALUE8, SPI_CHIP_TYPE); + /* If we read this register successfully, assume the device is ready */ + *bReady = (chipTypeReg.VALUE8 == REG_ADISENSE_SPI_CHIP_TYPE_RESET); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_GetDataReadyModeInfo( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode, + ADI_SENSE_1000_OPERATING_MODE * const peOperatingMode, + ADI_SENSE_1000_DATAREADY_MODE * const peDataReadyMode, + uint32_t * const pnSamplesPerDataready, + uint32_t * const pnSamplesPerCycle) +{ + unsigned nChannelsEnabled = 0; + unsigned nSamplesPerCycle = 0; + + for (ADI_SENSE_1000_CHANNEL_ID chId = 0; chId < ADI_SENSE_1000_MAX_CHANNELS; chId++) + { + ADI_ADISENSE_CORE_Sensor_Details_t sensorDetailsReg; + ADI_ADISENSE_CORE_Channel_Count_t channelCountReg; + + if (ADI_SENSE_1000_CHANNEL_IS_VIRTUAL(chId)) + continue; + + READ_REG_U8(hDevice, channelCountReg.VALUE8, CORE_CHANNEL_COUNTn(chId)); + READ_REG_U32(hDevice, sensorDetailsReg.VALUE32, CORE_SENSOR_DETAILSn(chId)); + + if (channelCountReg.Channel_Enable && !sensorDetailsReg.Do_Not_Publish) + { + ADI_ADISENSE_CORE_Sensor_Type_t sensorTypeReg; + unsigned nActualChannels = 1; + + READ_REG_U16(hDevice, sensorTypeReg.VALUE16, CORE_SENSOR_TYPEn(chId)); + + if (chId == ADI_SENSE_1000_CHANNEL_ID_SPI_0) + { + /* Some sensors automatically generate samples on additional "virtual" channels + * so these channels must be counted as active when those sensors are selected + * and we use the count from the corresponding "physical" channel */ + if (sensorTypeReg.Sensor_Type == + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_1) + nActualChannels += 2; + } + + nChannelsEnabled += nActualChannels; + if (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK) + /* Assume a single sample per channel in test mode */ + nSamplesPerCycle += nActualChannels; + else + nSamplesPerCycle += nActualChannels * + (channelCountReg.Channel_Count + 1); + } + } + + if (nChannelsEnabled == 0) + { + *pnSamplesPerDataready = 0; + *pnSamplesPerCycle = 0; + return ADI_SENSE_SUCCESS; + } + + ADI_ADISENSE_CORE_Mode_t modeReg; + READ_REG_U8(hDevice, modeReg.VALUE8, CORE_MODE); + + *pnSamplesPerCycle = nSamplesPerCycle; + + /* Assume DRDY_PER_CONVERSION behaviour in test mode */ + if ((eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK) || + (modeReg.Drdy_Mode == ADISENSE_CORE_MODE_DRDY_PER_CONVERSION)) + { + *pnSamplesPerDataready = 1; + } + else if (modeReg.Drdy_Mode == ADISENSE_CORE_MODE_DRDY_PER_CYCLE) + { + *pnSamplesPerDataready = nSamplesPerCycle; + } + else + { + ADI_ADISENSE_CORE_Fifo_Num_Cycles_t fifoNumCyclesReg; + READ_REG_U8(hDevice, fifoNumCyclesReg.VALUE8, CORE_FIFO_NUM_CYCLES); + + *pnSamplesPerDataready = + nSamplesPerCycle * fifoNumCyclesReg.Fifo_Num_Cycles; + } + + /* Assume SINGLECYCLE in test mode */ + if ((eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK) || + (modeReg.Conversion_Mode == ADISENSE_CORE_MODE_SINGLECYCLE)) + *peOperatingMode = ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE; + else if (modeReg.Conversion_Mode == ADISENSE_CORE_MODE_MULTICYCLE) + *peOperatingMode = ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE; + else + *peOperatingMode = ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS; + + /* Assume DRDY_PER_CONVERSION behaviour in test mode */ + if ((eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK) || + (modeReg.Drdy_Mode == ADISENSE_CORE_MODE_DRDY_PER_CONVERSION)) + *peDataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CONVERSION; + else if (modeReg.Drdy_Mode == ADISENSE_CORE_MODE_DRDY_PER_CYCLE) + *peDataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE; + else + *peDataReadyMode = ADI_SENSE_1000_DATAREADY_PER_MULTICYCLE_BURST; + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_GetProductID( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_PRODUCT_ID *pProductId) +{ + ADI_ADISENSE_SPI_Product_ID_L_t productIdLoReg; + ADI_ADISENSE_SPI_Product_ID_H_t productIdHiReg; + + READ_REG_U8(hDevice, productIdLoReg.VALUE8, SPI_PRODUCT_ID_L); + READ_REG_U8(hDevice, productIdHiReg.VALUE8, SPI_PRODUCT_ID_H); + + *pProductId = (productIdHiReg.VALUE8 << 8) | productIdLoReg.VALUE8; + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetPowerMode( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_POWER_MODE powerMode) +{ + ADI_ADISENSE_CORE_Power_Config_t powerConfigReg; + + if (powerMode == ADI_SENSE_1000_POWER_MODE_LOW) + { + powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_LOW_POWER; + /* TODO - we need an enum in the register map for the MCU power modes */ + powerConfigReg.Power_Mode_MCU = 0x0; + } + else if (powerMode == ADI_SENSE_1000_POWER_MODE_MID) + { + powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_MID_POWER; + powerConfigReg.Power_Mode_MCU = 0x1; + } + else if (powerMode == ADI_SENSE_1000_POWER_MODE_FULL) + { + powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER; + powerConfigReg.Power_Mode_MCU = 0x2; + } + else + { + ADI_SENSE_LOG_ERROR("Invalid power mode %d specified", powerMode); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U8(hDevice, powerConfigReg.VALUE8, CORE_POWER_CONFIG); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetVddVoltage( + ADI_SENSE_DEVICE_HANDLE hDevice, + float32_t vddVoltage) +{ + WRITE_REG_FLOAT(hDevice, vddVoltage, CORE_AVDD_VOLTAGE); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetPowerConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_POWER_CONFIG *pPowerConfig) +{ + ADI_SENSE_RESULT eRet; + + eRet = adi_sense_SetPowerMode(hDevice, pPowerConfig->powerMode); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set power mode"); + return eRet; + } + + eRet = adi_sense_SetVddVoltage(hDevice, pPowerConfig->supplyVoltage); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set AVdd voltage"); + return eRet; + } + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetMode( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_OPERATING_MODE eOperatingMode, + ADI_SENSE_1000_DATAREADY_MODE eDataReadyMode) +{ + ADI_ADISENSE_CORE_Mode_t modeReg; + + modeReg.VALUE8 = REG_RESET_VAL(CORE_MODE); + + if (eOperatingMode == ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE) + { + modeReg.Conversion_Mode = ADISENSE_CORE_MODE_SINGLECYCLE; + } + else if (eOperatingMode == ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS) + { + modeReg.Conversion_Mode = ADISENSE_CORE_MODE_CONTINUOUS; + } + else if (eOperatingMode == ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE) + { + modeReg.Conversion_Mode = ADISENSE_CORE_MODE_MULTICYCLE; + } + else + { + ADI_SENSE_LOG_ERROR("Invalid operating mode %d specified", + eOperatingMode); + return ADI_SENSE_INVALID_PARAM; + } + + if (eDataReadyMode == ADI_SENSE_1000_DATAREADY_PER_CONVERSION) + { + modeReg.Drdy_Mode = ADISENSE_CORE_MODE_DRDY_PER_CONVERSION; + } + else if (eDataReadyMode == ADI_SENSE_1000_DATAREADY_PER_CYCLE) + { + modeReg.Drdy_Mode = ADISENSE_CORE_MODE_DRDY_PER_CYCLE; + } + else if (eDataReadyMode == ADI_SENSE_1000_DATAREADY_PER_MULTICYCLE_BURST) + { + if (eOperatingMode != ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE) + { + ADI_SENSE_LOG_ERROR( + "Data-ready mode %d cannot be used with operating mode %d", + eDataReadyMode, eOperatingMode); + return ADI_SENSE_INVALID_PARAM; + } + else + { + modeReg.Drdy_Mode = ADISENSE_CORE_MODE_DRDY_PER_FIFO_FILL; + } + } + else + { + ADI_SENSE_LOG_ERROR("Invalid data-ready mode %d specified", eDataReadyMode); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U8(hDevice, modeReg.VALUE8, CORE_MODE); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_SetCycleInterval( + ADI_SENSE_DEVICE_HANDLE hDevice, + uint32_t nCycleInterval) +{ + ADI_ADISENSE_CORE_Cycle_Control_t cycleControlReg; + + cycleControlReg.VALUE16 = REG_RESET_VAL(CORE_CYCLE_CONTROL); + + if (nCycleInterval < (1 << 12)) + { + cycleControlReg.Cycle_Time_Units = ADISENSE_CORE_CYCLE_CONTROL_MICROSECONDS; + } + else if (nCycleInterval < (1000 * (1 << 12))) + { + cycleControlReg.Cycle_Time_Units = ADISENSE_CORE_CYCLE_CONTROL_MILLISECONDS; + nCycleInterval /= 1000; + } + else + { + cycleControlReg.Cycle_Time_Units = ADISENSE_CORE_CYCLE_CONTROL_SECONDS; + nCycleInterval /= 1000000; + } + + CHECK_REG_FIELD_VAL(CORE_CYCLE_CONTROL_CYCLE_TIME, nCycleInterval); + cycleControlReg.Cycle_Time = nCycleInterval; + + WRITE_REG_U16(hDevice, cycleControlReg.VALUE16, CORE_CYCLE_CONTROL); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetMultiCycleConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_MULTICYCLE_CONFIG *pMultiCycleConfig) +{ + CHECK_REG_FIELD_VAL(CORE_FIFO_NUM_CYCLES_FIFO_NUM_CYCLES, + pMultiCycleConfig->cyclesPerBurst); + + WRITE_REG_U8(hDevice, pMultiCycleConfig->cyclesPerBurst, + CORE_FIFO_NUM_CYCLES); + + WRITE_REG_U32(hDevice, pMultiCycleConfig->burstInterval, + CORE_MULTI_CYCLE_REPEAT_INTERVAL); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetExternalReferenceValues( + ADI_SENSE_DEVICE_HANDLE hDevice, + float32_t externalRef1Value, + float32_t externalRef2Value) +{ + WRITE_REG_FLOAT(hDevice, externalRef1Value, CORE_EXTERNAL_REFERENCE1); + WRITE_REG_FLOAT(hDevice, externalRef2Value, CORE_EXTERNAL_REFERENCE2); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetMeasurementConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_MEASUREMENT_CONFIG *pMeasConfig) +{ + ADI_SENSE_RESULT eRet; + + eRet = adi_sense_SetMode(hDevice, + pMeasConfig->operatingMode, + pMeasConfig->dataReadyMode); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set operating mode"); + return eRet; + } + + if (pMeasConfig->operatingMode != ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE) + { + eRet = adi_sense_SetCycleInterval(hDevice, pMeasConfig->cycleInterval); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set cycle interval"); + return eRet; + } + } + + if (pMeasConfig->operatingMode == ADI_SENSE_1000_OPERATING_MODE_MULTICYCLE) + { + eRet = adi_sense_SetMultiCycleConfig(hDevice, + &pMeasConfig->multiCycleConfig); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set multi-cycle configuration"); + return eRet; + } + } + + eRet = adi_sense_SetExternalReferenceValues(hDevice, + pMeasConfig->externalRef1Value, + pMeasConfig->externalRef2Value); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set external reference values"); + return eRet; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetDiagnosticsConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_DIAGNOSTICS_CONFIG *pDiagnosticsConfig) +{ + ADI_ADISENSE_CORE_Diagnostics_Control_t diagnosticsControlReg; + + diagnosticsControlReg.VALUE16 = REG_RESET_VAL(CORE_DIAGNOSTICS_CONTROL); + + if (pDiagnosticsConfig->disableGlobalDiag) + diagnosticsControlReg.Diag_Global_En = 0; + else + diagnosticsControlReg.Diag_Global_En = 1; + + if (pDiagnosticsConfig->disableMeasurementDiag) + diagnosticsControlReg.Diag_Meas_En = 0; + else + diagnosticsControlReg.Diag_Meas_En = 1; + + switch (pDiagnosticsConfig->osdFrequency) + { + case ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_DISABLED: + diagnosticsControlReg.Diag_OSD_Freq = ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_OFF; + break; + case ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_PER_CYCLE: + diagnosticsControlReg.Diag_OSD_Freq = ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_1_CYCLE; + break; + case ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_PER_100_CYCLES: + diagnosticsControlReg.Diag_OSD_Freq = ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_100_CYCLES; + break; + case ADI_SENSE_1000_OPEN_SENSOR_DIAGNOSTICS_PER_1000_CYCLES: + diagnosticsControlReg.Diag_OSD_Freq = ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_1000_CYCLES; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid open-sensor diagnostic frequency %d specified", + pDiagnosticsConfig->osdFrequency); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U16(hDevice, diagnosticsControlReg.VALUE16, CORE_DIAGNOSTICS_CONTROL); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetChannelCount( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + uint32_t nMeasurementsPerCycle) +{ + ADI_ADISENSE_CORE_Channel_Count_t channelCountReg; + + channelCountReg.VALUE8 = REG_RESET_VAL(CORE_CHANNEL_COUNTn); + + if (nMeasurementsPerCycle > 0) + { + nMeasurementsPerCycle -= 1; + + CHECK_REG_FIELD_VAL(CORE_CHANNEL_COUNT_CHANNEL_COUNT, + nMeasurementsPerCycle); + + channelCountReg.Channel_Enable = 1; + channelCountReg.Channel_Count = nMeasurementsPerCycle; + } + else + { + channelCountReg.Channel_Enable = 0; + } + + WRITE_REG_U8(hDevice, channelCountReg.VALUE8, CORE_CHANNEL_COUNTn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelAdcSensorType( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_ADC_SENSOR_TYPE sensorType) +{ + ADI_ADISENSE_CORE_Sensor_Type_t sensorTypeReg; + + sensorTypeReg.VALUE16 = REG_RESET_VAL(CORE_SENSOR_TYPEn); + + /* Ensure that the sensor type is valid for this channel */ + switch(sensorType) + { + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_J_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_K_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_T_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_J_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_K_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_T_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_4_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT100_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT1000_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT100_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_PT1000_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_3WIRE_4_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT100_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT1000_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT100_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_PT1000_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_4WIRE_4_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_4_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_BRIDGE_6WIRE_4_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_A_10K_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_B_10K_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_A_10K_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_B_10K_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_4_ADV_L2: + if (! ADI_SENSE_1000_CHANNEL_IS_ADC_SENSOR(eChannelId)) + { + ADI_SENSE_LOG_ERROR( + "Invalid ADC sensor type %d specified for channel %d", + sensorType, eChannelId); + return ADI_SENSE_INVALID_PARAM; + } + break; + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT100_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT1000_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_2_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_3_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_4_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT100_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT1000_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_2_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_3_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_4_ADV_L2: + if (! (ADI_SENSE_1000_CHANNEL_IS_ADC_SENSOR(eChannelId) || + ADI_SENSE_1000_CHANNEL_IS_ADC_CJC(eChannelId))) + { + ADI_SENSE_LOG_ERROR( + "Invalid ADC sensor type %d specified for channel %d", + sensorType, eChannelId); + return ADI_SENSE_INVALID_PARAM; + } + break; + case ADI_SENSE_1000_ADC_SENSOR_VOLTAGE: + case ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY: + case ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X: + case ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_3_DEF: + if (! ADI_SENSE_1000_CHANNEL_IS_ADC_VOLTAGE(eChannelId)) + { + ADI_SENSE_LOG_ERROR( + "Invalid ADC sensor type %d specified for channel %d", + sensorType, eChannelId); + return ADI_SENSE_INVALID_PARAM; + } + break; + case ADI_SENSE_1000_ADC_SENSOR_CURRENT: + case ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2: + case ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_2_DEF: + if (! ADI_SENSE_1000_CHANNEL_IS_ADC_CURRENT(eChannelId)) + { + ADI_SENSE_LOG_ERROR( + "Invalid ADC sensor type %d specified for channel %d", + sensorType, eChannelId); + return ADI_SENSE_INVALID_PARAM; + } + break; + default: + ADI_SENSE_LOG_ERROR("Invalid/unsupported ADC sensor type %d specified", + sensorType); + return ADI_SENSE_INVALID_PARAM; + } + + sensorTypeReg.Sensor_Type = sensorType; + + WRITE_REG_U16(hDevice, sensorTypeReg.VALUE16, CORE_SENSOR_TYPEn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelAdcSensorDetails( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_CHANNEL_CONFIG *pChannelConfig) +/* + * TODO - it would be nice if the general- vs. ADC-specific sensor details could be split into separate registers + * General details: + * - Measurement_Units + * - Compensation_Channel + * - CJC_Publish (if "CJC" was removed from the name) + * ADC-specific details: + * - PGA_Gain + * - Reference_Select + * - Reference_Buffer_Disable + * - Vbias + */ +{ + ADI_SENSE_1000_ADC_CHANNEL_CONFIG *pAdcChannelConfig = &pChannelConfig->adcChannelConfig; + ADI_SENSE_1000_ADC_REFERENCE_CONFIG *pRefConfig = &pAdcChannelConfig->reference; + ADI_ADISENSE_CORE_Sensor_Details_t sensorDetailsReg; + + sensorDetailsReg.VALUE32 = REG_RESET_VAL(CORE_SENSOR_DETAILSn); + + switch(pChannelConfig->measurementUnit) + { + case ADI_SENSE_1000_MEASUREMENT_UNIT_FAHRENHEIT: + sensorDetailsReg.Measurement_Units = ADISENSE_CORE_SENSOR_DETAILS_UNITS_DEGF; + break; + case ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS: + case ADI_SENSE_1000_MEASUREMENT_UNIT_DEFAULT: + sensorDetailsReg.Measurement_Units = ADISENSE_CORE_SENSOR_DETAILS_UNITS_DEGC; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid measurement unit %d specified", + pChannelConfig->measurementUnit); + return ADI_SENSE_INVALID_PARAM; + } + + sensorDetailsReg.Compensation_Channel = pChannelConfig->compensationChannel; + + switch(pRefConfig->type) + { + case ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_1: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_RINT1; + break; + case ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_2: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_RINT2; + break; + case ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_INT; + break; + case ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_AVDD: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_AVDD; + break; + case ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_EXTERNAL_1: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_REXT1; + break; + case ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_EXTERNAL_2: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_REXT2; + break; + case ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_EXTERNAL_1: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_VEXT1; + break; + case ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_EXTERNAL_2: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_VEXT2; + break; + case ADI_SENSE_1000_ADC_REFERENCE_BRIDGE_EXCITATION: + sensorDetailsReg.Reference_Select = ADISENSE_CORE_SENSOR_DETAILS_REF_EXC; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid ADC reference type %d specified", + pRefConfig->type); + return ADI_SENSE_INVALID_PARAM; + } + + switch(pAdcChannelConfig->gain) + { + case ADI_SENSE_1000_ADC_GAIN_1X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_1; + break; + case ADI_SENSE_1000_ADC_GAIN_2X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_2; + break; + case ADI_SENSE_1000_ADC_GAIN_4X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_4; + break; + case ADI_SENSE_1000_ADC_GAIN_8X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_8; + break; + case ADI_SENSE_1000_ADC_GAIN_16X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_16; + break; + case ADI_SENSE_1000_ADC_GAIN_32X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_32; + break; + case ADI_SENSE_1000_ADC_GAIN_64X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_64; + break; + case ADI_SENSE_1000_ADC_GAIN_128X: + sensorDetailsReg.PGA_Gain = ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_128; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid ADC gain %d specified", + pAdcChannelConfig->gain); + return ADI_SENSE_INVALID_PARAM; + } + + if (pAdcChannelConfig->enableVbias) + sensorDetailsReg.Vbias = 1; + else + sensorDetailsReg.Vbias = 0; + + if (pAdcChannelConfig->reference.disableBuffer) + sensorDetailsReg.Reference_Buffer_Disable = 1; + else + sensorDetailsReg.Reference_Buffer_Disable = 0; + + if (pChannelConfig->disablePublishing) + sensorDetailsReg.Do_Not_Publish = 1; + else + sensorDetailsReg.Do_Not_Publish = 0; + + WRITE_REG_U32(hDevice, sensorDetailsReg.VALUE32, CORE_SENSOR_DETAILSn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelAdcFilter( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_ADC_FILTER_CONFIG *pFilterConfig) +{ + ADI_ADISENSE_CORE_Filter_Select_t filterSelectReg; + + filterSelectReg.VALUE32 = REG_RESET_VAL(CORE_FILTER_SELECTn); + + if (pFilterConfig->type == ADI_SENSE_1000_ADC_FILTER_SINC4) + { + filterSelectReg.ADC_Filter_Type = ADISENSE_CORE_FILTER_SELECT_FILTER_SINC4; + filterSelectReg.ADC_FS = pFilterConfig->fs; + } + else if (pFilterConfig->type == ADI_SENSE_1000_ADC_FILTER_FIR_20SPS) + { + filterSelectReg.ADC_Filter_Type = ADISENSE_CORE_FILTER_SELECT_FILTER_FIR_20SPS; + } + else if (pFilterConfig->type == ADI_SENSE_1000_ADC_FILTER_FIR_25SPS) + { + filterSelectReg.ADC_Filter_Type = ADISENSE_CORE_FILTER_SELECT_FILTER_FIR_25SPS; + } + else + { + ADI_SENSE_LOG_ERROR("Invalid ADC filter type %d specified", + pFilterConfig->type); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U32(hDevice, filterSelectReg.VALUE32, CORE_FILTER_SELECTn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelAdcCurrentConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_ADC_EXC_CURRENT_CONFIG *pCurrentConfig) +{ + ADI_ADISENSE_CORE_Channel_Excitation_t channelExcitationReg; + + channelExcitationReg.VALUE8 = REG_RESET_VAL(CORE_CHANNEL_EXCITATIONn); + + if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_NONE) + { + channelExcitationReg.IOUT0_Disable = 1; + channelExcitationReg.IOUT1_Disable = 1; + + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_OFF; + } + else + { + channelExcitationReg.IOUT0_Disable = 0; + channelExcitationReg.IOUT1_Disable = 0; + + if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_50uA) + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_50UA; + else if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_100uA) + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_100UA; + else if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_250uA) + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_250UA; + else if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_500uA) + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_500UA; + else if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_750uA) + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_750UA; + else if (pCurrentConfig->outputLevel == ADI_SENSE_1000_ADC_EXC_CURRENT_1000uA) + channelExcitationReg.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_1000UA; + else + { + ADI_SENSE_LOG_ERROR("Invalid ADC excitation current %d specified", + pCurrentConfig->outputLevel); + return ADI_SENSE_INVALID_PARAM; + } + + if (pCurrentConfig->swapOption == ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_DYNAMIC) + { + channelExcitationReg.IOUT_Dont_Swap_3Wire = 0; + channelExcitationReg.IOUT_Static_Swap_3Wire = 0; + } + else if (pCurrentConfig->swapOption == ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_STATIC) + { + channelExcitationReg.IOUT_Dont_Swap_3Wire = 1; + channelExcitationReg.IOUT_Static_Swap_3Wire = 1; + } + else if (pCurrentConfig->swapOption == ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_NONE) + { + channelExcitationReg.IOUT_Dont_Swap_3Wire = 1; + channelExcitationReg.IOUT_Static_Swap_3Wire = 0; + } + else + { + ADI_SENSE_LOG_ERROR( + "Invalid ADC excitation current swap option %d specified", + pCurrentConfig->swapOption); + return ADI_SENSE_INVALID_PARAM; + } + } + + WRITE_REG_U8(hDevice, channelExcitationReg.VALUE8, CORE_CHANNEL_EXCITATIONn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_SetAdcChannelConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_CHANNEL_CONFIG *pChannelConfig) +{ + ADI_SENSE_RESULT eRet; + ADI_SENSE_1000_ADC_CHANNEL_CONFIG *pAdcChannelConfig = + &pChannelConfig->adcChannelConfig; + + eRet = adi_sense_SetChannelAdcSensorType(hDevice, eChannelId, + pAdcChannelConfig->sensor); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set ADC sensor type for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetChannelAdcSensorDetails(hDevice, eChannelId, + pChannelConfig); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set ADC sensor details for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetChannelAdcFilter(hDevice, eChannelId, + &pAdcChannelConfig->filter); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set ADC filter for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetChannelAdcCurrentConfig(hDevice, eChannelId, + &pAdcChannelConfig->current); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set ADC current for channel %d", + eChannelId); + return eRet; + } + + return ADI_SENSE_SUCCESS; +} + + +static ADI_SENSE_RESULT adi_sense_SetDigitalSensorCommands( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_DIGITAL_SENSOR_COMMAND *pConfigCommand, + ADI_SENSE_1000_DIGITAL_SENSOR_COMMAND *pDataRequestCommand) +{ + ADI_ADISENSE_CORE_Digital_Sensor_Num_Cmds_t numCmdsReg; + + numCmdsReg.VALUE8 = REG_RESET_VAL(CORE_DIGITAL_SENSOR_NUM_CMDSn); + + CHECK_REG_FIELD_VAL(CORE_DIGITAL_SENSOR_NUM_CMDS_DIGITAL_SENSOR_NUM_CFG_CMDS, + pConfigCommand->commandLength); + CHECK_REG_FIELD_VAL(CORE_DIGITAL_SENSOR_NUM_CMDS_DIGITAL_SENSOR_NUM_READ_CMDS, + pDataRequestCommand->commandLength); + + numCmdsReg.Digital_Sensor_Num_Cfg_Cmds = pConfigCommand->commandLength; + numCmdsReg.Digital_Sensor_Num_Read_Cmds = pDataRequestCommand->commandLength; + + WRITE_REG_U8(hDevice, numCmdsReg.VALUE8, + CORE_DIGITAL_SENSOR_NUM_CMDSn(eChannelId)); + + switch (pConfigCommand->commandLength) + { + /* NOTE - intentional fall-through cases below */ + case 7: + WRITE_REG_U8(hDevice, pConfigCommand->command[6], + CORE_DIGITAL_SENSOR_COMMAND7n(eChannelId)); + case 6: + WRITE_REG_U8(hDevice, pConfigCommand->command[5], + CORE_DIGITAL_SENSOR_COMMAND6n(eChannelId)); + case 5: + WRITE_REG_U8(hDevice, pConfigCommand->command[4], + CORE_DIGITAL_SENSOR_COMMAND5n(eChannelId)); + case 4: + WRITE_REG_U8(hDevice, pConfigCommand->command[3], + CORE_DIGITAL_SENSOR_COMMAND4n(eChannelId)); + case 3: + WRITE_REG_U8(hDevice, pConfigCommand->command[2], + CORE_DIGITAL_SENSOR_COMMAND3n(eChannelId)); + case 2: + WRITE_REG_U8(hDevice, pConfigCommand->command[1], + CORE_DIGITAL_SENSOR_COMMAND2n(eChannelId)); + case 1: + WRITE_REG_U8(hDevice, pConfigCommand->command[0], + CORE_DIGITAL_SENSOR_COMMAND1n(eChannelId)); + case 0: + default: + break; + }; + + switch (pDataRequestCommand->commandLength) + { + /* NOTE - intentional fall-through cases below */ + case 7: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[6], + CORE_DIGITAL_SENSOR_READ_CMD7n(eChannelId)); + case 6: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[5], + CORE_DIGITAL_SENSOR_READ_CMD6n(eChannelId)); + case 5: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[4], + CORE_DIGITAL_SENSOR_READ_CMD5n(eChannelId)); + case 4: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[3], + CORE_DIGITAL_SENSOR_READ_CMD4n(eChannelId)); + case 3: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[2], + CORE_DIGITAL_SENSOR_READ_CMD3n(eChannelId)); + case 2: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[1], + CORE_DIGITAL_SENSOR_READ_CMD2n(eChannelId)); + case 1: + WRITE_REG_U8(hDevice, pDataRequestCommand->command[0], + CORE_DIGITAL_SENSOR_READ_CMD1n(eChannelId)); + case 0: + default: + break; + }; + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetDigitalSensorFormat( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_DIGITAL_SENSOR_DATA_FORMAT *pDataFormat) +{ + ADI_ADISENSE_CORE_Digital_Sensor_Config_t sensorConfigReg; + + sensorConfigReg.VALUE16 = REG_RESET_VAL(CORE_DIGITAL_SENSOR_CONFIGn); + + if (pDataFormat->coding != ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_NONE) + { + if (pDataFormat->frameLength == 0) + { + ADI_SENSE_LOG_ERROR("Invalid frame length specified for digital sensor data format"); + return ADI_SENSE_INVALID_PARAM; + } + if (pDataFormat->numDataBits == 0) + { + ADI_SENSE_LOG_ERROR("Invalid frame length specified for digital sensor data format"); + return ADI_SENSE_INVALID_PARAM; + } + + CHECK_REG_FIELD_VAL(CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_READ_BYTES, + pDataFormat->frameLength - 1); + CHECK_REG_FIELD_VAL(CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_DATA_BITS, + pDataFormat->numDataBits - 1); + CHECK_REG_FIELD_VAL(CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_BIT_OFFSET, + pDataFormat->bitOffset); + + sensorConfigReg.Digital_Sensor_Read_Bytes = pDataFormat->frameLength - 1; + sensorConfigReg.Digital_Sensor_Data_Bits = pDataFormat->numDataBits - 1; + sensorConfigReg.Digital_Sensor_Bit_Offset = pDataFormat->bitOffset; + sensorConfigReg.Digital_Sensor_LeftAligned = pDataFormat->leftJustified ? 1 : 0; + sensorConfigReg.Digital_Sensor_LittleEndian = pDataFormat->littleEndian ? 1 : 0; + + switch (pDataFormat->coding) + { + case ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_UNIPOLAR: + sensorConfigReg.Digital_Sensor_Coding = ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_UNIPOLAR; + break; + case ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_TWOS_COMPLEMENT: + sensorConfigReg.Digital_Sensor_Coding = ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_TWOS_COMPL; + break; + case ADI_SENSE_1000_DIGITAL_SENSOR_DATA_CODING_OFFSET_BINARY: + sensorConfigReg.Digital_Sensor_Coding = ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_OFFSET_BINARY; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid coding specified for digital sensor data format"); + return ADI_SENSE_INVALID_PARAM; + } + } + + WRITE_REG_U16(hDevice, sensorConfigReg.VALUE16, + CORE_DIGITAL_SENSOR_CONFIGn(eChannelId)); + + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelI2cSensorType( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_I2C_SENSOR_TYPE sensorType) +{ + ADI_ADISENSE_CORE_Sensor_Type_t sensorTypeReg; + + sensorTypeReg.VALUE16 = REG_RESET_VAL(CORE_SENSOR_TYPEn); + + /* Ensure that the sensor type is valid for this channel */ + switch(sensorType) + { + case ADI_SENSE_1000_I2C_SENSOR_HUMIDITY_HONEYWELL_HUMIDICON: + sensorTypeReg.Sensor_Type = ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_HUMIDITY_HONEYWELL_HUMIDICON; + break; + case ADI_SENSE_1000_I2C_SENSOR_HUMIDITY_SENSIRION_SHT3X: + sensorTypeReg.Sensor_Type = ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_HUMIDITY_SENSIRION_SHT3X; + break; + default: + ADI_SENSE_LOG_ERROR("Unsupported I2C sensor type %d specified", sensorType); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U16(hDevice, sensorTypeReg.VALUE16, CORE_SENSOR_TYPEn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelI2cSensorAddress( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + uint32_t deviceAddress) +{ + CHECK_REG_FIELD_VAL(CORE_DIGITAL_SENSOR_ADDRESS_DIGITAL_SENSOR_ADDRESS, deviceAddress); + WRITE_REG_U8(hDevice, deviceAddress, CORE_DIGITAL_SENSOR_ADDRESSn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_SetI2cChannelConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_I2C_CHANNEL_CONFIG *pI2cChannelConfig) +{ + ADI_SENSE_RESULT eRet; + + eRet = adi_sense_SetChannelI2cSensorType(hDevice, eChannelId, + pI2cChannelConfig->sensor); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set I2C sensor type for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetChannelI2cSensorAddress(hDevice, eChannelId, + pI2cChannelConfig->deviceAddress); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set I2C sensor address for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetDigitalSensorCommands(hDevice, eChannelId, + &pI2cChannelConfig->configurationCommand, + &pI2cChannelConfig->dataRequestCommand); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set I2C sensor commands for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetDigitalSensorFormat(hDevice, eChannelId, + &pI2cChannelConfig->dataFormat); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set I2C sensor data format for channel %d", + eChannelId); + return eRet; + } + + return ADI_SENSE_SUCCESS; +} + +static ADI_SENSE_RESULT adi_sense_SetChannelSpiSensorType( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_SPI_SENSOR_TYPE sensorType) +{ + ADI_ADISENSE_CORE_Sensor_Type_t sensorTypeReg; + + sensorTypeReg.VALUE16 = REG_RESET_VAL(CORE_SENSOR_TYPEn); + + /* Ensure that the sensor type is valid for this channel */ + switch(sensorType) + { + case ADI_SENSE_1000_SPI_SENSOR_PRESSURE_HONEYWELL_TRUSTABILITY: + sensorTypeReg.Sensor_Type = ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_PRESSURE_HONEYWELL_TRUSTABILITY; + break; + case ADI_SENSE_1000_SPI_SENSOR_ACCELEROMETER_ADI_ADXL362: + sensorTypeReg.Sensor_Type = ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_1; + break; + default: + ADI_SENSE_LOG_ERROR("Unsupported SPI sensor type %d specified", sensorType); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U16(hDevice, sensorTypeReg.VALUE16, CORE_SENSOR_TYPEn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_SetSpiChannelConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_SPI_CHANNEL_CONFIG *pSpiChannelConfig) +{ + ADI_SENSE_RESULT eRet; + + eRet = adi_sense_SetChannelSpiSensorType(hDevice, eChannelId, + pSpiChannelConfig->sensor); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set SPI sensor type for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetDigitalSensorCommands(hDevice, eChannelId, + &pSpiChannelConfig->configurationCommand, + &pSpiChannelConfig->dataRequestCommand); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set SPI sensor commands for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_SetDigitalSensorFormat(hDevice, eChannelId, + &pSpiChannelConfig->dataFormat); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set SPI sensor data format for channel %d", + eChannelId); + return eRet; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetChannelThresholdLimits( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + float32_t fHighThresholdLimit, + float32_t fLowThresholdLimit) +{ + /* + * If the low/high limits are *both* set to 0 in memory, or NaNs, assume + * that they are unset, or not required, and use infinity defaults instead + */ + if (fHighThresholdLimit == 0.0 && fLowThresholdLimit == 0.0) + { + fHighThresholdLimit = INFINITY; + fLowThresholdLimit = -INFINITY; + } + else + { + if (isnan(fHighThresholdLimit)) + fHighThresholdLimit = INFINITY; + if (isnan(fLowThresholdLimit)) + fLowThresholdLimit = -INFINITY; + } + + WRITE_REG_FLOAT(hDevice, fHighThresholdLimit, + CORE_HIGH_THRESHOLD_LIMITn(eChannelId)); + WRITE_REG_FLOAT(hDevice, fLowThresholdLimit, + CORE_LOW_THRESHOLD_LIMITn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetOffsetGain( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + float32_t fOffsetAdjustment, + float32_t fGainAdjustment) +{ + /* Replace with default values if NaNs are specified (or 0.0 for gain) */ + if (isnan(fGainAdjustment) || (fGainAdjustment == 0.0)) + fGainAdjustment = 1.0; + if (isnan(fOffsetAdjustment)) + fOffsetAdjustment = 0.0; + + WRITE_REG_FLOAT(hDevice, fGainAdjustment, CORE_SENSOR_GAINn(eChannelId)); + WRITE_REG_FLOAT(hDevice, fOffsetAdjustment, CORE_SENSOR_OFFSETn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetChannelSettlingTime( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + uint32_t nSettlingTime) +{ + CHECK_REG_FIELD_VAL(CORE_SETTLING_TIME_SETTLING_TIME, nSettlingTime); + + WRITE_REG_U16(hDevice, nSettlingTime, CORE_SETTLING_TIMEn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetChannelConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_CHANNEL_CONFIG *pChannelConfig) +{ + ADI_SENSE_RESULT eRet; + + if (! ADI_SENSE_1000_CHANNEL_IS_VIRTUAL(eChannelId)) + { + /* If the channel is not enabled, disable it and return */ + if (! pChannelConfig->enableChannel) + return adi_sense_1000_SetChannelCount(hDevice, eChannelId, 0); + + eRet = adi_sense_1000_SetChannelCount(hDevice, eChannelId, + pChannelConfig->measurementsPerCycle); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set measurement count for channel %d", + eChannelId); + return eRet; + } + + switch (eChannelId) + { + case ADI_SENSE_1000_CHANNEL_ID_CJC_0: + case ADI_SENSE_1000_CHANNEL_ID_CJC_1: + case ADI_SENSE_1000_CHANNEL_ID_SENSOR_0: + case ADI_SENSE_1000_CHANNEL_ID_SENSOR_1: + case ADI_SENSE_1000_CHANNEL_ID_SENSOR_2: + case ADI_SENSE_1000_CHANNEL_ID_SENSOR_3: + case ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0: + case ADI_SENSE_1000_CHANNEL_ID_CURRENT_0: + eRet = adi_sense_SetAdcChannelConfig(hDevice, eChannelId, pChannelConfig); + break; + case ADI_SENSE_1000_CHANNEL_ID_I2C_0: + case ADI_SENSE_1000_CHANNEL_ID_I2C_1: + eRet = adi_sense_SetI2cChannelConfig(hDevice, eChannelId, + &pChannelConfig->i2cChannelConfig); + break; + case ADI_SENSE_1000_CHANNEL_ID_SPI_0: + eRet = adi_sense_SetSpiChannelConfig(hDevice, eChannelId, + &pChannelConfig->spiChannelConfig); + break; + default: + ADI_SENSE_LOG_ERROR("Invalid channel ID %d specified", eChannelId); + return ADI_SENSE_INVALID_PARAM; + } + + eRet = adi_sense_1000_SetChannelSettlingTime(hDevice, eChannelId, + pChannelConfig->extraSettlingTime); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set settling time for channel %d", + eChannelId); + return eRet; + } + } + + if (pChannelConfig->enableChannel) + { + /* Threshold limits can be configured individually for virtual channels */ + eRet = adi_sense_1000_SetChannelThresholdLimits(hDevice, eChannelId, + pChannelConfig->highThreshold, + pChannelConfig->lowThreshold); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set threshold limits for channel %d", + eChannelId); + return eRet; + } + + /* Offset and gain can be configured individually for virtual channels */ + eRet = adi_sense_1000_SetOffsetGain(hDevice, eChannelId, + pChannelConfig->offsetAdjustment, + pChannelConfig->gainAdjustment); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set offset/gain for channel %d", + eChannelId); + return eRet; + } + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_SetConfig( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_CONFIG * const pConfig) +{ + ADI_SENSE_1000_CONFIG *pDeviceConfig; + ADI_SENSE_PRODUCT_ID productId; + ADI_SENSE_RESULT eRet; + + if (pConfig->productId != ADI_SENSE_PRODUCT_ID_1000) + { + ADI_SENSE_LOG_ERROR("Configuration Product ID (0x%X) is not supported (0x%0X)", + pConfig->productId, ADI_SENSE_PRODUCT_ID_1000); + return ADI_SENSE_INVALID_PARAM; + } + + /* Check that the actual Product ID is a match? */ + eRet = adi_sense_GetProductID(hDevice, &productId); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to read device Product ID register"); + return eRet; + } + if (pConfig->productId != productId) + { + ADI_SENSE_LOG_ERROR("Configuration Product ID (0x%X) does not match device (0x%0X)", + pConfig->productId, productId); + return ADI_SENSE_INVALID_PARAM; + } + + pDeviceConfig = &pConfig->adisense1000; + + eRet = adi_sense_1000_SetPowerConfig(hDevice, &pDeviceConfig->power); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to set power configuration"); + return eRet; + } + + eRet = adi_sense_1000_SetMeasurementConfig(hDevice, &pDeviceConfig->measurement); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to set measurement configuration"); + return eRet; + } + + eRet = adi_sense_1000_SetDiagnosticsConfig(hDevice, &pDeviceConfig->diagnostics); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to set diagnostics configuration"); + return eRet; + } + + for (ADI_SENSE_1000_CHANNEL_ID id = 0; id < ADI_SENSE_1000_MAX_CHANNELS; id++) + { + eRet = adi_sense_1000_SetChannelConfig(hDevice, id, + &pDeviceConfig->channels[id]); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to set channel %d configuration", id); + return eRet; + } + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetLutData( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_1000_LUT * const pLutData) +{ + ADI_SENSE_1000_LUT_HEADER *pLutHeader = &pLutData->header; + ADI_SENSE_1000_LUT_TABLE *pLutTable = pLutData->tables; + unsigned actualLength = 0; + + if (pLutData->header.signature != ADI_SENSE_LUT_SIGNATURE) + { + ADI_SENSE_LOG_ERROR("LUT signature incorrect (expected 0x%X, actual 0x%X)", + ADI_SENSE_LUT_SIGNATURE, pLutHeader->signature); + return ADI_SENSE_INVALID_SIGNATURE; + } + + for (unsigned i = 0; i < pLutHeader->numTables; i++) + { + ADI_SENSE_1000_LUT_DESCRIPTOR *pDesc = &pLutTable->descriptor; + ADI_SENSE_1000_LUT_TABLE_DATA *pData = &pLutTable->data; + unsigned short calculatedCrc; + + switch (pDesc->geometry) + { + case ADI_SENSE_1000_LUT_GEOMETRY_COEFFS: + switch (pDesc->equation) + { + case ADI_SENSE_1000_LUT_EQUATION_POLYN: + case ADI_SENSE_1000_LUT_EQUATION_POLYNEXP: + case ADI_SENSE_1000_LUT_EQUATION_QUADRATIC: + case ADI_SENSE_1000_LUT_EQUATION_STEINHART: + case ADI_SENSE_1000_LUT_EQUATION_LOGARITHMIC: + case ADI_SENSE_1000_LUT_EQUATION_EXPONENTIAL: + case ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN: + break; + default: + ADI_SENSE_LOG_ERROR("Invalid equation %u specified for LUT table %u", + pDesc->equation, i); + return ADI_SENSE_INVALID_PARAM; + } + break; + case ADI_SENSE_1000_LUT_GEOMETRY_NES_1D: + case ADI_SENSE_1000_LUT_GEOMETRY_NES_2D: + case ADI_SENSE_1000_LUT_GEOMETRY_ES_1D: + case ADI_SENSE_1000_LUT_GEOMETRY_ES_2D: + if (pDesc->equation != ADI_SENSE_1000_LUT_EQUATION_LUT) { + ADI_SENSE_LOG_ERROR("Invalid equation %u specified for LUT table %u", + pDesc->equation, i); + return ADI_SENSE_INVALID_PARAM; + } + break; + default: + ADI_SENSE_LOG_ERROR("Invalid geometry %u specified for LUT table %u", + pDesc->geometry, i); + return ADI_SENSE_INVALID_PARAM; + } + + switch (pDesc->dataType) + { + case ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32: + case ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT64: + break; + default: + ADI_SENSE_LOG_ERROR("Invalid vector format %u specified for LUT table %u", + pDesc->dataType, i); + return ADI_SENSE_INVALID_PARAM; + } + + calculatedCrc = crc16_ccitt(pData, pDesc->length); + if (calculatedCrc != pDesc->crc16) + { + ADI_SENSE_LOG_ERROR("CRC validation failed on LUT table %u (expected 0x%04X, actual 0x%04X)", + i, pDesc->crc16, calculatedCrc); + return ADI_SENSE_CRC_ERROR; + } + + actualLength += sizeof(*pDesc) + pDesc->length; + + /* Move to the next look-up table */ + pLutTable = (ADI_SENSE_1000_LUT_TABLE *)((uint8_t *)pLutTable + sizeof(*pDesc) + pDesc->length); + } + + if (actualLength != pLutHeader->totalLength) + { + ADI_SENSE_LOG_ERROR("LUT table length mismatch (expected %u, actual %u)", + pLutHeader->totalLength, actualLength); + return ADI_SENSE_WRONG_SIZE; + } + + if (sizeof(*pLutHeader) + pLutHeader->totalLength > ADI_SENSE_LUT_MAX_SIZE) + { + ADI_SENSE_LOG_ERROR("Maximum LUT table length (%u bytes) exceeded", + ADI_SENSE_LUT_MAX_SIZE); + return ADI_SENSE_WRONG_SIZE; + } + + /* Write the LUT data to the device */ + unsigned lutSize = sizeof(*pLutHeader) + pLutHeader->totalLength; + WRITE_REG_U16(hDevice, 0, CORE_LUT_OFFSET); + WRITE_REG_U8_ARRAY(hDevice, (uint8_t *)pLutData, lutSize, CORE_LUT_DATA); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetLutDataRaw( + ADI_SENSE_DEVICE_HANDLE const hDevice, + ADI_SENSE_1000_LUT_RAW * const pLutData) +{ + return adi_sense_1000_SetLutData(hDevice, + (ADI_SENSE_1000_LUT * const)pLutData); +} + +static ADI_SENSE_RESULT getLutTableSize( + ADI_SENSE_1000_LUT_DESCRIPTOR * const pDesc, + ADI_SENSE_1000_LUT_TABLE_DATA * const pData, + unsigned *pLength) +{ + switch (pDesc->geometry) + { + case ADI_SENSE_1000_LUT_GEOMETRY_COEFFS: + if (pDesc->equation == ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN) + *pLength = ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_SIZE(pData->coeffList2d); + else + *pLength = ADI_SENSE_1000_LUT_COEFF_LIST_SIZE(pData->coeffList); + break; + case ADI_SENSE_1000_LUT_GEOMETRY_NES_1D: + *pLength = ADI_SENSE_1000_LUT_1D_NES_SIZE(pData->lut1dNes); + break; + case ADI_SENSE_1000_LUT_GEOMETRY_NES_2D: + *pLength = ADI_SENSE_1000_LUT_2D_NES_SIZE(pData->lut2dNes); + break; + case ADI_SENSE_1000_LUT_GEOMETRY_ES_1D: + *pLength = ADI_SENSE_1000_LUT_1D_ES_SIZE(pData->lut1dEs); + break; + case ADI_SENSE_1000_LUT_GEOMETRY_ES_2D: + *pLength = ADI_SENSE_1000_LUT_2D_ES_SIZE(pData->lut2dEs); + break; + default: + ADI_SENSE_LOG_ERROR("Invalid LUT table geometry %d specified\r\n", + pDesc->geometry); + return ADI_SENSE_INVALID_PARAM; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_AssembleLutData( + ADI_SENSE_1000_LUT * pLutBuffer, + unsigned nLutBufferSize, + unsigned const nNumTables, + ADI_SENSE_1000_LUT_DESCRIPTOR * const ppDesc[], + ADI_SENSE_1000_LUT_TABLE_DATA * const ppData[]) +{ + ADI_SENSE_1000_LUT_HEADER *pHdr = &pLutBuffer->header; + uint8_t *pLutTableData = (uint8_t *)pLutBuffer + sizeof(*pHdr); + + if (sizeof(*pHdr) > nLutBufferSize) + { + ADI_SENSE_LOG_ERROR("Insufficient LUT buffer size provided"); + return ADI_SENSE_INVALID_PARAM; + } + + /* First initialise the top-level header */ + pHdr->signature = ADI_SENSE_LUT_SIGNATURE; + pHdr->version.major = 1; + pHdr->version.minor = 0; + pHdr->numTables = 0; + pHdr->totalLength = 0; + + /* + * Walk through the list of table pointers provided, appending the table + * descriptor+data from each one to the provided LUT buffer + */ + for (unsigned i = 0; i < nNumTables; i++) + { + ADI_SENSE_1000_LUT_DESCRIPTOR * const pDesc = ppDesc[i]; + ADI_SENSE_1000_LUT_TABLE_DATA * const pData = ppData[i]; + ADI_SENSE_RESULT res; + unsigned dataLength = 0; + + /* Calculate the length of the table data */ + res = getLutTableSize(pDesc, pData, &dataLength); + if (res != ADI_SENSE_SUCCESS) + return res; + + /* Fill in the table descriptor length and CRC fields */ + pDesc->length = dataLength; + pDesc->crc16 = crc16_ccitt(pData, dataLength); + + if ((sizeof(*pHdr) + pHdr->totalLength + sizeof(*pDesc) + dataLength) > nLutBufferSize) + { + ADI_SENSE_LOG_ERROR("Insufficient LUT buffer size provided"); + return ADI_SENSE_INVALID_PARAM; + } + + /* Append the table to the LUT buffer (desc + data) */ + memcpy(pLutTableData + pHdr->totalLength, pDesc, sizeof(*pDesc)); + pHdr->totalLength += sizeof(*pDesc); + memcpy(pLutTableData + pHdr->totalLength, pData, dataLength); + pHdr->totalLength += dataLength; + + pHdr->numTables++; + } + + return ADI_SENSE_SUCCESS; +} + +#define CAL_TABLE_ROWS ADI_SENSE_1000_CAL_NUM_TABLES +#define CAL_TABLE_COLS ADI_SENSE_1000_CAL_NUM_TEMPS +#define CAL_TABLE_SIZE (sizeof(float) * CAL_TABLE_ROWS * CAL_TABLE_COLS) + +ADI_SENSE_RESULT adi_sense_1000_ReadCalTable( + ADI_SENSE_DEVICE_HANDLE hDevice, + float *pfBuffer, + unsigned nMaxLen, + unsigned *pnDataLen, + unsigned *pnRows, + unsigned *pnColumns) +{ + *pnDataLen = sizeof(float) * CAL_TABLE_ROWS * CAL_TABLE_COLS; + *pnRows = CAL_TABLE_ROWS; + *pnColumns = CAL_TABLE_COLS; + + if (nMaxLen > *pnDataLen) + nMaxLen = *pnDataLen; + + WRITE_REG_U16(hDevice, 0, CORE_CAL_OFFSET); + READ_REG_U8_ARRAY(hDevice, (uint8_t *)pfBuffer, nMaxLen, CORE_CAL_DATA); + + return ADI_SENSE_SUCCESS; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/adi_sense_1000/ADISENSE1000_REGISTERS.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,1733 @@ +/* ================================================================================ + + Created by : sherry + Created on : 2017 Nov 14, 10:55 GMT + + Project : ADISENSE1000_REGISTERS + File : ADISENSE1000_REGISTERS.h + Description : Register Definitions + + !! ADI Confidential !! + INTERNAL USE ONLY + + Copyright (c) 2017 Analog Devices, Inc. All Rights Reserved. + This software is proprietary and confidential to Analog Devices, Inc. and + its licensors. + + This file was auto-generated. Do not make local changes to this file. + + Auto generation script information: + Script: /usr/cadtools/bin/yoda.dir/generators/inc/genHeaders + Last modified: 26-SEP-2017 + + ================================================================================ */ + +#ifndef _DEF_ADISENSE1000_REGISTERS_H +#define _DEF_ADISENSE1000_REGISTERS_H + +#if defined(_LANGUAGE_C) || (defined(__GNUC__) && !defined(__ASSEMBLER__)) +#include <stdint.h> +#endif /* _LANGUAGE_C */ + +#ifndef __ADI_GENERATED_DEF_HEADERS__ +#define __ADI_GENERATED_DEF_HEADERS__ 1 +#endif + +#define __ADI_HAS_ADISENSE_CORE__ 1 +#define __ADI_HAS_ADISENSE_SPI__ 1 +#define __ADI_HAS_ADISENSE_TEST__ 1 + +/* ============================================================================================================================ + + ============================================================================================================================ */ + +/* ============================================================================================================================ + ADISENSE_SPI + ============================================================================================================================ */ +#define MOD_ADISENSE_SPI_BASE 0x00000000 /* */ +#define MOD_ADISENSE_SPI_MASK 0x00007FFF /* */ +#define REG_ADISENSE_SPI_INTERFACE_CONFIG_A_RESET 0x00000030 /* Reset Value for Interface_Config_A */ +#define REG_ADISENSE_SPI_INTERFACE_CONFIG_A 0x00000000 /* ADISENSE_SPI Interface Configuration A */ +#define REG_ADISENSE_SPI_INTERFACE_CONFIG_B_RESET 0x00000000 /* Reset Value for Interface_Config_B */ +#define REG_ADISENSE_SPI_INTERFACE_CONFIG_B 0x00000001 /* ADISENSE_SPI Interface Configuration B */ +#define REG_ADISENSE_SPI_DEVICE_CONFIG_RESET 0x00000000 /* Reset Value for Device_Config */ +#define REG_ADISENSE_SPI_DEVICE_CONFIG 0x00000002 /* ADISENSE_SPI Device Configuration */ +#define REG_ADISENSE_SPI_CHIP_TYPE_RESET 0x00000007 /* Reset Value for Chip_Type */ +#define REG_ADISENSE_SPI_CHIP_TYPE 0x00000003 /* ADISENSE_SPI Chip Type */ +#define REG_ADISENSE_SPI_PRODUCT_ID_L_RESET 0x00000020 /* Reset Value for Product_ID_L */ +#define REG_ADISENSE_SPI_PRODUCT_ID_L 0x00000004 /* ADISENSE_SPI Product ID Low */ +#define REG_ADISENSE_SPI_PRODUCT_ID_H_RESET 0x00000000 /* Reset Value for Product_ID_H */ +#define REG_ADISENSE_SPI_PRODUCT_ID_H 0x00000005 /* ADISENSE_SPI Product ID High */ +#define REG_ADISENSE_SPI_CHIP_GRADE_RESET 0x00000000 /* Reset Value for Chip_Grade */ +#define REG_ADISENSE_SPI_CHIP_GRADE 0x00000006 /* ADISENSE_SPI Chip Grade */ +#define REG_ADISENSE_SPI_SCRATCH_PAD_RESET 0x00000000 /* Reset Value for Scratch_Pad */ +#define REG_ADISENSE_SPI_SCRATCH_PAD 0x0000000A /* ADISENSE_SPI Scratch Pad */ +#define REG_ADISENSE_SPI_SPI_REVISION_RESET 0x00000082 /* Reset Value for SPI_Revision */ +#define REG_ADISENSE_SPI_SPI_REVISION 0x0000000B /* ADISENSE_SPI SPI Revision */ +#define REG_ADISENSE_SPI_VENDOR_L_RESET 0x00000056 /* Reset Value for Vendor_L */ +#define REG_ADISENSE_SPI_VENDOR_L 0x0000000C /* ADISENSE_SPI Vendor ID Low */ +#define REG_ADISENSE_SPI_VENDOR_H_RESET 0x00000004 /* Reset Value for Vendor_H */ +#define REG_ADISENSE_SPI_VENDOR_H 0x0000000D /* ADISENSE_SPI Vendor ID High */ +#define REG_ADISENSE_SPI_STREAM_MODE_RESET 0x00000000 /* Reset Value for Stream_Mode */ +#define REG_ADISENSE_SPI_STREAM_MODE 0x0000000E /* ADISENSE_SPI Stream Mode */ +#define REG_ADISENSE_SPI_TRANSFER_CONFIG_RESET 0x00000000 /* Reset Value for Transfer_Config */ +#define REG_ADISENSE_SPI_TRANSFER_CONFIG 0x0000000F /* ADISENSE_SPI Transfer Config */ +#define REG_ADISENSE_SPI_INTERFACE_CONFIG_C_RESET 0x00000033 /* Reset Value for Interface_Config_C */ +#define REG_ADISENSE_SPI_INTERFACE_CONFIG_C 0x00000010 /* ADISENSE_SPI Interface Configuration C */ +#define REG_ADISENSE_SPI_INTERFACE_STATUS_A_RESET 0x00000000 /* Reset Value for Interface_Status_A */ +#define REG_ADISENSE_SPI_INTERFACE_STATUS_A 0x00000011 /* ADISENSE_SPI Interface Status A */ + +/* ============================================================================================================================ + ADISENSE_SPI Register BitMasks, Positions & Enumerations + ============================================================================================================================ */ +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_INTERFACE_CONFIG_A Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_A_SW_RESET 7 /* First of Two of SW_RESET Bits. */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_A_ADDR_ASCENSION 5 /* Determines Sequential Addressing Behavior */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_A_SDO_ENABLE 4 /* SDO Pin Enable */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_A_SW_RESETX 0 /* Second of Two of SW_RESET Bits. */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_A_SW_RESET 0x00000080 /* First of Two of SW_RESET Bits. */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_A_ADDR_ASCENSION 0x00000020 /* Determines Sequential Addressing Behavior */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_A_SDO_ENABLE 0x00000010 /* SDO Pin Enable */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_A_SW_RESETX 0x00000001 /* Second of Two of SW_RESET Bits. */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_A_DESCEND 0x00000000 /* Addr_Ascension: Address accessed is decremented by one for each data byte when streaming */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_A_ASCEND 0x00000020 /* Addr_Ascension: Address accessed is incremented by one for each data byte when streaming */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_INTERFACE_CONFIG_B Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_B_SINGLE_INST 7 /* Select Streaming or Single Instruction Mode */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_B_SINGLE_INST 0x00000080 /* Select Streaming or Single Instruction Mode */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_B_STREAMING_MODE 0x00000000 /* Single_Inst: Streaming mode is enabled */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_B_SINGLE_INSTRUCTION_MODE 0x00000080 /* Single_Inst: Single Instruction mode is enabled */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_DEVICE_CONFIG Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_DEVICE_CONFIG_OPERATING_MODES 0 /* Power Modes */ +#define BITM_ADISENSE_SPI_DEVICE_CONFIG_OPERATING_MODES 0x00000003 /* Power Modes */ +#define ENUM_ADISENSE_SPI_DEVICE_CONFIG_NORMAL 0x00000000 /* Operating_Modes: Normal Operating Mode */ +#define ENUM_ADISENSE_SPI_DEVICE_CONFIG_SLEEP 0x00000003 /* Operating_Modes: Low Power Mode */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_CHIP_TYPE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_CHIP_TYPE_CHIP_TYPE 0 /* Precision ADC */ +#define BITM_ADISENSE_SPI_CHIP_TYPE_CHIP_TYPE 0x0000000F /* Precision ADC */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_PRODUCT_ID_L Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_PRODUCT_ID_L_PRODUCT_ID_FIXED_BITS 4 /* These Bits are Fixed on Die Configured for Multiple Generics */ +#define BITP_ADISENSE_SPI_PRODUCT_ID_L_PRODUCT_ID_TRIM_BITS 0 /* These Bits Vary on Die Configured for Multiple Generics */ +#define BITM_ADISENSE_SPI_PRODUCT_ID_L_PRODUCT_ID_FIXED_BITS 0x000000F0 /* These Bits are Fixed on Die Configured for Multiple Generics */ +#define BITM_ADISENSE_SPI_PRODUCT_ID_L_PRODUCT_ID_TRIM_BITS 0x0000000F /* These Bits Vary on Die Configured for Multiple Generics */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_PRODUCT_ID_H Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_PRODUCT_ID_H_PRODUCT_ID_FIXED_BITS 0 /* These Bits are Fixed on Die Configured for Multiple Generics */ +#define BITM_ADISENSE_SPI_PRODUCT_ID_H_PRODUCT_ID_FIXED_BITS 0x000000FF /* These Bits are Fixed on Die Configured for Multiple Generics */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_CHIP_GRADE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_CHIP_GRADE_GRADE 4 /* This is the Device Performance Grade */ +#define BITP_ADISENSE_SPI_CHIP_GRADE_DEVICE_REVISION 0 /* This is the Device Hardware Revision */ +#define BITM_ADISENSE_SPI_CHIP_GRADE_GRADE 0x000000F0 /* This is the Device Performance Grade */ +#define BITM_ADISENSE_SPI_CHIP_GRADE_DEVICE_REVISION 0x0000000F /* This is the Device Hardware Revision */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_SCRATCH_PAD Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_SCRATCH_PAD_SCRATCH_VALUE 0 /* Software Scratchpad */ +#define BITM_ADISENSE_SPI_SCRATCH_PAD_SCRATCH_VALUE 0x000000FF /* Software Scratchpad */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_SPI_REVISION Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_SPI_REVISION_SPI_TYPE 6 /* Always Reads as 0x2 */ +#define BITP_ADISENSE_SPI_SPI_REVISION_VERSION 0 /* SPI Version */ +#define BITM_ADISENSE_SPI_SPI_REVISION_SPI_TYPE 0x000000C0 /* Always Reads as 0x2 */ +#define BITM_ADISENSE_SPI_SPI_REVISION_VERSION 0x0000003F /* SPI Version */ +#define ENUM_ADISENSE_SPI_SPI_REVISION_ADI_SPI 0x00000000 +#define ENUM_ADISENSE_SPI_SPI_REVISION_LPT_SPI 0x00000080 +#define ENUM_ADISENSE_SPI_SPI_REVISION_REV1_0 0x00000002 /* Version: Revision 1.0 */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_VENDOR_L Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_VENDOR_L_VID 0 /* Analog Devices Vendor ID */ +#define BITM_ADISENSE_SPI_VENDOR_L_VID 0x000000FF /* Analog Devices Vendor ID */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_VENDOR_H Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_VENDOR_H_VID 0 /* Analog Devices Vendor ID */ +#define BITM_ADISENSE_SPI_VENDOR_H_VID 0x000000FF /* Analog Devices Vendor ID */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_STREAM_MODE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_STREAM_MODE_LOOP_COUNT 0 /* Sets the Data Byte Count Before Looping to Start Address */ +#define BITM_ADISENSE_SPI_STREAM_MODE_LOOP_COUNT 0x000000FF /* Sets the Data Byte Count Before Looping to Start Address */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_TRANSFER_CONFIG Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_TRANSFER_CONFIG_STREAM_MODE 1 /* When Streaming, Controls Master-Slave Transfer */ +#define BITM_ADISENSE_SPI_TRANSFER_CONFIG_STREAM_MODE 0x00000002 /* When Streaming, Controls Master-Slave Transfer */ +#define ENUM_ADISENSE_SPI_TRANSFER_CONFIG_UPDATE_ON_WRITE 0x00000000 /* Stream_Mode: Transfers after each byte/mulit-byte register */ +#define ENUM_ADISENSE_SPI_TRANSFER_CONFIG_UPDATE_ON_ADDRESS_LOOP 0x00000002 /* Stream_Mode: Transfers when address loops */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_INTERFACE_CONFIG_C Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_C_CRC_ENABLE 6 /* CRC Enable */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_C_STRICT_REGISTER_ACCESS 5 /* Multi-byte Registers Must Be Read/Written in Full */ +#define BITP_ADISENSE_SPI_INTERFACE_CONFIG_C_CRC_ENABLEB 0 /* Inverted CRC Enable */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_C_CRC_ENABLE 0x000000C0 /* CRC Enable */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_C_STRICT_REGISTER_ACCESS 0x00000020 /* Multi-byte Registers Must Be Read/Written in Full */ +#define BITM_ADISENSE_SPI_INTERFACE_CONFIG_C_CRC_ENABLEB 0x00000003 /* Inverted CRC Enable */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_C_DISABLED 0x00000000 /* CRC_Enable: CRC Disabled */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_C_ENABLED 0x00000040 /* CRC_Enable: CRC Enabled */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_C_NORMAL_ACCESS 0x00000000 /* Strict_Register_Access: Normal mode, no access restrictions */ +#define ENUM_ADISENSE_SPI_INTERFACE_CONFIG_C_STRICT_ACCESS 0x00000020 /* Strict_Register_Access: Strict mode, multi-byte registers require all bytes read/written */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_SPI_INTERFACE_STATUS_A Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_SPI_INTERFACE_STATUS_A_NOT_READY_ERROR 7 /* Device Not Ready for Transaction */ +#define BITP_ADISENSE_SPI_INTERFACE_STATUS_A_CLOCK_COUNT_ERROR 4 /* Incorrect Number of Clocks Detected in a Transaction */ +#define BITP_ADISENSE_SPI_INTERFACE_STATUS_A_CRC_ERROR 3 /* Invalid/No CRC Received */ +#define BITP_ADISENSE_SPI_INTERFACE_STATUS_A_WR_TO_RD_ONLY_REG_ERROR 2 /* Write to Read-Only Register Attempted */ +#define BITP_ADISENSE_SPI_INTERFACE_STATUS_A_REGISTER_PARTIAL_ACCESS_ERROR 1 /* Set When Fewer Than Expected Number of Bytes Read/Written */ +#define BITP_ADISENSE_SPI_INTERFACE_STATUS_A_ADDRESS_INVALID_ERROR 0 /* Attempt to Read/Write Non-existent Register Address */ +#define BITM_ADISENSE_SPI_INTERFACE_STATUS_A_NOT_READY_ERROR 0x00000080 /* Device Not Ready for Transaction */ +#define BITM_ADISENSE_SPI_INTERFACE_STATUS_A_CLOCK_COUNT_ERROR 0x00000010 /* Incorrect Number of Clocks Detected in a Transaction */ +#define BITM_ADISENSE_SPI_INTERFACE_STATUS_A_CRC_ERROR 0x00000008 /* Invalid/No CRC Received */ +#define BITM_ADISENSE_SPI_INTERFACE_STATUS_A_WR_TO_RD_ONLY_REG_ERROR 0x00000004 /* Write to Read-Only Register Attempted */ +#define BITM_ADISENSE_SPI_INTERFACE_STATUS_A_REGISTER_PARTIAL_ACCESS_ERROR 0x00000002 /* Set When Fewer Than Expected Number of Bytes Read/Written */ +#define BITM_ADISENSE_SPI_INTERFACE_STATUS_A_ADDRESS_INVALID_ERROR 0x00000001 /* Attempt to Read/Write Non-existent Register Address */ + + +/* ============================================================================================================================ + ADISENSE1000 Core Registers + ============================================================================================================================ */ + +/* ============================================================================================================================ + ADISENSE_CORE + ============================================================================================================================ */ +#define MOD_ADISENSE_CORE_BASE 0x00000010 /* ADISENSE1000 Core Registers */ +#define MOD_ADISENSE_CORE_MASK 0x00007FFF /* ADISENSE1000 Core Registers */ +#define REG_ADISENSE_CORE_COMMAND_RESET 0x00000000 /* Reset Value for Command */ +#define REG_ADISENSE_CORE_COMMAND 0x00000014 /* ADISENSE_CORE Special Command */ +#define REG_ADISENSE_CORE_MODE_RESET 0x00000000 /* Reset Value for Mode */ +#define REG_ADISENSE_CORE_MODE 0x00000016 /* ADISENSE_CORE Operating Mode and DRDY Control */ +#define REG_ADISENSE_CORE_POWER_CONFIG_RESET 0x00000000 /* Reset Value for Power_Config */ +#define REG_ADISENSE_CORE_POWER_CONFIG 0x00000017 /* ADISENSE_CORE General Configuration */ +#define REG_ADISENSE_CORE_CYCLE_CONTROL_RESET 0x00000000 /* Reset Value for Cycle_Control */ +#define REG_ADISENSE_CORE_CYCLE_CONTROL 0x00000018 /* ADISENSE_CORE Measurement Cycle */ +#define REG_ADISENSE_CORE_FIFO_NUM_CYCLES_RESET 0x00000001 /* Reset Value for Fifo_Num_Cycles */ +#define REG_ADISENSE_CORE_FIFO_NUM_CYCLES 0x0000001A /* ADISENSE_CORE Number of Measurement Cycles to Store in FIFO */ +#define REG_ADISENSE_CORE_MULTI_CYCLE_REPEAT_INTERVAL_RESET 0x00000000 /* Reset Value for Multi_Cycle_Repeat_Interval */ +#define REG_ADISENSE_CORE_MULTI_CYCLE_REPEAT_INTERVAL 0x0000001C /* ADISENSE_CORE Time Between Repeats of Multi-Cycle Conversions.... */ +#define REG_ADISENSE_CORE_STATUS_RESET 0x00000000 /* Reset Value for Status */ +#define REG_ADISENSE_CORE_STATUS 0x00000020 /* ADISENSE_CORE General Status */ +#define REG_ADISENSE_CORE_DIAGNOSTICS_STATUS_RESET 0x00000000 /* Reset Value for Diagnostics_Status */ +#define REG_ADISENSE_CORE_DIAGNOSTICS_STATUS 0x00000024 /* ADISENSE_CORE Diagnostics Status */ +#define REG_ADISENSE_CORE_CHANNEL_ALERT_STATUS_RESET 0x00000000 /* Reset Value for Channel_Alert_Status */ +#define REG_ADISENSE_CORE_CHANNEL_ALERT_STATUS 0x00000026 /* ADISENSE_CORE Alert Status Summary */ +#define REG_ADISENSE_CORE_ALERT_STATUS_2_RESET 0x00000000 /* Reset Value for Alert_Status_2 */ +#define REG_ADISENSE_CORE_ALERT_STATUS_2 0x00000028 /* ADISENSE_CORE Additional Alert Status Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CHn_RESET 0x00000000 /* Reset Value for Alert_Detail_Ch[n] */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH0 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH1 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH2 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH3 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH4 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH5 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH6 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH7 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH8 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH9 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH10 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH11 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH12 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH0 0x0000002A /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH1 0x0000002C /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH2 0x0000002E /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH3 0x00000030 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH4 0x00000032 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH5 0x00000034 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH6 0x00000036 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH7 0x00000038 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH8 0x0000003A /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH9 0x0000003C /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH10 0x0000003E /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH11 0x00000040 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH12 0x00000042 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CHn(i) (REG_ADISENSE_CORE_ALERT_DETAIL_CH0 + ((i) * 2)) +#define REG_ADISENSE_CORE_ALERT_DETAIL_CHn_COUNT 13 +#define REG_ADISENSE_CORE_ERROR_CODE_RESET 0x00000000 /* Reset Value for Error_Code */ +#define REG_ADISENSE_CORE_ERROR_CODE 0x0000004C /* ADISENSE_CORE Code Indicating Source of Error */ +#define REG_ADISENSE_CORE_ALERT_CODE_RESET 0x00000000 /* Reset Value for Alert_Code */ +#define REG_ADISENSE_CORE_ALERT_CODE 0x0000004E /* ADISENSE_CORE Code Indicating Source of Alert */ +#define REG_ADISENSE_CORE_EXTERNAL_REFERENCE1_RESET 0x00000000 /* Reset Value for External_Reference1 */ +#define REG_ADISENSE_CORE_EXTERNAL_REFERENCE1 0x00000050 /* ADISENSE_CORE External Reference Information */ +#define REG_ADISENSE_CORE_EXTERNAL_REFERENCE2_RESET 0x00000000 /* Reset Value for External_Reference2 */ +#define REG_ADISENSE_CORE_EXTERNAL_REFERENCE2 0x00000054 /* ADISENSE_CORE External Reference Information */ +#define REG_ADISENSE_CORE_AVDD_VOLTAGE_RESET 0x40533333 /* Reset Value for AVDD_Voltage */ +#define REG_ADISENSE_CORE_AVDD_VOLTAGE 0x00000058 /* ADISENSE_CORE AVDD Voltage */ +#define REG_ADISENSE_CORE_DIAGNOSTICS_CONTROL_RESET 0x00000000 /* Reset Value for Diagnostics_Control */ +#define REG_ADISENSE_CORE_DIAGNOSTICS_CONTROL 0x0000005C /* ADISENSE_CORE Diagnostic Control */ +#define REG_ADISENSE_CORE_DATA_FIFO_RESET 0x00000000 /* Reset Value for Data_FIFO */ +#define REG_ADISENSE_CORE_DATA_FIFO 0x00000060 /* ADISENSE_CORE FIFO of Sensor Results */ +#define REG_ADISENSE_CORE_LUT_SELECT_RESET 0x00000000 /* Reset Value for LUT_Select */ +#define REG_ADISENSE_CORE_LUT_SELECT 0x00000070 /* ADISENSE_CORE Read/Write Strobe */ +#define REG_ADISENSE_CORE_LUT_OFFSET_RESET 0x00000000 /* Reset Value for LUT_Offset */ +#define REG_ADISENSE_CORE_LUT_OFFSET 0x00000072 /* ADISENSE_CORE Offset into Selected LUT */ +#define REG_ADISENSE_CORE_LUT_DATA_RESET 0x00000000 /* Reset Value for LUT_Data */ +#define REG_ADISENSE_CORE_LUT_DATA 0x00000074 /* ADISENSE_CORE Data to Read/Write from Addressed LUT Entry */ +#define REG_ADISENSE_CORE_CAL_OFFSET_RESET 0x00000000 /* Reset Value for CAL_Offset */ +#define REG_ADISENSE_CORE_CAL_OFFSET 0x0000007A /* ADISENSE_CORE Offset into Selected Calibration Values */ +#define REG_ADISENSE_CORE_CAL_DATA_RESET 0x00000000 /* Reset Value for CAL_Data */ +#define REG_ADISENSE_CORE_CAL_DATA 0x0000007C /* ADISENSE_CORE Data to Read/Write from Addressed Calibration Values */ +#define REG_ADISENSE_CORE_REVISION_RESET 0x00000000 /* Reset Value for Revision */ +#define REG_ADISENSE_CORE_REVISION 0x0000008C /* ADISENSE_CORE Hardware, Firmware Revision */ +#define REG_ADISENSE_CORE_CHANNEL_COUNTn_RESET 0x00000000 /* Reset Value for Channel_Count[n] */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT0 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT1 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT2 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT3 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT4 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT5 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT6 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT7 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT8 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT9 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT10 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT0 0x00000090 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT1 0x000000D0 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT2 0x00000110 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT3 0x00000150 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT4 0x00000190 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT5 0x000001D0 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT6 0x00000210 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT7 0x00000250 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT8 0x00000290 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT9 0x000002D0 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT10 0x00000310 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNTn(i) (REG_ADISENSE_CORE_CHANNEL_COUNT0 + ((i) * 64)) +#define REG_ADISENSE_CORE_CHANNEL_COUNTn_COUNT 11 +#define REG_ADISENSE_CORE_SENSOR_TYPEn_RESET 0x00000000 /* Reset Value for Sensor_Type[n] */ +#define REG_ADISENSE_CORE_SENSOR_TYPE0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE0 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE1 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE2 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE3 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE4 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE5 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE6 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE7 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE8 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE9 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE10 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE0 0x00000092 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE1 0x000000D2 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE2 0x00000112 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE3 0x00000152 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE4 0x00000192 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE5 0x000001D2 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE6 0x00000212 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE7 0x00000252 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE8 0x00000292 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE9 0x000002D2 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE10 0x00000312 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPEn(i) (REG_ADISENSE_CORE_SENSOR_TYPE0 + ((i) * 64)) +#define REG_ADISENSE_CORE_SENSOR_TYPEn_COUNT 11 +#define REG_ADISENSE_CORE_SENSOR_DETAILSn_RESET 0x0000FFF0 /* Reset Value for Sensor_Details[n] */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS0_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS0 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS1_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS1 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS2_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS2 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS3_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS3 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS4_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS4 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS5_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS5 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS6_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS6 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS7_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS7 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS8_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS8 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS9_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS9 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS10_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS10 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS0 0x00000094 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS1 0x000000D4 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS2 0x00000114 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS3 0x00000154 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS4 0x00000194 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS5 0x000001D4 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS6 0x00000214 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS7 0x00000254 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS8 0x00000294 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS9 0x000002D4 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS10 0x00000314 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILSn(i) (REG_ADISENSE_CORE_SENSOR_DETAILS0 + ((i) * 64)) +#define REG_ADISENSE_CORE_SENSOR_DETAILSn_COUNT 11 +#define REG_ADISENSE_CORE_CHANNEL_EXCITATIONn_RESET 0x00000000 /* Reset Value for Channel_Excitation[n] */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION0 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION1 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION2 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION3 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION4 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION5 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION6 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION7 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION8 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION9 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION10 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION0 0x00000098 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION1 0x000000D8 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION2 0x00000118 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION3 0x00000158 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION4 0x00000198 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION5 0x000001D8 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION6 0x00000218 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION7 0x00000258 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION8 0x00000298 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION9 0x000002D8 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION10 0x00000318 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATIONn(i) (REG_ADISENSE_CORE_CHANNEL_EXCITATION0 + ((i) * 64)) +#define REG_ADISENSE_CORE_CHANNEL_EXCITATIONn_COUNT 11 +#define REG_ADISENSE_CORE_SETTLING_TIMEn_RESET 0x00000000 /* Reset Value for Settling_Time[n] */ +#define REG_ADISENSE_CORE_SETTLING_TIME0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME0 */ +#define REG_ADISENSE_CORE_SETTLING_TIME1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME1 */ +#define REG_ADISENSE_CORE_SETTLING_TIME2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME2 */ +#define REG_ADISENSE_CORE_SETTLING_TIME3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME3 */ +#define REG_ADISENSE_CORE_SETTLING_TIME4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME4 */ +#define REG_ADISENSE_CORE_SETTLING_TIME5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME5 */ +#define REG_ADISENSE_CORE_SETTLING_TIME6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME6 */ +#define REG_ADISENSE_CORE_SETTLING_TIME7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME7 */ +#define REG_ADISENSE_CORE_SETTLING_TIME8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME8 */ +#define REG_ADISENSE_CORE_SETTLING_TIME9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME9 */ +#define REG_ADISENSE_CORE_SETTLING_TIME10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME10 */ +#define REG_ADISENSE_CORE_SETTLING_TIME0 0x0000009A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME1 0x000000DA /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME2 0x0000011A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME3 0x0000015A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME4 0x0000019A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME5 0x000001DA /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME6 0x0000021A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME7 0x0000025A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME8 0x0000029A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME9 0x000002DA /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME10 0x0000031A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIMEn(i) (REG_ADISENSE_CORE_SETTLING_TIME0 + ((i) * 64)) +#define REG_ADISENSE_CORE_SETTLING_TIMEn_COUNT 11 +#define REG_ADISENSE_CORE_FILTER_SELECTn_RESET 0x00000000 /* Reset Value for Filter_Select[n] */ +#define REG_ADISENSE_CORE_FILTER_SELECT0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT0 */ +#define REG_ADISENSE_CORE_FILTER_SELECT1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT1 */ +#define REG_ADISENSE_CORE_FILTER_SELECT2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT2 */ +#define REG_ADISENSE_CORE_FILTER_SELECT3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT3 */ +#define REG_ADISENSE_CORE_FILTER_SELECT4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT4 */ +#define REG_ADISENSE_CORE_FILTER_SELECT5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT5 */ +#define REG_ADISENSE_CORE_FILTER_SELECT6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT6 */ +#define REG_ADISENSE_CORE_FILTER_SELECT7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT7 */ +#define REG_ADISENSE_CORE_FILTER_SELECT8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT8 */ +#define REG_ADISENSE_CORE_FILTER_SELECT9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT9 */ +#define REG_ADISENSE_CORE_FILTER_SELECT10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT10 */ +#define REG_ADISENSE_CORE_FILTER_SELECT0 0x0000009C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT1 0x000000DC /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT2 0x0000011C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT3 0x0000015C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT4 0x0000019C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT5 0x000001DC /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT6 0x0000021C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT7 0x0000025C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT8 0x0000029C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT9 0x000002DC /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT10 0x0000031C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECTn(i) (REG_ADISENSE_CORE_FILTER_SELECT0 + ((i) * 64)) +#define REG_ADISENSE_CORE_FILTER_SELECTn_COUNT 11 +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMITn_RESET 0x7F800000 /* Reset Value for High_Threshold_Limit[n] */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT0_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT0 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT1_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT1 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT2_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT2 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT3_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT3 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT4_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT4 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT5_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT5 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT6_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT6 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT7_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT7 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT8_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT8 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT9_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT9 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT10_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT10 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT11_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT11 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT12_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT12 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT0 0x000000A0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT1 0x000000E0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT2 0x00000120 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT3 0x00000160 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT4 0x000001A0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT5 0x000001E0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT6 0x00000220 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT7 0x00000260 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT8 0x000002A0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT9 0x000002E0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT10 0x00000320 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT11 0x00000360 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT12 0x000003A0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMITn(i) (REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT0 + ((i) * 64)) +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMITn_COUNT 13 +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMITn_RESET 0xFF800000 /* Reset Value for Low_Threshold_Limit[n] */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT0_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT0 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT1_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT1 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT2_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT2 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT3_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT3 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT4_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT4 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT5_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT5 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT6_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT6 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT7_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT7 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT8_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT8 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT9_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT9 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT10_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT10 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT11_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT11 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT12_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT12 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT0 0x000000A4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT1 0x000000E4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT2 0x00000124 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT3 0x00000164 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT4 0x000001A4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT5 0x000001E4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT6 0x00000224 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT7 0x00000264 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT8 0x000002A4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT9 0x000002E4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT10 0x00000324 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT11 0x00000364 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT12 0x000003A4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMITn(i) (REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT0 + ((i) * 64)) +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMITn_COUNT 13 +#define REG_ADISENSE_CORE_SENSOR_OFFSETn_RESET 0x00000000 /* Reset Value for Sensor_Offset[n] */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET0 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET1 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET2 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET3 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET4 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET5 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET6 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET7 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET8 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET9 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET10 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET11 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET12 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET0 0x000000A8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET1 0x000000E8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET2 0x00000128 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET3 0x00000168 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET4 0x000001A8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET5 0x000001E8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET6 0x00000228 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET7 0x00000268 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET8 0x000002A8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET9 0x000002E8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET10 0x00000328 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET11 0x00000368 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET12 0x000003A8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSETn(i) (REG_ADISENSE_CORE_SENSOR_OFFSET0 + ((i) * 64)) +#define REG_ADISENSE_CORE_SENSOR_OFFSETn_COUNT 13 +#define REG_ADISENSE_CORE_SENSOR_GAINn_RESET 0x3F800000 /* Reset Value for Sensor_Gain[n] */ +#define REG_ADISENSE_CORE_SENSOR_GAIN0_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN0 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN1_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN1 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN2_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN2 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN3_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN3 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN4_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN4 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN5_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN5 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN6_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN6 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN7_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN7 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN8_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN8 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN9_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN9 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN10_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN10 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN11_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN11 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN12_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN12 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN0 0x000000AC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN1 0x000000EC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN2 0x0000012C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN3 0x0000016C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN4 0x000001AC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN5 0x000001EC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN6 0x0000022C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN7 0x0000026C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN8 0x000002AC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN9 0x000002EC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN10 0x0000032C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN11 0x0000036C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN12 0x000003AC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAINn(i) (REG_ADISENSE_CORE_SENSOR_GAIN0 + ((i) * 64)) +#define REG_ADISENSE_CORE_SENSOR_GAINn_COUNT 13 +#define REG_ADISENSE_CORE_ALERT_CODE_CHn_RESET 0x00000000 /* Reset Value for Alert_Code_Ch[n] */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH0 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH1 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH2 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH3 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH4 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH5 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH6 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH7 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH8 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH9 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH10 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH11 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH12 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH0 0x000000B0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH1 0x000000F0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH2 0x00000130 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH3 0x00000170 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH4 0x000001B0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH5 0x000001F0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH6 0x00000230 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH7 0x00000270 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH8 0x000002B0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH9 0x000002F0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH10 0x00000330 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH11 0x00000370 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH12 0x000003B0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CHn(i) (REG_ADISENSE_CORE_ALERT_CODE_CH0 + ((i) * 64)) +#define REG_ADISENSE_CORE_ALERT_CODE_CHn_COUNT 13 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIGn_RESET 0x00000000 /* Reset Value for Digital_Sensor_Config[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG0 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG8 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG9 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG10 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG0 0x000000B8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG1 0x000000F8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG2 0x00000138 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG3 0x00000178 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG4 0x000001B8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG5 0x000001F8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG6 0x00000238 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG7 0x00000278 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG8 0x000002B8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG9 0x000002F8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG10 0x00000338 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIGn(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG0 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIGn_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESSn_RESET 0x00000000 /* Reset Value for Digital_Sensor_Address[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS0 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS8 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS9 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS10 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS0 0x000000BA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS1 0x000000FA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS2 0x0000013A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS3 0x0000017A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS4 0x000001BA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS5 0x000001FA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS6 0x0000023A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS7 0x0000027A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS8 0x000002BA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS9 0x000002FA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS10 0x0000033A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESSn(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS0 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESSn_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDSn_RESET 0x00000000 /* Reset Value for Digital_Sensor_Num_Cmds[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS0 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS8 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS9 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS10 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS0 0x000000BB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS1 0x000000FB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS2 0x0000013B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS3 0x0000017B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS4 0x000001BB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS5 0x000001FB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS6 0x0000023B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS7 0x0000027B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS8 0x000002BB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS9 0x000002FB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS10 0x0000033B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDSn(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS0 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDSn_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND1n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command1[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND10 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND11 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND12 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND13 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND14 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND15 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND16_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND16 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND17_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND17 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND18_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND18 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND19_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND19 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND110_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND110 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND10 0x000000C0 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND11 0x00000100 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND12 0x00000140 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND13 0x00000180 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND14 0x000001C0 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND15 0x00000200 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND16 0x00000240 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND17 0x00000280 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND18 0x000002C0 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND19 0x00000300 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND110 0x00000340 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND1n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND10 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND1n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND2n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command2[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND20_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND20 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND21_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND21 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND22_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND22 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND23_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND23 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND24_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND24 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND25_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND25 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND26_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND26 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND27_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND27 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND28_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND28 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND29_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND29 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND210_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND210 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND20 0x000000C1 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND21 0x00000101 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND22 0x00000141 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND23 0x00000181 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND24 0x000001C1 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND25 0x00000201 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND26 0x00000241 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND27 0x00000281 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND28 0x000002C1 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND29 0x00000301 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND210 0x00000341 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND2n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND20 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND2n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND3n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command3[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND30_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND30 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND31_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND31 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND32_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND32 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND33_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND33 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND34_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND34 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND35_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND35 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND36_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND36 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND37_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND37 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND38_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND38 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND39_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND39 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND310_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND310 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND30 0x000000C2 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND31 0x00000102 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND32 0x00000142 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND33 0x00000182 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND34 0x000001C2 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND35 0x00000202 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND36 0x00000242 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND37 0x00000282 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND38 0x000002C2 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND39 0x00000302 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND310 0x00000342 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND3n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND30 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND3n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND4n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command4[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND40_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND40 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND41_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND41 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND42_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND42 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND43_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND43 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND44_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND44 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND45_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND45 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND46_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND46 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND47_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND47 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND48_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND48 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND49_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND49 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND410_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND410 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND40 0x000000C3 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND41 0x00000103 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND42 0x00000143 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND43 0x00000183 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND44 0x000001C3 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND45 0x00000203 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND46 0x00000243 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND47 0x00000283 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND48 0x000002C3 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND49 0x00000303 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND410 0x00000343 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND4n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND40 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND4n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND5n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command5[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND50_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND50 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND51_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND51 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND52_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND52 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND53_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND53 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND54_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND54 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND55_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND55 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND56_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND56 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND57_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND57 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND58_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND58 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND59_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND59 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND510_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND510 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND50 0x000000C4 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND51 0x00000104 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND52 0x00000144 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND53 0x00000184 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND54 0x000001C4 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND55 0x00000204 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND56 0x00000244 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND57 0x00000284 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND58 0x000002C4 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND59 0x00000304 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND510 0x00000344 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND5n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND50 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND5n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND6n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command6[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND60_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND60 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND61_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND61 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND62_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND62 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND63_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND63 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND64_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND64 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND65_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND65 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND66_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND66 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND67_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND67 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND68_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND68 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND69_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND69 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND610_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND610 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND60 0x000000C5 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND61 0x00000105 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND62 0x00000145 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND63 0x00000185 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND64 0x000001C5 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND65 0x00000205 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND66 0x00000245 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND67 0x00000285 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND68 0x000002C5 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND69 0x00000305 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND610 0x00000345 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND6n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND60 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND6n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND7n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Command7[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND70_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND70 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND71_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND71 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND72_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND72 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND73_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND73 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND74_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND74 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND75_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND75 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND76_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND76 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND77_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND77 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND78_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND78 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND79_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND79 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND710_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND710 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND70 0x000000C6 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND71 0x00000106 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND72 0x00000146 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND73 0x00000186 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND74 0x000001C6 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND75 0x00000206 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND76 0x00000246 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND77 0x00000286 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND78 0x000002C6 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND79 0x00000306 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND710 0x00000346 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND7n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND70 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND7n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD1n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd1[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD10 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD11 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD12 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD13 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD14 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD15 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD16_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD16 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD17_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD17 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD18_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD18 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD19_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD19 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD110_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD110 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD10 0x000000C8 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD11 0x00000108 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD12 0x00000148 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD13 0x00000188 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD14 0x000001C8 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD15 0x00000208 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD16 0x00000248 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD17 0x00000288 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD18 0x000002C8 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD19 0x00000308 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD110 0x00000348 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD1n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD10 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD1n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD2n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd2[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD20_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD20 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD21_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD21 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD22_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD22 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD23_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD23 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD24_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD24 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD25_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD25 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD26_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD26 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD27_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD27 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD28_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD28 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD29_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD29 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD210_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD210 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD20 0x000000C9 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD21 0x00000109 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD22 0x00000149 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD23 0x00000189 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD24 0x000001C9 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD25 0x00000209 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD26 0x00000249 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD27 0x00000289 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD28 0x000002C9 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD29 0x00000309 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD210 0x00000349 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD2n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD20 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD2n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD3n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd3[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD30_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD30 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD31_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD31 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD32_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD32 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD33_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD33 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD34_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD34 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD35_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD35 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD36_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD36 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD37_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD37 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD38_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD38 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD39_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD39 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD310_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD310 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD30 0x000000CA /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD31 0x0000010A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD32 0x0000014A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD33 0x0000018A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD34 0x000001CA /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD35 0x0000020A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD36 0x0000024A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD37 0x0000028A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD38 0x000002CA /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD39 0x0000030A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD310 0x0000034A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD3n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD30 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD3n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD4n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd4[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD40_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD40 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD41_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD41 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD42_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD42 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD43_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD43 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD44_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD44 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD45_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD45 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD46_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD46 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD47_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD47 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD48_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD48 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD49_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD49 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD410_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD410 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD40 0x000000CB /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD41 0x0000010B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD42 0x0000014B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD43 0x0000018B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD44 0x000001CB /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD45 0x0000020B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD46 0x0000024B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD47 0x0000028B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD48 0x000002CB /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD49 0x0000030B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD410 0x0000034B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD4n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD40 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD4n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD5n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd5[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD50_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD50 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD51_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD51 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD52_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD52 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD53_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD53 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD54_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD54 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD55_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD55 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD56_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD56 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD57_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD57 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD58_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD58 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD59_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD59 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD510_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD510 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD50 0x000000CC /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD51 0x0000010C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD52 0x0000014C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD53 0x0000018C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD54 0x000001CC /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD55 0x0000020C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD56 0x0000024C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD57 0x0000028C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD58 0x000002CC /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD59 0x0000030C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD510 0x0000034C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD5n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD50 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD5n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD6n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd6[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD60_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD60 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD61_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD61 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD62_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD62 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD63_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD63 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD64_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD64 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD65_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD65 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD66_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD66 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD67_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD67 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD68_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD68 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD69_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD69 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD610_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD610 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD60 0x000000CD /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD61 0x0000010D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD62 0x0000014D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD63 0x0000018D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD64 0x000001CD /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD65 0x0000020D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD66 0x0000024D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD67 0x0000028D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD68 0x000002CD /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD69 0x0000030D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD610 0x0000034D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD6n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD60 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD6n_COUNT 11 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7n_RESET 0x00000000 /* Reset Value for Digital_Sensor_Read_Cmd7[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD70_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD70 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD71_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD71 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD72_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD72 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD73_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD73 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD74_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD74 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD75_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD75 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD76_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD76 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD77_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD77 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD78_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD78 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD79_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD79 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD710_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD710 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD70 0x000000CE /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD71 0x0000010E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD72 0x0000014E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD73 0x0000018E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD74 0x000001CE /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD75 0x0000020E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD76 0x0000024E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD77 0x0000028E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD78 0x000002CE /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD79 0x0000030E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD710 0x0000034E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7n(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD70 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7n_COUNT 11 + +/* ============================================================================================================================ + ADISENSE_CORE Register BitMasks, Positions & Enumerations + ============================================================================================================================ */ +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_COMMAND Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_COMMAND_SPECIAL_COMMAND 0 /* Special Command */ +#define BITM_ADISENSE_CORE_COMMAND_SPECIAL_COMMAND 0x000000FF /* Special Command */ +#define ENUM_ADISENSE_CORE_COMMAND_NOP 0x00000000 /* Special_Command: No Command */ +#define ENUM_ADISENSE_CORE_COMMAND_CONVERT 0x00000001 /* Special_Command: Start ADC Conversions */ +#define ENUM_ADISENSE_CORE_COMMAND_CONVERT_WITH_RAW 0x00000002 /* Special_Command: Start Conversions with Added RAW ADC Data */ +#define ENUM_ADISENSE_CORE_COMMAND_RUN_DIAGNOSTICS 0x00000003 /* Special_Command: Initiate a Diagnostics Cycle */ +#define ENUM_ADISENSE_CORE_COMMAND_SELF_CALIBRATION 0x00000004 /* Special_Command: Initiate a Self-Calibration Cycle */ +#define ENUM_ADISENSE_CORE_COMMAND_LOAD_CONFIG 0x00000005 /* Special_Command: Load Registers with Configuration from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_CONFIG 0x00000006 /* Special_Command: Store Current Register Configuration to FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_LATCH_CONFIG 0x00000007 /* Special_Command: Latch Configuration. */ +#define ENUM_ADISENSE_CORE_COMMAND_LOAD_LUT 0x00000008 /* Special_Command: Load LUT from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_LUT2 0x00000009 /* Special_Command: Save LUT to FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SYSTEM_CHECK 0x0000000A /* Special_Command: Full Suite of Measurement Diagnostics */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_MODE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_MODE_DRDY_MODE 2 /* Indicates Behavior of DRDY with Respect to FIFO State */ +#define BITP_ADISENSE_CORE_MODE_CONVERSION_MODE 0 /* Conversion Mode */ +#define BITM_ADISENSE_CORE_MODE_DRDY_MODE 0x0000000C /* Indicates Behavior of DRDY with Respect to FIFO State */ +#define BITM_ADISENSE_CORE_MODE_CONVERSION_MODE 0x00000003 /* Conversion Mode */ +#define ENUM_ADISENSE_CORE_MODE_DRDY_PER_CONVERSION 0x00000000 /* Drdy_Mode: Data Ready Per Conversion */ +#define ENUM_ADISENSE_CORE_MODE_DRDY_PER_CYCLE 0x00000004 /* Drdy_Mode: Data Ready Per Cycle */ +#define ENUM_ADISENSE_CORE_MODE_DRDY_PER_FIFO_FILL 0x00000008 /* Drdy_Mode: Data Ready Per FIFO Fill */ +#define ENUM_ADISENSE_CORE_MODE_DRDY_MODE3 0x0000000C /* Drdy_Mode: Undefined */ +#define ENUM_ADISENSE_CORE_MODE_SINGLECYCLE 0x00000000 /* Conversion_Mode: Single Cycle */ +#define ENUM_ADISENSE_CORE_MODE_MULTICYCLE 0x00000001 /* Conversion_Mode: Multi Cycle */ +#define ENUM_ADISENSE_CORE_MODE_CONTINUOUS 0x00000002 /* Conversion_Mode: Continuous Conversion */ +#define ENUM_ADISENSE_CORE_MODE_MODE3 0x00000003 /* Conversion_Mode: Undefined */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_POWER_CONFIG Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_POWER_CONFIG_STDBY_EN 4 /* Standby */ +#define BITP_ADISENSE_CORE_POWER_CONFIG_POWER_MODE_MCU 2 /* MCU Power Mode */ +#define BITP_ADISENSE_CORE_POWER_CONFIG_POWER_MODE_ADC 0 /* ADC Power Mode */ +#define BITM_ADISENSE_CORE_POWER_CONFIG_STDBY_EN 0x00000010 /* Standby */ +#define BITM_ADISENSE_CORE_POWER_CONFIG_POWER_MODE_MCU 0x0000000C /* MCU Power Mode */ +#define BITM_ADISENSE_CORE_POWER_CONFIG_POWER_MODE_ADC 0x00000003 /* ADC Power Mode */ +#define ENUM_ADISENSE_CORE_POWER_CONFIG_ADC_LOW_POWER 0x00000000 /* Power_Mode_ADC: ADC Low Power Mode */ +#define ENUM_ADISENSE_CORE_POWER_CONFIG_ADC_MID_POWER 0x00000001 /* Power_Mode_ADC: ADC Mid Power Mode */ +#define ENUM_ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER 0x00000002 /* Power_Mode_ADC: ADC Full Power Mode */ +#define ENUM_ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER2 0x00000003 /* Power_Mode_ADC: ADC Full Power Mode2 */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CYCLE_CONTROL Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TIME_UNITS 14 /* Units for Cycle Time */ +#define BITP_ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TIME 0 /* Duration of a Full Measurement Cycle */ +#define BITM_ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TIME_UNITS 0x0000C000 /* Units for Cycle Time */ +#define BITM_ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TIME 0x00000FFF /* Duration of a Full Measurement Cycle */ +#define ENUM_ADISENSE_CORE_CYCLE_CONTROL_MICROSECONDS 0x00000000 /* Cycle_Time_Units: Micro-Seconds */ +#define ENUM_ADISENSE_CORE_CYCLE_CONTROL_MILLISECONDS 0x00004000 /* Cycle_Time_Units: Milli-Seconds */ +#define ENUM_ADISENSE_CORE_CYCLE_CONTROL_SECONDS 0x00008000 /* Cycle_Time_Units: Seconds */ +#define ENUM_ADISENSE_CORE_CYCLE_CONTROL_UNDEFINED 0x0000C000 /* Cycle_Time_Units: Undefined */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_FIFO_NUM_CYCLES Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_FIFO_NUM_CYCLES_FIFO_NUM_CYCLES 0 /* How Many Cycles to Fill FIFO */ +#define BITM_ADISENSE_CORE_FIFO_NUM_CYCLES_FIFO_NUM_CYCLES 0x000000FF /* How Many Cycles to Fill FIFO */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_MULTI_CYCLE_REPEAT_INTERVAL Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_MULTI_CYCLE_REPEAT_INTERVAL_MULTI_CYCLE_REPEAT_INTERVAL 0 /* Defines Time Between Repetitions of Measurement Cycles. */ +#define BITM_ADISENSE_CORE_MULTI_CYCLE_REPEAT_INTERVAL_MULTI_CYCLE_REPEAT_INTERVAL 0x00FFFFFF /* Defines Time Between Repetitions of Measurement Cycles. */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_STATUS Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_STATUS_FIFO_ERROR 5 /* Indicates Error with FIFO */ +#define BITP_ADISENSE_CORE_STATUS_CMD_RUNNING 4 /* Indicates a Special Command is Active */ +#define BITP_ADISENSE_CORE_STATUS_DRDY 3 /* Indicates a New Sensor Result is Available to Be Read */ +#define BITP_ADISENSE_CORE_STATUS_ERROR 2 /* Indicates an Error */ +#define BITP_ADISENSE_CORE_STATUS_ALERT_ACTIVE 1 /* Indicates One or More Sensors Alerts are Active */ +#define BITM_ADISENSE_CORE_STATUS_FIFO_ERROR 0x00000020 /* Indicates Error with FIFO */ +#define BITM_ADISENSE_CORE_STATUS_CMD_RUNNING 0x00000010 /* Indicates a Special Command is Active */ +#define BITM_ADISENSE_CORE_STATUS_DRDY 0x00000008 /* Indicates a New Sensor Result is Available to Be Read */ +#define BITM_ADISENSE_CORE_STATUS_ERROR 0x00000004 /* Indicates an Error */ +#define BITM_ADISENSE_CORE_STATUS_ALERT_ACTIVE 0x00000002 /* Indicates One or More Sensors Alerts are Active */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIAGNOSTICS_STATUS Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAGNOSTICS_STATUS_SUNDRY 14 /* Sundry Diagnostics Status */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_CALIBRATION_ERROR 13 /* Indicates Error During Internal Device Calibrations */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_CONVERSION_ERROR 12 /* Indicates Error During Internal ADC Conversions */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINP_OV_ERROR 11 /* Indicates Over-Voltage Error on Positive Analog Input */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINP_UV_ERROR 10 /* Indicates Under-Voltage Error on Positive Analog Input */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINM_OV_ERROR 9 /* Indicates Over-Voltage Error on Negative Analog Input */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINM_UV_ERROR 8 /* Indicates Under-Voltage Error on Negative Analog Input */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_SUPPLY_CAP_ERROR 3 /* Indicates Fault on Internal Supply Regulator Capacitor */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_SUPPLY_MONITOR_ERROR 2 /* Indicates Low Voltage on Internal Supply Voltages */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_COMMS_ERROR 1 /* Indicates Error on Internal Device Communications */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_CHECKSUM_ERROR 0 /* Indicates Error on Internal Checksum Calculations */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAGNOSTICS_STATUS_SUNDRY 0x0000C000 /* Sundry Diagnostics Status */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_CALIBRATION_ERROR 0x00002000 /* Indicates Error During Internal Device Calibrations */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_CONVERSION_ERROR 0x00001000 /* Indicates Error During Internal ADC Conversions */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINP_OV_ERROR 0x00000800 /* Indicates Over-Voltage Error on Positive Analog Input */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINP_UV_ERROR 0x00000400 /* Indicates Under-Voltage Error on Positive Analog Input */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINM_OV_ERROR 0x00000200 /* Indicates Over-Voltage Error on Negative Analog Input */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_AINM_UV_ERROR 0x00000100 /* Indicates Under-Voltage Error on Negative Analog Input */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_SUPPLY_CAP_ERROR 0x00000008 /* Indicates Fault on Internal Supply Regulator Capacitor */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_SUPPLY_MONITOR_ERROR 0x00000004 /* Indicates Low Voltage on Internal Supply Voltages */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_COMMS_ERROR 0x00000002 /* Indicates Error on Internal Device Communications */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_STATUS_DIAG_CHECKSUM_ERROR 0x00000001 /* Indicates Error on Internal Checksum Calculations */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CHANNEL_ALERT_STATUS Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH12 12 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH11 11 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH10 10 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH9 9 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH8 8 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH7 7 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH6 6 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH5 5 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH4 4 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH3 3 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH2 2 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH1 1 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH0 0 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH12 0x00001000 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH11 0x00000800 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH10 0x00000400 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH9 0x00000200 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH8 0x00000100 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH7 0x00000080 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH6 0x00000040 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH5 0x00000020 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH4 0x00000010 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH3 0x00000008 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH2 0x00000004 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH1 0x00000002 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH0 0x00000001 /* Indicates Channel Alert is Active */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_ALERT_STATUS_2 Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_ALERT_STATUS_2_CONFIGURATION_ERROR 2 /* Indicates Error with Programmed Configuration */ +#define BITP_ADISENSE_CORE_ALERT_STATUS_2_LUT_ERROR 1 /* Indicates Error with One or More Look-Up-Tables */ +#define BITM_ADISENSE_CORE_ALERT_STATUS_2_CONFIGURATION_ERROR 0x00000004 /* Indicates Error with Programmed Configuration */ +#define BITM_ADISENSE_CORE_ALERT_STATUS_2_LUT_ERROR 0x00000002 /* Indicates Error with One or More Look-Up-Tables */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_ALERT_DETAIL_CH[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_COMP_NOT_READY 15 /* Indicates Compensation Channel Not Ready When Required */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_SENSOR_NOT_READY 14 /* Indicates Digital Sensor Not Ready When Read */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_CORRECTION_OVERRANGE 13 /* Indicates Result Larger Than LUT/Equation Range */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_CORRECTION_UNDERRANGE 12 /* Indicates Result Less Than LUT/Equation Range */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_OVER_VOLTAGE 11 /* Indicates Channel Over-Voltage */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_UNDER_VOLTAGE 10 /* Indicates Channel Under-Voltage */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_LUT_ERROR_CH 9 /* Indicates Error with Channel Look-Up-Table */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_CONFIG_ERR 8 /* Indicates Configuration Error on Channel */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_REF_DETECT 6 /* Indicates Whether ADC Reference is Valid */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_SENSOR_OPEN 5 /* Indicates Sensor Input is Open Circuit */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_HIGH_LIMIT 4 /* Indicates Sensor Result is Greater Than High Limit */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_LOW_LIMIT 3 /* Indicates Sensor Result is Less Than Low Limit */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_OVER_RANGE 2 /* Indicates Channel Over-Range */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_UNDER_RANGE 1 /* Indicates Channel Under-Range */ +#define BITP_ADISENSE_CORE_ALERT_DETAIL_CH_TIME_OUT 0 /* Indicates Time-Out Error from Digital Sensor */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_COMP_NOT_READY 0x00008000 /* Indicates Compensation Channel Not Ready When Required */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_SENSOR_NOT_READY 0x00004000 /* Indicates Digital Sensor Not Ready When Read */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_CORRECTION_OVERRANGE 0x00002000 /* Indicates Result Larger Than LUT/Equation Range */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_CORRECTION_UNDERRANGE 0x00001000 /* Indicates Result Less Than LUT/Equation Range */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_OVER_VOLTAGE 0x00000800 /* Indicates Channel Over-Voltage */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_UNDER_VOLTAGE 0x00000400 /* Indicates Channel Under-Voltage */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_LUT_ERROR_CH 0x00000200 /* Indicates Error with Channel Look-Up-Table */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_CONFIG_ERR 0x00000100 /* Indicates Configuration Error on Channel */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_REF_DETECT 0x00000040 /* Indicates Whether ADC Reference is Valid */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_SENSOR_OPEN 0x00000020 /* Indicates Sensor Input is Open Circuit */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_HIGH_LIMIT 0x00000010 /* Indicates Sensor Result is Greater Than High Limit */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_LOW_LIMIT 0x00000008 /* Indicates Sensor Result is Less Than Low Limit */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_OVER_RANGE 0x00000004 /* Indicates Channel Over-Range */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_UNDER_RANGE 0x00000002 /* Indicates Channel Under-Range */ +#define BITM_ADISENSE_CORE_ALERT_DETAIL_CH_TIME_OUT 0x00000001 /* Indicates Time-Out Error from Digital Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_ERROR_CODE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_ERROR_CODE_ERROR_CODE 0 /* Code Indicating Type of Error */ +#define BITM_ADISENSE_CORE_ERROR_CODE_ERROR_CODE 0x0000FFFF /* Code Indicating Type of Error */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_ALERT_CODE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_ALERT_CODE_ALERT_CODE 0 /* Code Indicating Type of Alert */ +#define BITM_ADISENSE_CORE_ALERT_CODE_ALERT_CODE 0x0000FFFF /* Code Indicating Type of Alert */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_EXTERNAL_REFERENCE1 Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_EXTERNAL_REFERENCE1_EXT_REFIN1_VALUE 0 /* Refin1 Value */ +#define BITM_ADISENSE_CORE_EXTERNAL_REFERENCE1_EXT_REFIN1_VALUE 0xFFFFFFFF /* Refin1 Value */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_EXTERNAL_REFERENCE2 Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_EXTERNAL_REFERENCE2_EXT_REFIN2_VALUE 0 /* Refin2 Value */ +#define BITM_ADISENSE_CORE_EXTERNAL_REFERENCE2_EXT_REFIN2_VALUE 0xFFFFFFFF /* Refin2 Value */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_AVDD_VOLTAGE Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_AVDD_VOLTAGE_AVDD_VOLTAGE 0 /* AVDD Voltage */ +#define BITM_ADISENSE_CORE_AVDD_VOLTAGE_AVDD_VOLTAGE 0xFFFFFFFF /* AVDD Voltage */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIAGNOSTICS_CONTROL Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAGNOSTICS_EXTRA 8 /* Additional Diagnostics Control */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAG_OSD_FREQ 2 /* Diagnostics Open Sensor Detect Frequency */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAG_MEAS_EN 1 /* Diagnostics Measure Enable */ +#define BITP_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAG_GLOBAL_EN 0 /* Diagnostics Global Enable */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAGNOSTICS_EXTRA 0x0000FF00 /* Additional Diagnostics Control */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAG_OSD_FREQ 0x0000000C /* Diagnostics Open Sensor Detect Frequency */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAG_MEAS_EN 0x00000002 /* Diagnostics Measure Enable */ +#define BITM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_DIAG_GLOBAL_EN 0x00000001 /* Diagnostics Global Enable */ +#define ENUM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_OFF 0x00000000 /* Diag_OSD_Freq: No Open-Circuit Detection During Measurement */ +#define ENUM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_1_CYCLE 0x00000004 /* Diag_OSD_Freq: Open-Circuit Detection Performed Once Per Measurement Cycle */ +#define ENUM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_100_CYCLES 0x00000008 /* Diag_OSD_Freq: Open-Circuit Detection Performed Once Per Hundred Measurement Cycles */ +#define ENUM_ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_1000_CYCLES 0x0000000C /* Diag_OSD_Freq: Open-Circuit Detection Performed Once Per Thousand Measurement Cycles */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DATA_FIFO Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DATA_FIFO_RAW_SAMPLE 40 /* ADC Result */ +#define BITP_ADISENSE_CORE_DATA_FIFO_CH_VALID 39 /* Indicates Whether Valid Data Read from FIFO */ +#define BITP_ADISENSE_CORE_DATA_FIFO_CH_RAW 38 /* Indicates If RAW Data is Valid */ +#define BITP_ADISENSE_CORE_DATA_FIFO_CH_ALERT 37 /* Indicates Alert on Channel */ +#define BITP_ADISENSE_CORE_DATA_FIFO_CH_ERROR 36 /* Indicates Error on Channel */ +#define BITP_ADISENSE_CORE_DATA_FIFO_CHANNEL_ID 32 /* Indicates Which Channel This FIFO Data Corresponds to */ +#define BITP_ADISENSE_CORE_DATA_FIFO_SENSOR_RESULT 0 /* Linearized and Compensated Sensor Result */ +#define BITM_ADISENSE_CORE_DATA_FIFO_RAW_SAMPLE 0xFFFFFF0000000000 /* ADC Result */ +#define BITM_ADISENSE_CORE_DATA_FIFO_CH_VALID 0x8000000000 /* Indicates Whether Valid Data Read from FIFO */ +#define BITM_ADISENSE_CORE_DATA_FIFO_CH_RAW 0x4000000000 /* Indicates If RAW Data is Valid */ +#define BITM_ADISENSE_CORE_DATA_FIFO_CH_ALERT 0x2000000000 /* Indicates Alert on Channel */ +#define BITM_ADISENSE_CORE_DATA_FIFO_CH_ERROR 0x1000000000 /* Indicates Error on Channel */ +#define BITM_ADISENSE_CORE_DATA_FIFO_CHANNEL_ID 0xF00000000 /* Indicates Which Channel This FIFO Data Corresponds to */ +#define BITM_ADISENSE_CORE_DATA_FIFO_SENSOR_RESULT 0xFFFFFFFF /* Linearized and Compensated Sensor Result */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_LUT_SELECT Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_LUT_SELECT_LUT_RW 7 /* Read or Write LUT Data */ +#define BITM_ADISENSE_CORE_LUT_SELECT_LUT_RW 0x00000080 /* Read or Write LUT Data */ +#define ENUM_ADISENSE_CORE_LUT_SELECT_LUT_READ 0x00000000 /* LUT_RW: Read Addressed LUT Data */ +#define ENUM_ADISENSE_CORE_LUT_SELECT_LUT_WRITE 0x00000080 /* LUT_RW: Write Addressed LUT Data */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_LUT_OFFSET Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_LUT_OFFSET_LUT_OFFSET 0 /* Offset into Look-Up-Table */ +#define BITM_ADISENSE_CORE_LUT_OFFSET_LUT_OFFSET 0x00003FFF /* Offset into Look-Up-Table */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_LUT_DATA Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_LUT_DATA_LUT_DATA 0 /* Data Byte to Write to / Read from Look-Up-Table */ +#define BITM_ADISENSE_CORE_LUT_DATA_LUT_DATA 0x000000FF /* Data Byte to Write to / Read from Look-Up-Table */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CAL_OFFSET Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CAL_OFFSET_CAL_OFFSET 0 /* Offset into Calibration Data */ +#define BITM_ADISENSE_CORE_CAL_OFFSET_CAL_OFFSET 0x00003FFF /* Offset into Calibration Data */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CAL_DATA Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CAL_DATA_CAL_DATA 0 /* Data to Write to / Read from Calibration Data */ +#define BITM_ADISENSE_CORE_CAL_DATA_CAL_DATA 0x000000FF /* Data to Write to / Read from Calibration Data */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_REVISION Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_REVISION_COMMS_PROTOCOL 16 /* ID Info */ +#define BITP_ADISENSE_CORE_REVISION_HARDWARE_REVISION 8 /* ID Info */ +#define BITP_ADISENSE_CORE_REVISION_FIRMWARE_REVISION 0 /* ID Info */ +#define BITM_ADISENSE_CORE_REVISION_COMMS_PROTOCOL 0x00FF0000 /* ID Info */ +#define BITM_ADISENSE_CORE_REVISION_HARDWARE_REVISION 0x0000FF00 /* ID Info */ +#define BITM_ADISENSE_CORE_REVISION_FIRMWARE_REVISION 0x000000FF /* ID Info */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CHANNEL_COUNT[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CHANNEL_COUNT_CHANNEL_ENABLE 7 /* Enable Channel in Measurement Cycle */ +#define BITP_ADISENSE_CORE_CHANNEL_COUNT_CHANNEL_COUNT 0 /* How Many Times Channel Should Appear in One Cycle */ +#define BITM_ADISENSE_CORE_CHANNEL_COUNT_CHANNEL_ENABLE 0x00000080 /* Enable Channel in Measurement Cycle */ +#define BITM_ADISENSE_CORE_CHANNEL_COUNT_CHANNEL_COUNT 0x0000007F /* How Many Times Channel Should Appear in One Cycle */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_SENSOR_TYPE[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SENSOR_TYPE_SENSOR_TYPE 0 /* Sensor Type */ +#define BITM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_TYPE 0x00000FFF /* Sensor Type */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_T_DEF_L1 0x00000000 /* Sensor_Type: Thermocouple T-Type Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_J_DEF_L1 0x00000001 /* Sensor_Type: Thermocouple J-Type Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_K_DEF_L1 0x00000002 /* Sensor_Type: Thermocouple K-Type Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_1_DEF_L2 0x0000000C /* Sensor_Type: Thermocouple Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_2_DEF_L2 0x0000000D /* Sensor_Type: Thermocouple Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_3_DEF_L2 0x0000000E /* Sensor_Type: Thermocouple Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_4_DEF_L2 0x0000000F /* Sensor_Type: Thermocouple Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_T_ADV_L1 0x00000010 /* Sensor_Type: Thermocouple T-Type Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_J_ADV_L1 0x00000011 /* Sensor_Type: Thermocouple J-Type Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_K_ADV_L1 0x00000012 /* Sensor_Type: Thermocouple K-Type Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_1_ADV_L2 0x0000001C /* Sensor_Type: Thermocouple Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_2_ADV_L2 0x0000001D /* Sensor_Type: Thermocouple Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_3_ADV_L2 0x0000001E /* Sensor_Type: Thermocouple Sensor 3 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_4_ADV_L2 0x0000001F /* Sensor_Type: Thermocouple Sensor 4 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT100_DEF_L1 0x00000020 /* Sensor_Type: RTD 2 Wire PT100 Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT1000_DEF_L1 0x00000021 /* Sensor_Type: RTD 2 Wire PT1000 Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_1_DEF_L2 0x0000002C /* Sensor_Type: RTD 2 Wire Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_2_DEF_L2 0x0000002D /* Sensor_Type: RTD 2 Wire Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_3_DEF_L2 0x0000002E /* Sensor_Type: RTD 2 Wire Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_4_DEF_L2 0x0000002F /* Sensor_Type: RTD 2 Wire Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT100_ADV_L1 0x00000030 /* Sensor_Type: RTD 2 Wire PT100 Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT1000_ADV_L1 0x00000031 /* Sensor_Type: RTD 2 Wire PT1000 Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_1_ADV_L2 0x0000003C /* Sensor_Type: RTD 2 Wire Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_2_ADV_L2 0x0000003D /* Sensor_Type: RTD 2 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_3_ADV_L2 0x0000003E /* Sensor_Type: RTD 2 Wire Sensor 3 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_4_ADV_L2 0x0000003F /* Sensor_Type: RTD 2 Wire Sensor 4 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT100_DEF_L1 0x00000040 /* Sensor_Type: RTD 3 Wire PT100 Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT1000_DEF_L1 0x00000041 /* Sensor_Type: RTD 3 Wire PT1000 Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_1_DEF_L2 0x0000004C /* Sensor_Type: RTD 3 Wire Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_2_DEF_L2 0x0000004D /* Sensor_Type: RTD 3 Wire Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_3_DEF_L2 0x0000004E /* Sensor_Type: RTD 3 Wire Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_4_DEF_L2 0x0000004F /* Sensor_Type: RTD 3 Wire Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT100_ADV_L1 0x00000050 /* Sensor_Type: RTD 3 Wire PT100 Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT1000_ADV_L1 0x00000051 /* Sensor_Type: RTD 3 Wire PT1000 Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_1_ADV_L2 0x0000005C /* Sensor_Type: RTD 3 Wire Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_2_ADV_L2 0x0000005D /* Sensor_Type: RTD 3 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_3_ADV_L2 0x0000005E /* Sensor_Type: RTD 3 Wire Sensor 3 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_4_ADV_L2 0x0000005F /* Sensor_Type: RTD 3 Wire Sensor 4 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT100_DEF_L1 0x00000060 /* Sensor_Type: RTD 4 Wire PT100 Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT1000_DEF_L1 0x00000061 /* Sensor_Type: RTD 4 Wire PT1000 Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_1_DEF_L2 0x0000006C /* Sensor_Type: RTD 4 Wire Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_2_DEF_L2 0x0000006D /* Sensor_Type: RTD 4 Wire Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_3_DEF_L2 0x0000006E /* Sensor_Type: RTD 4 Wire Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_4_DEF_L2 0x0000006F /* Sensor_Type: RTD 4 Wire Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT100_ADV_L1 0x00000070 /* Sensor_Type: RTD 4 Wire PT100 Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT1000_ADV_L1 0x00000071 /* Sensor_Type: RTD 4 Wire PT1000 Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_1_ADV_L2 0x0000007C /* Sensor_Type: RTD 4 Wire Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_2_ADV_L2 0x0000007D /* Sensor_Type: RTD 4 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_3_ADV_L2 0x0000007E /* Sensor_Type: RTD 4 Wire Sensor 3 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_4_ADV_L2 0x0000007F /* Sensor_Type: RTD 4 Wire Sensor 4 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_A_10K_DEF_L1 0x00000080 /* Sensor_Type: Thermistor Type A 10kOhm Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_B_10K_DEF_L1 0x00000081 /* Sensor_Type: Thermistor Type B 10kOhm Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_1_DEF_L2 0x0000008C /* Sensor_Type: Thermistor Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_2_DEF_L2 0x0000008D /* Sensor_Type: Thermistor Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_3_DEF_L2 0x0000008E /* Sensor_Type: Thermistor Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_4_DEF_L2 0x0000008F /* Sensor_Type: Thermistor Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_A_10K_ADV_L1 0x00000090 /* Sensor_Type: Thermistor Type A 10kOhm Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_B_10K_ADV_L1 0x00000091 /* Sensor_Type: Thermistor Type B 10kOhm Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_1_ADV_L2 0x0000009C /* Sensor_Type: Thermistor Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_2_ADV_L2 0x0000009D /* Sensor_Type: Thermistor Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_3_ADV_L2 0x0000009E /* Sensor_Type: Thermistor Sensor 3 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_4_ADV_L2 0x0000009F /* Sensor_Type: Thermistor Sensor 4 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_1_DEF_L2 0x000000A0 /* Sensor_Type: Bridge 4 Wire Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_2_DEF_L2 0x000000A1 /* Sensor_Type: Bridge 4 Wire Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_3_DEF_L2 0x000000A2 /* Sensor_Type: Bridge 4 Wire Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_4_DEF_L2 0x000000A3 /* Sensor_Type: Bridge 4 Wire Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_1_ADV_L2 0x000000B0 /* Sensor_Type: Bridge 4 Wire Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_2_ADV_L2 0x000000B1 /* Sensor_Type: Bridge 4 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_3_ADV_L2 0x000000B2 /* Sensor_Type: Bridge 4 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_4_ADV_L2 0x000000B3 /* Sensor_Type: Bridge 4 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_1_DEF_L2 0x000000C0 /* Sensor_Type: Bridge 6 Wire Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_2_DEF_L2 0x000000C1 /* Sensor_Type: Bridge 6 Wire Sensor 2 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_3_DEF_L2 0x000000C2 /* Sensor_Type: Bridge 6 Wire Sensor 3 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_4_DEF_L2 0x000000C3 /* Sensor_Type: Bridge 6 Wire Sensor 4 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_1_ADV_L2 0x000000D0 /* Sensor_Type: Bridge 6 Wire Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_2_ADV_L2 0x000000D1 /* Sensor_Type: Bridge 6 Wire Sensor 2 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_3_ADV_L2 0x000000D2 /* Sensor_Type: Bridge 6 Wire Sensor 3 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_4_ADV_L2 0x000000D3 /* Sensor_Type: Bridge 6 Wire Sensor 4 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE 0x00000100 /* Sensor_Type: Voltage Input */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY 0x00000110 /* Sensor_Type: Voltage Output Pressure Sensor 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X 0x00000111 /* Sensor_Type: Voltage Output Pressure Sensor 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_3_DEF 0x00000112 /* Sensor_Type: Voltage Output Pressure Sensor 3 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT 0x00000180 /* Sensor_Type: Current Input */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2 0x00000181 /* Sensor_Type: Current Output Pressure Sensor 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_2 0x00000182 /* Sensor_Type: Current Output Pressure Sensor 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_CUSTOM1 0x00000200 /* Sensor_Type: Custom1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_PRESSURE_1 0x00000800 /* Sensor_Type: I2C Pressure Sensor 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_PRESSURE_2 0x00000801 /* Sensor_Type: I2C Pressure Sensor 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_HUMIDITY_HONEYWELL_HUMIDICON 0x00000840 /* Sensor_Type: I2C Humidity Sensor 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_HUMIDITY_SENSIRION_SHT3X 0x00000841 /* Sensor_Type: I2C Humidity Sensor 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_PRESSURE_HONEYWELL_TRUSTABILITY 0x00000C00 /* Sensor_Type: SPI Pressure Sensor 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_PRESSURE_2 0x00000C01 /* Sensor_Type: SPI Pressure Sensor 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_HUMIDITY_1 0x00000C40 /* Sensor_Type: SPI Humidity Sensor Type 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_HUMIDITY_2 0x00000C41 /* Sensor_Type: SPI Humidity Sensor Type 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_1 0x00000C80 /* Sensor_Type: SPI Accelerometer Sensor Type 1 3-Axis */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_2 0x00000C81 /* Sensor_Type: SPI Accelerometer Sensor Type 2 3-Axis */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_SENSOR_DETAILS[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_AVERAGING 28 /* Number of ADC Results to Average */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN 24 /* PGA Gain */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_REFERENCE_SELECT 20 /* Reference Selection */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_VBIAS 19 /* Controls ADC Vbias Output */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_REFERENCE_BUFFER_DISABLE 18 /* Enable or Disable ADC Reference Buffer */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_DO_NOT_PUBLISH 17 /* Do Not Publish Channel Result */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_CHANNEL3 12 /* Indicates Channel for Third Term of Compensation */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_CHANNEL2 8 /* Indicates Channel for Second Term of Compensation */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_CHANNEL 4 /* Indicates Which Channel is Used to Compensate Sensor Result */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_MEASUREMENT_UNITS 0 /* Units of Sensor Measurement */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_AVERAGING 0x70000000 /* Number of ADC Results to Average */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN 0x07000000 /* PGA Gain */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_REFERENCE_SELECT 0x00F00000 /* Reference Selection */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_VBIAS 0x00080000 /* Controls ADC Vbias Output */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_REFERENCE_BUFFER_DISABLE 0x00040000 /* Enable or Disable ADC Reference Buffer */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_DO_NOT_PUBLISH 0x00020000 /* Do Not Publish Channel Result */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_CHANNEL3 0x0000F000 /* Indicates Channel for Third Term of Compensation */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_CHANNEL2 0x00000F00 /* Indicates Channel for Second Term of Compensation */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_CHANNEL 0x000000F0 /* Indicates Which Channel is Used to Compensate Sensor Result */ +#define BITM_ADISENSE_CORE_SENSOR_DETAILS_MEASUREMENT_UNITS 0x0000000F /* Units of Sensor Measurement */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_1 0x00000000 /* PGA_Gain: Gain of 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_2 0x01000000 /* PGA_Gain: Gain of 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_4 0x02000000 /* PGA_Gain: Gain of 4 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_8 0x03000000 /* PGA_Gain: Gain of 8 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_16 0x04000000 /* PGA_Gain: Gain of 16 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_32 0x05000000 /* PGA_Gain: Gain of 32 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_64 0x06000000 /* PGA_Gain: Gain of 64 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_128 0x07000000 /* PGA_Gain: Gain of 128 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_INT 0x00000000 /* Reference_Select: Internal Reference */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_AVDD 0x00100000 /* Reference_Select: AVDD */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_VEXT1 0x00200000 /* Reference_Select: External Voltage on Refin1 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_VEXT2 0x00300000 /* Reference_Select: External Voltage on Refin2 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_RINT1 0x00400000 /* Reference_Select: Internal Resistor1 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_RINT2 0x00500000 /* Reference_Select: Internal Resistor2 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_REXT1 0x00600000 /* Reference_Select: External Resistor on Refin1 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_REXT2 0x00700000 /* Reference_Select: External Resistor on Refin2 */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_REF_EXC 0x00800000 /* Reference_Select: Bridge Excitation Voltage */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_UNITS_DEGC 0x00000000 /* Measurement_Units: Degrees C */ +#define ENUM_ADISENSE_CORE_SENSOR_DETAILS_UNITS_DEGF 0x00000001 /* Measurement_Units: Degrees F */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CHANNEL_EXCITATION[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_DONT_SWAP_3WIRE 7 /* Indicates 3-Wire Excitation Currents Should Not Be Swapped */ +#define BITP_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_STATIC_SWAP_3WIRE 6 /* Indicates 3-Wire Excitation Currents Should Be Swapped */ +#define BITP_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT1_DISABLE 4 /* Disable Second Current Source */ +#define BITP_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT0_DISABLE 3 /* Disable First Current Source */ +#define BITP_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_EXCITATION_CURRENT 0 /* Current Source Value */ +#define BITM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_DONT_SWAP_3WIRE 0x00000080 /* Indicates 3-Wire Excitation Currents Should Not Be Swapped */ +#define BITM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_STATIC_SWAP_3WIRE 0x00000040 /* Indicates 3-Wire Excitation Currents Should Be Swapped */ +#define BITM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT1_DISABLE 0x00000010 /* Disable Second Current Source */ +#define BITM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT0_DISABLE 0x00000008 /* Disable First Current Source */ +#define BITM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_EXCITATION_CURRENT 0x00000007 /* Current Source Value */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_OFF 0x00000000 /* IOUT_Excitation_Current: Disabled */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_50UA 0x00000001 /* IOUT_Excitation_Current: 50 \mu;A */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_100UA 0x00000002 /* IOUT_Excitation_Current: 100 \mu;A */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_250UA 0x00000003 /* IOUT_Excitation_Current: 250 \mu;A */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_500UA 0x00000004 /* IOUT_Excitation_Current: 500 \mu;A */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_750UA 0x00000005 /* IOUT_Excitation_Current: 750 \mu;A */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_1000UA 0x00000006 /* IOUT_Excitation_Current: 1000 \mu;A */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_1000UA_2 0x00000007 /* IOUT_Excitation_Current: 1000 \mu;A */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_SETTLING_TIME[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SETTLING_TIME_SETTLING_TIME 0 /* Settling Time to Allow When Switching to Channel */ +#define BITM_ADISENSE_CORE_SETTLING_TIME_SETTLING_TIME 0x0000FFFF /* Settling Time to Allow When Switching to Channel */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_FILTER_SELECT[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_FILTER_SELECT_ADC_FILTER_TYPE 11 /* ADC Digital Filter Type */ +#define BITP_ADISENSE_CORE_FILTER_SELECT_ADC_FS 0 /* ADC Digital Filter Select */ +#define BITM_ADISENSE_CORE_FILTER_SELECT_ADC_FILTER_TYPE 0x0000F800 /* ADC Digital Filter Type */ +#define BITM_ADISENSE_CORE_FILTER_SELECT_ADC_FS 0x000007FF /* ADC Digital Filter Select */ +#define ENUM_ADISENSE_CORE_FILTER_SELECT_FILTER_FIR_25SPS 0x00000000 /* ADC_Filter_Type: FIR Filter 25 SPS */ +#define ENUM_ADISENSE_CORE_FILTER_SELECT_FILTER_FIR_20SPS 0x00000800 /* ADC_Filter_Type: FIR Filter 20 SPS */ +#define ENUM_ADISENSE_CORE_FILTER_SELECT_FILTER_SINC4 0x00001000 /* ADC_Filter_Type: Sinc4 Filter */ +#define ENUM_ADISENSE_CORE_FILTER_SELECT_FILTER_TBD 0x00001800 /* ADC_Filter_Type: TBD Filter */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_HIGH_THRESHOLD_LIMIT[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT_HIGH_THRESHOLD 0 /* Upper Limit for Sensor Alert Comparison */ +#define BITM_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT_HIGH_THRESHOLD 0xFFFFFFFF /* Upper Limit for Sensor Alert Comparison */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_LOW_THRESHOLD_LIMIT[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_LOW_THRESHOLD_LIMIT_LOW_THRESHOLD 0 /* Lower Limit for Sensor Alert Comparison */ +#define BITM_ADISENSE_CORE_LOW_THRESHOLD_LIMIT_LOW_THRESHOLD 0xFFFFFFFF /* Lower Limit for Sensor Alert Comparison */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_SENSOR_OFFSET[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SENSOR_OFFSET_SENSOR_OFFSET 0 /* Sensor Offset Adjustment */ +#define BITM_ADISENSE_CORE_SENSOR_OFFSET_SENSOR_OFFSET 0xFFFFFFFF /* Sensor Offset Adjustment */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_SENSOR_GAIN[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SENSOR_GAIN_SENSOR_GAIN 0 /* Sensor Gain Adjustment */ +#define BITM_ADISENSE_CORE_SENSOR_GAIN_SENSOR_GAIN 0xFFFFFFFF /* Sensor Gain Adjustment */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_ALERT_CODE_CH[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_ALERT_CODE_CH_ALERT_CODE_CH 0 /* Per-Channel Code Indicating Type of Alert */ +#define BITM_ADISENSE_CORE_ALERT_CODE_CH_ALERT_CODE_CH 0x0000FFFF /* Per-Channel Code Indicating Type of Alert */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_CONFIG[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_DATA_BITS 11 /* Number of Relevant Data Bits */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_READ_BYTES 8 /* Number of bytes to read from the sensor */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_BIT_OFFSET 4 /* Data Bit Offset, relative to alignment */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_LEFT_ALIGNED 3 /* Data Alignment within the data frame */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_LITTLE_ENDIAN 2 /* Data Endianness of Sensor Result */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_CODING 0 /* Data Encoding of Sensor Result */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_DATA_BITS 0x000F800 /* Number of Relevant Data Bits */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_READ_BYTES 0x0000700 /* Number of bytes to read from the sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_BIT_OFFSET 0x000000F0 /* Data Bit Offset, relative to alignment */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_LEFTALIGNED 0x00000008 /* Data Alignment within the data frame */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_LITTEENDIAN 0x00000004 /* Data Endianness of Sensor Result */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_DIGITAL_SENSOR_CODING 0x00000003 /* Data Encoding of Sensor Result */ +#define ENUM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_NONE 0x00000000 /* Digital_Sensor_Coding: None/Invalid */ +#define ENUM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_UNIPOLAR 0x00000001 /* Digital_Sensor_Coding: Unipolar */ +#define ENUM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_TWOS_COMPL 0x00000002 /* Digital_Sensor_Coding: Twos Complement */ +#define ENUM_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_OFFSET_BINARY 0x00000003 /* Digital_Sensor_Coding: Offset Binary */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS_DIGITAL_SENSOR_ADDRESS 0 /* I2C Address or Write Address Command for SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS_DIGITAL_SENSOR_ADDRESS 0x000000FF /* I2C Address or Write Address Command for SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS_DIGITAL_SENSOR_NUM_READ_CMDS 4 /* Number of Read Commands for Digital Sensor */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS_DIGITAL_SENSOR_NUM_CFG_CMDS 0 /* Number of Configuration Commands for Digital Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS_DIGITAL_SENSOR_NUM_READ_CMDS 0x00000070 /* Number of Read Commands for Digital Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS_DIGITAL_SENSOR_NUM_CFG_CMDS 0x00000007 /* Number of Configuration Commands for Digital Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND1[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND1_DIGITAL_SENSOR_COMMAND1 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND1_DIGITAL_SENSOR_COMMAND1 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND2[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND2_DIGITAL_SENSOR_COMMAND2 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND2_DIGITAL_SENSOR_COMMAND2 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND3[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND3_DIGITAL_SENSOR_COMMAND3 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND3_DIGITAL_SENSOR_COMMAND3 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND4[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND4_DIGITAL_SENSOR_COMMAND4 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND4_DIGITAL_SENSOR_COMMAND4 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND5[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND5_DIGITAL_SENSOR_COMMAND5 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND5_DIGITAL_SENSOR_COMMAND5 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND6[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND6_DIGITAL_SENSOR_COMMAND6 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND6_DIGITAL_SENSOR_COMMAND6 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_COMMAND7[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND7_DIGITAL_SENSOR_COMMAND7 0 /* Configuration Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND7_DIGITAL_SENSOR_COMMAND7 0x000000FF /* Configuration Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD1[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD1_DIGITAL_SENSOR_READ_CMD1 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD1_DIGITAL_SENSOR_READ_CMD1 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD2[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD2_DIGITAL_SENSOR_READ_CMD2 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD2_DIGITAL_SENSOR_READ_CMD2 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD3[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD3_DIGITAL_SENSOR_READ_CMD3 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD3_DIGITAL_SENSOR_READ_CMD3 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD4[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD4_DIGITAL_SENSOR_READ_CMD4 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD4_DIGITAL_SENSOR_READ_CMD4 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD5[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD5_DIGITAL_SENSOR_READ_CMD5 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD5_DIGITAL_SENSOR_READ_CMD5 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD6[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD6_DIGITAL_SENSOR_READ_CMD6 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD6_DIGITAL_SENSOR_READ_CMD6 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7_DIGITAL_SENSOR_READ_CMD7 0 /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7_DIGITAL_SENSOR_READ_CMD7 0x000000FF /* Per Conversion Command to Send to Digital I2C/SPI Sensor */ + + +/* ============================================================================================================================ + Test Registers + ============================================================================================================================ */ + +/* ============================================================================================================================ + ADISENSE_TEST + ============================================================================================================================ */ +#define MOD_ADISENSE_TEST_BASE 0x00000400 /* Test Registers */ +#define MOD_ADISENSE_TEST_MASK 0x00007FFF /* Test Registers */ +#define REG_ADISENSE_TEST_TEST_REG_0_RESET 0x00000000 /* Reset Value for test_reg_0 */ +#define REG_ADISENSE_TEST_TEST_REG_0 0x00000400 /* ADISENSE_TEST Test Register 0 */ +#define REG_ADISENSE_TEST_ADC_CAL_TEMP_RESET 0x7fc00000 /* Reset Value for ADISENSE_TEST_ADC_CAL_TEMP */ +#define REG_ADISENSE_TEST_ADC_CAL_TEMP 0x00000404 /* ADC-sourced temperature used for calibration (read-only) */ +#define REG_ADISENSE_TEST_USER_CAL_TEMP_RESET 0x7fc00000 /* Reset Value for ADISENSE_TEST_USER_CAL_TEMP */ +#define REG_ADISENSE_TEST_USER_CAL_TEMP 0x00000408 /* User-specified temperature override for calibration */ + +/* ============================================================================================================================ + ADISENSE_TEST Register BitMasks, Positions & Enumerations + ============================================================================================================================ */ +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_TEST_TEST_REG_0 Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_TEST_TEST_REG_0_TEST_COMMAND 0 /* Test_Command */ +#define BITM_ADISENSE_TEST_TEST_REG_0_TEST_COMMAND 0x000000FF /* Test_Command */ + + +/* ADISENSE_SPI Parameters */ + +/***** ADISENSE_SPI */ +#define PARAM_ADISENSE_SPI_SPI_STANDARD "LPT" /* A part must declare which SPI Standard it follows, either ADI or LPT */ +#define PARAM_ADISENSE_SPI_CHIP_GRADE_VALUE 0 /* This is used to indicate speed grades/linearity. */ +#define PARAM_ADISENSE_SPI_CHIP_REVISION_VALUE 0 /* This is used to indicate the silicon revision */ +#define PARAM_ADISENSE_SPI_HAS_M_S_REGISTERS 0 /* If a design uses Master-Slave registers this must be set to true to enable relevant control bit fields */ +#define PARAM_ADISENSE_SPI_M_S_TRANSFER_BF_EXISTS 0 /* Used to set EXISTS the M-S Transfer bit field */ +#define PARAM_ADISENSE_SPI_STREAM_MODE_TRANSFER_BF_EXISTS 0 /* Used to set EXISTS of the stream mode transfer bit field */ +#define PARAM_ADISENSE_SPI_MSB_AND_LSB_FIRST_SUPPORT 0 /* Determines if the parts supports MSB and LSB first options */ +#define PARAM_ADISENSE_SPI_WIRE_MODE_SUPPORT "_4_WIRE" /* Configures which hardware SPI modes are supported */ +#define PARAM_ADISENSE_SPI_WIRE_MODE_DEFAULT "_4_WIRE" /* Sets the default hardware SPI mode */ +#define PARAM_ADISENSE_SPI_MULTI_IO_CHANNELS 1 /* Defines the number of SDIO pins supported by the SPI in Multi-IO Mode. Should be 1,2,4, or 8. */ +#define PARAM_ADISENSE_SPI_LPT_STANDARD_VERSION "REV1_0" /* This is a string from the LPT_STANDARD_VERSION_OPTIONS array for the active LPT SPI Standard version */ +#define PARAM_ADISENSE_SPI_HAS_CSB_PIN 1 /* Does the part have a csb pin? */ +#define PARAM_ADISENSE_SPI_BUS_MODE_SUPPORT 1 /* When set to true, Bus mode is supported. */ +#define PARAM_ADISENSE_SPI_ISOLATED_3_WIRE_SUPPORT 0 /* Does the part support the 3-wire isolate mode of operation */ +#define PARAM_ADISENSE_SPI_DAISY_CHAIN_MODE_SUPPORT 0 /* When set to true, Daisy chain mode is supported. */ +#define PARAM_ADISENSE_SPI_CHECK_GTE_1_MODE_SUPPORTED 1 /* This is used to check that at least mode is enabled */ +#define PARAM_ADISENSE_SPI_INTERFACE_MODE_SWITCH "None" /* Valid options are 'None', 'HW' or 'SW' */ +#define PARAM_ADISENSE_SPI_CRC_SUPPORT "CRC_CONFIGURABLE" /* Set to true to enable bit fields related to CRC. */ +#define PARAM_ADISENSE_SPI_CRC_SUPPORT_ENABLED 0 /* Verilog output parameter for 'define */ +#define PARAM_ADISENSE_SPI_CRC_SUPPORT_ENABLE 1 /* Configures if CRC features are enabled in the module */ +#define PARAM_ADISENSE_SPI_LPT_STANDARD_VERSION_VALUE 2 /* Index value of the active LPT SPI Standard version */ +#define PARAM_ADISENSE_SPI_ADDRESS_MODE_SUPPORT "_15_BIT" /* Configures which addressing modes are supported */ +#define PARAM_ADISENSE_SPI_ADDRESS_MODE_DEFAULT "_15_BIT" /* Sets the default addressing mode */ +#define PARAM_ADISENSE_SPI_ADDRESS_BUS_WIDTH 15 /* Verilog output parameter for 'define */ +#define PARAM_ADISENSE_SPI_SLOW_IFACE_CTRL_SUPPORT 0 /* Does the part support the Slow Interface Control feature */ +#define PARAM_ADISENSE_SPI_SOFT_RESET_0_BF_EXISTS 0 /* Used to control if the SOFT_RESET_0 bit field exists */ +#define PARAM_ADISENSE_SPI_SOFT_RESET_1_BF_EXISTS 0 /* Used to control if the SOFT_RESET_1 bit field exists */ +#define PARAM_ADISENSE_SPI_SEND_STATUS_SUPPORT "NO_SEND_STATUS" /* Determines if and how the part supports the SEND_STATUS feature */ +#define PARAM_ADISENSE_SPI_SEND_STATUS_SUPPORT_ENABLE 0 /* This is used to enable various send status features */ +#define PARAM_ADISENSE_SPI_SPI_STANDARD_VERSION_VALUE 2 /* Value for SPI Standard VERSION bit field */ +#define PARAM_ADISENSE_SPI_ENTITY_ACCESS_SUPPORT "ENTITY_ACCESS_ALWAYS" /* Configures which entity access mode(s) are supported */ +#define PARAM_ADISENSE_SPI_ENTITY_ACCESS_SUPPORT_ENABLE 1 /* This is used to enable/disable Strict Entity Access features */ +#define PARAM_ADISENSE_SPI_ENTITY_ACCESS_DEFAULT 1 /* Sets the default entity access mode */ +#define PARAM_ADISENSE_SPI_CHIP_INDEX_EXISTS 0 /* Used to control if the CHIP_INDEX register and related bit field exists */ +#define PARAM_ADISENSE_SPI_OFFSET_DEV_INDEX_EXISTS 0 /* Used to control if the OFFSET_DEV_INDEX bit field and registers exists */ +#define PARAM_ADISENSE_SPI_DEV_INDEX_EXISTS 0 /* Used to control if the DEV_INDEX bit field and register exists */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_0_EXISTS 0 /* Sets EXIST for Status Bit 0 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_1_EXISTS 0 /* Sets EXIST for Status Bit 1 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_2_EXISTS 0 /* Sets EXIST for Status Bit 2 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_3_EXISTS 0 /* Sets EXIST for Status Bit 3 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_0_SWNAME "Status_Bit_0" /* Software Name for Status Bit 0 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_1_SWNAME "Status_Bit_1" /* Software Name for Status Bit 1 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_2_SWNAME "Status_Bit_2" /* Software Name for Status Bit 2 */ +#define PARAM_ADISENSE_SPI_STATUS_BIT_3_SWNAME "Status_Bit_3" /* Software Name for Status Bit 3 */ +#define PARAM_ADISENSE_SPI_CHIP_TYPE "P_ADC" /* This is a string that corresponds to one of the values in the CHIP_TYPE_OPTIONS array and corresponds to the type of chip being developed */ +#define PARAM_ADISENSE_SPI_CHIP_TYPE_VALUE 7 /* Integer value corresponding to selected CHIP_TYPE, and is used as bit field enum value */ +#define PARAM_ADISENSE_SPI_PRODUCT_ID_VALUE 32 /* This value is used to identify a specific generic. */ +#define PARAM_ADISENSE_SPI_PRODUCT_ID_TRIM_BITS 4 /* This defines the number of PRODUCT_ID bits that can be fuse/trimmed. */ + +#endif /* end ifndef _DEF_ADISENSE1000_REGISTERS_H */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/adi_sense_1000/ADISENSE1000_REGISTERS_typedefs.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,1929 @@ +/* ================================================================================ + + Created by : sherry + Created on : 2017 Nov 14, 10:55 GMT + + Project : ADISENSE1000_REGISTERS + File : ADISENSE1000_REGISTERS_typedefs.h + Description : C Register Structures + + !! ADI Confidential !! + INTERNAL USE ONLY + + Copyright (c) 2017 Analog Devices, Inc. All Rights Reserved. + This software is proprietary and confidential to Analog Devices, Inc. and + its licensors. + + This file was auto-generated. Do not make local changes to this file. + + Auto generation script information: + Script: /usr/cadtools/bin/yoda.dir/generators/inc/genHeaders + Last modified: 26-SEP-2017 + + ================================================================================ */ + +#ifndef _ADISENSE1000_REGISTERS_TYPEDEFS_H +#define _ADISENSE1000_REGISTERS_TYPEDEFS_H + +/* pickup integer types */ +#if defined(_LANGUAGE_C) || (defined(__GNUC__) && !defined(__ASSEMBLER__)) +#include <stdint.h> +#endif /* _LANGUAGE_C */ + +#if defined ( __CC_ARM ) +#pragma push +#pragma anon_unions +#endif + +/** @defgroup Interface_Config_A Interface Configuration A (Interface_Config_A) Register + * Interface Configuration A (Interface_Config_A) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_Interface_Config_A_Addr_Ascension + *! \brief Determines Sequential Addressing Behavior (Addr_Ascension) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_INTERFACE_CONFIG_A_DESCEND = 0, /**< Address accessed is decremented by one for each data byte when streaming */ + ADISENSE_SPI_INTERFACE_CONFIG_A_ASCEND = 1 /**< Address accessed is incremented by one for each data byte when streaming */ +} ADI_ADISENSE_SPI_Interface_Config_A_Addr_Ascension; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Interface_Config_A_Struct + *! \brief Interface Configuration A Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Interface_Config_A_t { + union { + struct { + uint8_t SW_ResetX : 1; /**< Second of Two of SW_RESET Bits. */ + uint8_t reserved1 : 3; + uint8_t SDO_Enable : 1; /**< SDO Pin Enable */ + uint8_t Addr_Ascension : 1; /**< Determines Sequential Addressing Behavior */ + uint8_t reserved6 : 1; + uint8_t SW_Reset : 1; /**< First of Two of SW_RESET Bits. */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Interface_Config_A_t; + +/*@}*/ + +/** @defgroup Interface_Config_B Interface Configuration B (Interface_Config_B) Register + * Interface Configuration B (Interface_Config_B) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_Interface_Config_B_Single_Inst + *! \brief Select Streaming or Single Instruction Mode (Single_Inst) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_INTERFACE_CONFIG_B_STREAMING_MODE = 0, /**< Streaming mode is enabled */ + ADISENSE_SPI_INTERFACE_CONFIG_B_SINGLE_INSTRUCTION_MODE = 1 /**< Single Instruction mode is enabled */ +} ADI_ADISENSE_SPI_Interface_Config_B_Single_Inst; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Interface_Config_B_Struct + *! \brief Interface Configuration B Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Interface_Config_B_t { + union { + struct { + uint8_t reserved0 : 7; + uint8_t Single_Inst : 1; /**< Select Streaming or Single Instruction Mode */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Interface_Config_B_t; + +/*@}*/ + +/** @defgroup Device_Config Device Configuration (Device_Config) Register + * Device Configuration (Device_Config) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_Device_Config_Operating_Modes + *! \brief Power Modes (Operating_Modes) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_DEVICE_CONFIG_NORMAL = 0, /**< Normal Operating Mode */ + ADISENSE_SPI_DEVICE_CONFIG_SLEEP = 3 /**< Low Power Mode */ +} ADI_ADISENSE_SPI_Device_Config_Operating_Modes; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Device_Config_Struct + *! \brief Device Configuration Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Device_Config_t { + union { + struct { + uint8_t Operating_Modes : 2; /**< Power Modes */ + uint8_t reserved2 : 6; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Device_Config_t; + +/*@}*/ + +/** @defgroup Chip_Type Chip Type (Chip_Type) Register + * Chip Type (Chip_Type) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Chip_Type_Struct + *! \brief Chip Type Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Chip_Type_t { + union { + struct { + uint8_t Chip_Type : 4; /**< Precision ADC */ + uint8_t reserved4 : 4; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Chip_Type_t; + +/*@}*/ + +/** @defgroup Product_ID_L Product ID Low (Product_ID_L) Register + * Product ID Low (Product_ID_L) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Product_ID_L_Struct + *! \brief Product ID Low Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Product_ID_L_t { + union { + struct { + uint8_t Product_ID_Trim_Bits : 4; /**< These Bits Vary on Die Configured for Multiple Generics */ + uint8_t Product_ID_Fixed_Bits : 4; /**< Product_ID_Fixed_Bits[3:0] These Bits are Fixed on Die Configured for Multiple Generics */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Product_ID_L_t; + +/*@}*/ + +/** @defgroup Product_ID_H Product ID High (Product_ID_H) Register + * Product ID High (Product_ID_H) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Product_ID_H_Struct + *! \brief Product ID High Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Product_ID_H_t { + union { + struct { + uint8_t Product_ID_Fixed_Bits : 8; /**< Product_ID_Fixed_Bits[11:4] These Bits are Fixed on Die Configured for Multiple Generics */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Product_ID_H_t; + +/*@}*/ + +/** @defgroup Chip_Grade Chip Grade (Chip_Grade) Register + * Chip Grade (Chip_Grade) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Chip_Grade_Struct + *! \brief Chip Grade Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Chip_Grade_t { + union { + struct { + uint8_t Device_Revision : 4; /**< This is the Device Hardware Revision */ + uint8_t Grade : 4; /**< This is the Device Performance Grade */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Chip_Grade_t; + +/*@}*/ + +/** @defgroup Scratch_Pad Scratch Pad (Scratch_Pad) Register + * Scratch Pad (Scratch_Pad) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Scratch_Pad_Struct + *! \brief Scratch Pad Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Scratch_Pad_t { + union { + struct { + uint8_t Scratch_Value : 8; /**< Software Scratchpad */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Scratch_Pad_t; + +/*@}*/ + +/** @defgroup SPI_Revision SPI Revision (SPI_Revision) Register + * SPI Revision (SPI_Revision) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_SPI_Revision_Version + *! \brief SPI Version (Version) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_SPI_REVISION_REV1_0 = 2 /**< Revision 1.0 */ +} ADI_ADISENSE_SPI_SPI_Revision_Version; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_SPI_Revision_SPI_Type + *! \brief Always Reads as 0x2 (SPI_Type) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_SPI_REVISION_ADI_SPI = 0, /**< */ + ADISENSE_SPI_SPI_REVISION_LPT_SPI = 2 /**< */ +} ADI_ADISENSE_SPI_SPI_Revision_SPI_Type; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_SPI_Revision_Struct + *! \brief SPI Revision Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_SPI_Revision_t { + union { + struct { + uint8_t Version : 6; /**< SPI Version */ + uint8_t SPI_Type : 2; /**< Always Reads as 0x2 */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_SPI_Revision_t; + +/*@}*/ + +/** @defgroup Vendor_L Vendor ID Low (Vendor_L) Register + * Vendor ID Low (Vendor_L) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Vendor_L_Struct + *! \brief Vendor ID Low Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Vendor_L_t { + union { + struct { + uint8_t VID : 8; /**< VID[7:0] Analog Devices Vendor ID */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Vendor_L_t; + +/*@}*/ + +/** @defgroup Vendor_H Vendor ID High (Vendor_H) Register + * Vendor ID High (Vendor_H) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Vendor_H_Struct + *! \brief Vendor ID High Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Vendor_H_t { + union { + struct { + uint8_t VID : 8; /**< VID[15:8] Analog Devices Vendor ID */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Vendor_H_t; + +/*@}*/ + +/** @defgroup Stream_Mode Stream Mode (Stream_Mode) Register + * Stream Mode (Stream_Mode) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Stream_Mode_Struct + *! \brief Stream Mode Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Stream_Mode_t { + union { + struct { + uint8_t Loop_Count : 8; /**< Sets the Data Byte Count Before Looping to Start Address */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Stream_Mode_t; + +/*@}*/ + +/** @defgroup Transfer_Config Transfer Config (Transfer_Config) Register + * Transfer Config (Transfer_Config) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_Transfer_Config_Stream_Mode + *! \brief When Streaming, Controls Master-Slave Transfer (Stream_Mode) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_TRANSFER_CONFIG_UPDATE_ON_WRITE = 0, /**< Transfers after each byte/mulit-byte register */ + ADISENSE_SPI_TRANSFER_CONFIG_UPDATE_ON_ADDRESS_LOOP = 1 /**< Transfers when address loops */ +} ADI_ADISENSE_SPI_Transfer_Config_Stream_Mode; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Transfer_Config_Struct + *! \brief Transfer Config Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Transfer_Config_t { + union { + struct { + uint8_t reserved0 : 1; + uint8_t Stream_Mode : 1; /**< When Streaming, Controls Master-Slave Transfer */ + uint8_t reserved2 : 6; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Transfer_Config_t; + +/*@}*/ + +/** @defgroup Interface_Config_C Interface Configuration C (Interface_Config_C) Register + * Interface Configuration C (Interface_Config_C) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_Interface_Config_C_Strict_Register_Access + *! \brief Multi-byte Registers Must Be Read/Written in Full (Strict_Register_Access) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_INTERFACE_CONFIG_C_NORMAL_ACCESS = 0, /**< Normal mode, no access restrictions */ + ADISENSE_SPI_INTERFACE_CONFIG_C_STRICT_ACCESS = 1 /**< Strict mode, multi-byte registers require all bytes read/written */ +} ADI_ADISENSE_SPI_Interface_Config_C_Strict_Register_Access; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_SPI_Interface_Config_C_CRC_Enable + *! \brief CRC Enable (CRC_Enable) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_SPI_INTERFACE_CONFIG_C_DISABLED = 0, /**< CRC Disabled */ + ADISENSE_SPI_INTERFACE_CONFIG_C_ENABLED = 1 /**< CRC Enabled */ +} ADI_ADISENSE_SPI_Interface_Config_C_CRC_Enable; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Interface_Config_C_Struct + *! \brief Interface Configuration C Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Interface_Config_C_t { + union { + struct { + uint8_t CRC_EnableB : 2; /**< Inverted CRC Enable */ + uint8_t reserved2 : 3; + uint8_t Strict_Register_Access : 1; /**< Multi-byte Registers Must Be Read/Written in Full */ + uint8_t CRC_Enable : 2; /**< CRC Enable */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Interface_Config_C_t; + +/*@}*/ + +/** @defgroup Interface_Status_A Interface Status A (Interface_Status_A) Register + * Interface Status A (Interface_Status_A) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_SPI_Interface_Status_A_Struct + *! \brief Interface Status A Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_SPI_Interface_Status_A_t { + union { + struct { + uint8_t Address_Invalid_Error : 1; /**< Attempt to Read/Write Non-existent Register Address */ + uint8_t Register_Partial_Access_Error : 1; /**< Set When Fewer Than Expected Number of Bytes Read/Written */ + uint8_t Wr_To_Rd_Only_Reg_Error : 1; /**< Write to Read-Only Register Attempted */ + uint8_t CRC_Error : 1; /**< Invalid/No CRC Received */ + uint8_t Clock_Count_Error : 1; /**< Incorrect Number of Clocks Detected in a Transaction */ + uint8_t reserved5 : 2; + uint8_t Not_Ready_Error : 1; /**< Device Not Ready for Transaction */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_SPI_Interface_Status_A_t; + +/*@}*/ + +/** @defgroup Command Special Command (Command) Register + * Special Command (Command) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Command_Special_Command + *! \brief Special Command (Special_Command) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_COMMAND_NOP = 0, /**< No Command */ + ADISENSE_CORE_COMMAND_CONVERT = 1, /**< Start ADC Conversions */ + ADISENSE_CORE_COMMAND_CONVERT_WITH_RAW = 2, /**< Start Conversions with Added RAW ADC Data */ + ADISENSE_CORE_COMMAND_RUN_DIAGNOSTICS = 3, /**< Initiate a Diagnostics Cycle */ + ADISENSE_CORE_COMMAND_SELF_CALIBRATION = 4, /**< Initiate a Self-Calibration Cycle */ + ADISENSE_CORE_COMMAND_LOAD_CONFIG = 5, /**< Load Registers with Configuration from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_CONFIG = 6, /**< Store Current Register Configuration to FLASH */ + ADISENSE_CORE_COMMAND_LATCH_CONFIG = 7, /**< Latch Configuration. */ + ADISENSE_CORE_COMMAND_LOAD_LUT = 8, /**< Load LUT from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_LUT2 = 9, /**< Save LUT to FLASH */ + ADISENSE_CORE_COMMAND_SYSTEM_CHECK = 10 /**< Full Suite of Measurement Diagnostics */ +} ADI_ADISENSE_CORE_Command_Special_Command; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Command_Struct + *! \brief Special Command Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Command_t { + union { + struct { + uint8_t Special_Command : 8; /**< Special Command */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Command_t; + +/*@}*/ + +/** @defgroup Mode Operating Mode and DRDY Control (Mode) Register + * Operating Mode and DRDY Control (Mode) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Mode_Conversion_Mode + *! \brief Conversion Mode (Conversion_Mode) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_MODE_SINGLECYCLE = 0, /**< Single Cycle */ + ADISENSE_CORE_MODE_MULTICYCLE = 1, /**< Multi Cycle */ + ADISENSE_CORE_MODE_CONTINUOUS = 2, /**< Continuous Conversion */ + ADISENSE_CORE_MODE_MODE3 = 3 /**< Undefined */ +} ADI_ADISENSE_CORE_Mode_Conversion_Mode; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Mode_Drdy_Mode + *! \brief Indicates Behavior of DRDY with Respect to FIFO State (Drdy_Mode) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_MODE_DRDY_PER_CONVERSION = 0, /**< Data Ready Per Conversion */ + ADISENSE_CORE_MODE_DRDY_PER_CYCLE = 1, /**< Data Ready Per Cycle */ + ADISENSE_CORE_MODE_DRDY_PER_FIFO_FILL = 2, /**< Data Ready Per FIFO Fill */ + ADISENSE_CORE_MODE_DRDY_MODE3 = 3 /**< Undefined */ +} ADI_ADISENSE_CORE_Mode_Drdy_Mode; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Mode_Struct + *! \brief Operating Mode and DRDY Control Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Mode_t { + union { + struct { + uint8_t Conversion_Mode : 2; /**< Conversion Mode */ + uint8_t Drdy_Mode : 2; /**< Indicates Behavior of DRDY with Respect to FIFO State */ + uint8_t reserved4 : 4; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Mode_t; + +/*@}*/ + +/** @defgroup Power_Config General Configuration (Power_Config) Register + * General Configuration (Power_Config) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Power_Config_Power_Mode_ADC + *! \brief ADC Power Mode (Power_Mode_ADC) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_POWER_CONFIG_ADC_LOW_POWER = 0, /**< ADC Low Power Mode */ + ADISENSE_CORE_POWER_CONFIG_ADC_MID_POWER = 1, /**< ADC Mid Power Mode */ + ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER = 2, /**< ADC Full Power Mode */ + ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER2 = 3 /**< ADC Full Power Mode2 */ +} ADI_ADISENSE_CORE_Power_Config_Power_Mode_ADC; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Power_Config_Struct + *! \brief General Configuration Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Power_Config_t { + union { + struct { + uint8_t Power_Mode_ADC : 2; /**< ADC Power Mode */ + uint8_t Power_Mode_MCU : 2; /**< MCU Power Mode */ + uint8_t Stdby_En : 1; /**< Standby */ + uint8_t reserved5 : 3; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Power_Config_t; + +/*@}*/ + +/** @defgroup Cycle_Control Measurement Cycle (Cycle_Control) Register + * Measurement Cycle (Cycle_Control) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Cycle_Control_Cycle_Time_Units + *! \brief Units for Cycle Time (Cycle_Time_Units) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_CYCLE_CONTROL_MICROSECONDS = 0, /**< Micro-Seconds */ + ADISENSE_CORE_CYCLE_CONTROL_MILLISECONDS = 1, /**< Milli-Seconds */ + ADISENSE_CORE_CYCLE_CONTROL_SECONDS = 2, /**< Seconds */ + ADISENSE_CORE_CYCLE_CONTROL_UNDEFINED = 3 /**< Undefined */ +} ADI_ADISENSE_CORE_Cycle_Control_Cycle_Time_Units; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Cycle_Control_Struct + *! \brief Measurement Cycle Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Cycle_Control_t { + union { + struct { + uint16_t Cycle_Time : 12; /**< Duration of a Full Measurement Cycle */ + uint16_t reserved12 : 2; + uint16_t Cycle_Time_Units : 2; /**< Units for Cycle Time */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Cycle_Control_t; + +/*@}*/ + +/** @defgroup Fifo_Num_Cycles Number of Measurement Cycles to Store in FIFO (Fifo_Num_Cycles) Register + * Number of Measurement Cycles to Store in FIFO (Fifo_Num_Cycles) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Fifo_Num_Cycles_Struct + *! \brief Number of Measurement Cycles to Store in FIFO Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Fifo_Num_Cycles_t { + union { + struct { + uint8_t Fifo_Num_Cycles : 8; /**< How Many Cycles to Fill FIFO */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Fifo_Num_Cycles_t; + +/*@}*/ + +/** @defgroup Multi_Cycle_Repeat_Interval Time Between Repeats of Multi-Cycle Conversions.... (Multi_Cycle_Repeat_Interval) Register + * Time Between Repeats of Multi-Cycle Conversions.... (Multi_Cycle_Repeat_Interval) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Multi_Cycle_Repeat_Interval_Struct + *! \brief Time Between Repeats of Multi-Cycle Conversions.... Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Multi_Cycle_Repeat_Interval_t { + union { + struct { + uint32_t Multi_Cycle_Repeat_Interval : 24; /**< Defines Time Between Repetitions of Measurement Cycles. */ + uint32_t reserved24 : 8; + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Multi_Cycle_Repeat_Interval_t; + +/*@}*/ + +/** @defgroup Status General Status (Status) Register + * General Status (Status) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Status_Struct + *! \brief General Status Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Status_t { + union { + struct { + uint8_t reserved0 : 1; + uint8_t Alert_Active : 1; /**< Indicates One or More Sensors Alerts are Active */ + uint8_t Error : 1; /**< Indicates an Error */ + uint8_t Drdy : 1; /**< Indicates a New Sensor Result is Available to Be Read */ + uint8_t Cmd_Running : 1; /**< Indicates a Special Command is Active */ + uint8_t FIFO_Error : 1; /**< Indicates Error with FIFO */ + uint8_t reserved6 : 2; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Status_t; + +/*@}*/ + +/** @defgroup Diagnostics_Status Diagnostics Status (Diagnostics_Status) Register + * Diagnostics Status (Diagnostics_Status) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Diagnostics_Status_Struct + *! \brief Diagnostics Status Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Diagnostics_Status_t { + union { + struct { + uint16_t Diag_Checksum_Error : 1; /**< Indicates Error on Internal Checksum Calculations */ + uint16_t Diag_Comms_Error : 1; /**< Indicates Error on Internal Device Communications */ + uint16_t Diag_Supply_Monitor_Error : 1; /**< Indicates Low Voltage on Internal Supply Voltages */ + uint16_t Diag_Supply_Cap_Error : 1; /**< Indicates Fault on Internal Supply Regulator Capacitor */ + uint16_t reserved4 : 4; + uint16_t Diag_Ainm_UV_Error : 1; /**< Indicates Under-Voltage Error on Negative Analog Input */ + uint16_t Diag_Ainm_OV_Error : 1; /**< Indicates Over-Voltage Error on Negative Analog Input */ + uint16_t Diag_Ainp_UV_Error : 1; /**< Indicates Under-Voltage Error on Positive Analog Input */ + uint16_t Diag_Ainp_OV_Error : 1; /**< Indicates Over-Voltage Error on Positive Analog Input */ + uint16_t Diag_Conversion_Error : 1; /**< Indicates Error During Internal ADC Conversions */ + uint16_t Diag_Calibration_Error : 1; /**< Indicates Error During Internal Device Calibrations */ + uint16_t Diagnostics_Status_Sundry : 2; /**< Sundry Diagnostics Status */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Diagnostics_Status_t; + +/*@}*/ + +/** @defgroup Channel_Alert_Status Alert Status Summary (Channel_Alert_Status) Register + * Alert Status Summary (Channel_Alert_Status) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Channel_Alert_Status_Struct + *! \brief Alert Status Summary Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Channel_Alert_Status_t { + union { + struct { + uint16_t Alert_Ch0 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch1 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch2 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch3 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch4 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch5 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch6 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch7 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch8 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch9 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch10 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch11 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch12 : 1; /**< Indicates Channel Alert is Active */ + uint16_t reserved13 : 3; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Channel_Alert_Status_t; + +/*@}*/ + +/** @defgroup Alert_Status_2 Additional Alert Status Information (Alert_Status_2) Register + * Additional Alert Status Information (Alert_Status_2) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Alert_Status_2_Struct + *! \brief Additional Alert Status Information Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Alert_Status_2_t { + union { + struct { + uint16_t reserved0 : 1; + uint16_t LUT_Error : 1; /**< Indicates Error with One or More Look-Up-Tables */ + uint16_t Configuration_Error : 1; /**< Indicates Error with Programmed Configuration */ + uint16_t reserved3 : 13; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Alert_Status_2_t; + +/*@}*/ + +/** @defgroup Alert_Detail_Ch Detailed Error Information (Alert_Detail_Ch) Register + * Detailed Error Information (Alert_Detail_Ch) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Alert_Detail_Ch_Struct + *! \brief Detailed Error Information Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Alert_Detail_Ch_t { + union { + struct { + uint16_t Time_Out : 1; /**< Indicates Time-Out Error from Digital Sensor */ + uint16_t Under_Range : 1; /**< Indicates Channel Under-Range */ + uint16_t Over_Range : 1; /**< Indicates Channel Over-Range */ + uint16_t Low_Limit : 1; /**< Indicates Sensor Result is Less Than Low Limit */ + uint16_t High_Limit : 1; /**< Indicates Sensor Result is Greater Than High Limit */ + uint16_t Sensor_Open : 1; /**< Indicates Sensor Input is Open Circuit */ + uint16_t Ref_Detect : 1; /**< Indicates Whether ADC Reference is Valid */ + uint16_t reserved7 : 1; + uint16_t Config_Err : 1; /**< Indicates Configuration Error on Channel */ + uint16_t LUT_Error_Ch : 1; /**< Indicates Error with Channel Look-Up-Table */ + uint16_t Under_Voltage : 1; /**< Indicates Channel Under-Voltage */ + uint16_t Over_Voltage : 1; /**< Indicates Channel Over-Voltage */ + uint16_t Correction_UnderRange : 1; /**< Indicates Result Less Than LUT/Equation Range */ + uint16_t Correction_OverRange : 1; /**< Indicates Result Larger Than LUT/Equation Range */ + uint16_t Sensor_Not_Ready : 1; /**< Indicates Digital Sensor Not Ready When Read */ + uint16_t Comp_Not_Ready : 1; /**< Indicates Compensation Channel Not Ready When Required */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Alert_Detail_Ch_t; + +/*@}*/ + +/** @defgroup Error_Code Code Indicating Source of Error (Error_Code) Register + * Code Indicating Source of Error (Error_Code) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Error_Code_Struct + *! \brief Code Indicating Source of Error Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Error_Code_t { + union { + struct { + uint16_t Error_Code : 16; /**< Code Indicating Type of Error */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Error_Code_t; + +/*@}*/ + +/** @defgroup Alert_Code Code Indicating Source of Alert (Alert_Code) Register + * Code Indicating Source of Alert (Alert_Code) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Alert_Code_Struct + *! \brief Code Indicating Source of Alert Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Alert_Code_t { + union { + struct { + uint16_t Alert_Code : 16; /**< Code Indicating Type of Alert */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Alert_Code_t; + +/*@}*/ + +/** @defgroup External_Reference1 External Reference Information (External_Reference1) Register + * External Reference Information (External_Reference1) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_External_Reference1_Struct + *! \brief External Reference Information Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_External_Reference1_t { + union { + struct { + float Ext_Refin1_Value; /**< Refin1 Value */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_External_Reference1_t; + +/*@}*/ + +/** @defgroup External_Reference2 External Reference Information (External_Reference2) Register + * External Reference Information (External_Reference2) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_External_Reference2_Struct + *! \brief External Reference Information Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_External_Reference2_t { + union { + struct { + float Ext_Refin2_Value; /**< Refin2 Value */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_External_Reference2_t; + +/*@}*/ + +/** @defgroup AVDD_Voltage AVDD Voltage (AVDD_Voltage) Register + * AVDD Voltage (AVDD_Voltage) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_AVDD_Voltage_Struct + *! \brief AVDD Voltage Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_AVDD_Voltage_t { + union { + struct { + float Avdd_Voltage; /**< AVDD Voltage */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_AVDD_Voltage_t; + +/*@}*/ + +/** @defgroup Diagnostics_Control Diagnostic Control (Diagnostics_Control) Register + * Diagnostic Control (Diagnostics_Control) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Diagnostics_Control_Diag_OSD_Freq + *! \brief Diagnostics Open Sensor Detect Frequency (Diag_OSD_Freq) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_OFF = 0, /**< No Open-Circuit Detection During Measurement */ + ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_1_CYCLE = 1, /**< Open-Circuit Detection Performed Once Per Measurement Cycle */ + ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_100_CYCLES = 2, /**< Open-Circuit Detection Performed Once Per Hundred Measurement Cycles */ + ADISENSE_CORE_DIAGNOSTICS_CONTROL_OCD_PER_1000_CYCLES = 3 /**< Open-Circuit Detection Performed Once Per Thousand Measurement Cycles */ +} ADI_ADISENSE_CORE_Diagnostics_Control_Diag_OSD_Freq; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Diagnostics_Control_Struct + *! \brief Diagnostic Control Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Diagnostics_Control_t { + union { + struct { + uint16_t Diag_Global_En : 1; /**< Diagnostics Global Enable */ + uint16_t Diag_Meas_En : 1; /**< Diagnostics Measure Enable */ + uint16_t Diag_OSD_Freq : 2; /**< Diagnostics Open Sensor Detect Frequency */ + uint16_t reserved4 : 4; + uint16_t Diagnostics_Extra : 8; /**< Additional Diagnostics Control */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Diagnostics_Control_t; + +/*@}*/ + +/** @defgroup Data_FIFO FIFO of Sensor Results (Data_FIFO) Register + * FIFO of Sensor Results (Data_FIFO) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Data_FIFO_Struct + *! \brief FIFO of Sensor Results Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Data_FIFO_t { + union { + struct { + float32_t Sensor_Result; /**< Linearized and Compensated Sensor Result */ + uint32_t Channel_ID : 4; /**< Indicates Which Channel This FIFO Data Corresponds to */ + uint32_t Ch_Error : 1; /**< Indicates Error on Channel */ + uint32_t Ch_Alert : 1; /**< Indicates Alert on Channel */ + uint32_t Ch_Raw : 1; /**< Indicates If RAW Data is Valid */ + uint32_t Ch_Valid : 1; /**< Indicates Whether Valid Data Read from FIFO */ + uint32_t Raw_Sample : 24; /**< ADC Result */ + }; + uint64_t VALUE64; + }; +} ADI_ADISENSE_CORE_Data_FIFO_t; + +/*@}*/ + +/** @defgroup LUT_Select Read/Write Strobe (LUT_Select) Register + * Read/Write Strobe (LUT_Select) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_LUT_Select_LUT_RW + *! \brief Read or Write LUT Data (LUT_RW) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_LUT_SELECT_LUT_READ = 0, /**< Read Addressed LUT Data */ + ADISENSE_CORE_LUT_SELECT_LUT_WRITE = 1 /**< Write Addressed LUT Data */ +} ADI_ADISENSE_CORE_LUT_Select_LUT_RW; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_LUT_Select_Struct + *! \brief Read/Write Strobe Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_LUT_Select_t { + union { + struct { + uint8_t reserved0 : 7; + uint8_t LUT_RW : 1; /**< Read or Write LUT Data */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_LUT_Select_t; + +/*@}*/ + +/** @defgroup LUT_Offset Offset into Selected LUT (LUT_Offset) Register + * Offset into Selected LUT (LUT_Offset) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_LUT_Offset_Struct + *! \brief Offset into Selected LUT Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_LUT_Offset_t { + union { + struct { + uint16_t LUT_Offset : 14; /**< Offset into Look-Up-Table */ + uint16_t reserved14 : 2; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_LUT_Offset_t; + +/*@}*/ + +/** @defgroup LUT_Data Data to Read/Write from Addressed LUT Entry (LUT_Data) Register + * Data to Read/Write from Addressed LUT Entry (LUT_Data) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_LUT_Data_Struct + *! \brief Data to Read/Write from Addressed LUT Entry Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_LUT_Data_t { + union { + struct { + uint8_t LUT_Data : 8; /**< Data Byte to Write to / Read from Look-Up-Table */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_LUT_Data_t; + +/*@}*/ + +/** @defgroup CAL_Offset Offset into Selected Calibration Values (CAL_Offset) Register + * Offset into Selected Calibration Values (CAL_Offset) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_CAL_Offset_Struct + *! \brief Offset into Selected Calibration Values Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_CAL_Offset_t { + union { + struct { + uint16_t CAL_Offset : 14; /**< Offset into Calibration Data */ + uint16_t reserved14 : 2; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_CAL_Offset_t; + +/*@}*/ + +/** @defgroup CAL_Data Data to Read/Write from Addressed Calibration Values (CAL_Data) Register + * Data to Read/Write from Addressed Calibration Values (CAL_Data) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_CAL_Data_Struct + *! \brief Data to Read/Write from Addressed Calibration Values Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_CAL_Data_t { + union { + struct { + uint8_t CAL_Data : 8; /**< Data to Write to / Read from Calibration Data */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_CAL_Data_t; + +/*@}*/ + +/** @defgroup Revision Hardware, Firmware Revision (Revision) Register + * Hardware, Firmware Revision (Revision) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Revision_Struct + *! \brief Hardware, Firmware Revision Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Revision_t { + union { + struct { + uint32_t Firmware_Revision : 8; /**< ID Info */ + uint32_t Hardware_Revision : 8; /**< ID Info */ + uint32_t Comms_Protocol : 8; /**< ID Info */ + uint32_t reserved24 : 8; + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Revision_t; + +/*@}*/ + +/** @defgroup Channel_Count Number of Channel Occurrences per Measurement Cycle (Channel_Count) Register + * Number of Channel Occurrences per Measurement Cycle (Channel_Count) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Channel_Count_Struct + *! \brief Number of Channel Occurrences per Measurement Cycle Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Channel_Count_t { + union { + struct { + uint8_t Channel_Count : 7; /**< How Many Times Channel Should Appear in One Cycle */ + uint8_t Channel_Enable : 1; /**< Enable Channel in Measurement Cycle */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Channel_Count_t; + +/*@}*/ + +/** @defgroup Sensor_Type Sensor Select (Sensor_Type) Register + * Sensor Select (Sensor_Type) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Sensor_Type_Sensor_Type + *! \brief Sensor Type (Sensor_Type) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_T_DEF_L1 = 0, /**< Thermocouple T-Type Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_J_DEF_L1 = 1, /**< Thermocouple J-Type Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_K_DEF_L1 = 2, /**< Thermocouple K-Type Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_1_DEF_L2 = 12, /**< Thermocouple Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_2_DEF_L2 = 13, /**< Thermocouple Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_3_DEF_L2 = 14, /**< Thermocouple Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_4_DEF_L2 = 15, /**< Thermocouple Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_T_ADV_L1 = 16, /**< Thermocouple T-Type Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_J_ADV_L1 = 17, /**< Thermocouple J-Type Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_K_ADV_L1 = 18, /**< Thermocouple K-Type Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_1_ADV_L2 = 28, /**< Thermocouple Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_2_ADV_L2 = 29, /**< Thermocouple Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_3_ADV_L2 = 30, /**< Thermocouple Sensor 3 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMOCOUPLE_4_ADV_L2 = 31, /**< Thermocouple Sensor 4 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT100_DEF_L1 = 32, /**< RTD 2 Wire PT100 Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT1000_DEF_L1 = 33, /**< RTD 2 Wire PT1000 Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_1_DEF_L2 = 44, /**< RTD 2 Wire Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_2_DEF_L2 = 45, /**< RTD 2 Wire Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_3_DEF_L2 = 46, /**< RTD 2 Wire Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_4_DEF_L2 = 47, /**< RTD 2 Wire Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT100_ADV_L1 = 48, /**< RTD 2 Wire PT100 Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_PT1000_ADV_L1 = 49, /**< RTD 2 Wire PT1000 Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_1_ADV_L2 = 60, /**< RTD 2 Wire Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_2_ADV_L2 = 61, /**< RTD 2 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_3_ADV_L2 = 62, /**< RTD 2 Wire Sensor 3 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_2W_4_ADV_L2 = 63, /**< RTD 2 Wire Sensor 4 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT100_DEF_L1 = 64, /**< RTD 3 Wire PT100 Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT1000_DEF_L1 = 65, /**< RTD 3 Wire PT1000 Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_1_DEF_L2 = 76, /**< RTD 3 Wire Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_2_DEF_L2 = 77, /**< RTD 3 Wire Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_3_DEF_L2 = 78, /**< RTD 3 Wire Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_4_DEF_L2 = 79, /**< RTD 3 Wire Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT100_ADV_L1 = 80, /**< RTD 3 Wire PT100 Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_PT1000_ADV_L1 = 81, /**< RTD 3 Wire PT1000 Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_1_ADV_L2 = 92, /**< RTD 3 Wire Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_2_ADV_L2 = 93, /**< RTD 3 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_3_ADV_L2 = 94, /**< RTD 3 Wire Sensor 3 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_3W_4_ADV_L2 = 95, /**< RTD 3 Wire Sensor 4 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT100_DEF_L1 = 96, /**< RTD 4 Wire PT100 Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT1000_DEF_L1 = 97, /**< RTD 4 Wire PT1000 Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_1_DEF_L2 = 108, /**< RTD 4 Wire Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_2_DEF_L2 = 109, /**< RTD 4 Wire Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_3_DEF_L2 = 110, /**< RTD 4 Wire Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_4_DEF_L2 = 111, /**< RTD 4 Wire Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT100_ADV_L1 = 112, /**< RTD 4 Wire PT100 Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_PT1000_ADV_L1 = 113, /**< RTD 4 Wire PT1000 Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_1_ADV_L2 = 124, /**< RTD 4 Wire Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_2_ADV_L2 = 125, /**< RTD 4 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_3_ADV_L2 = 126, /**< RTD 4 Wire Sensor 3 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_RTD_4W_4_ADV_L2 = 127, /**< RTD 4 Wire Sensor 4 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_A_10K_DEF_L1 = 128, /**< Thermistor Type A 10kOhm Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_B_10K_DEF_L1 = 129, /**< Thermistor Type B 10kOhm Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_1_DEF_L2 = 140, /**< Thermistor Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_2_DEF_L2 = 141, /**< Thermistor Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_3_DEF_L2 = 142, /**< Thermistor Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_4_DEF_L2 = 143, /**< Thermistor Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_A_10K_ADV_L1 = 144, /**< Thermistor Type A 10kOhm Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_B_10K_ADV_L1 = 145, /**< Thermistor Type B 10kOhm Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_1_ADV_L2 = 156, /**< Thermistor Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_2_ADV_L2 = 157, /**< Thermistor Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_3_ADV_L2 = 158, /**< Thermistor Sensor 3 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_THERMISTOR_4_ADV_L2 = 159, /**< Thermistor Sensor 4 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_1_DEF_L2 = 160, /**< Bridge 4 Wire Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_2_DEF_L2 = 161, /**< Bridge 4 Wire Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_3_DEF_L2 = 162, /**< Bridge 4 Wire Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_4_DEF_L2 = 163, /**< Bridge 4 Wire Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_1_ADV_L2 = 176, /**< Bridge 4 Wire Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_2_ADV_L2 = 177, /**< Bridge 4 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_3_ADV_L2 = 178, /**< Bridge 4 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_4W_4_ADV_L2 = 179, /**< Bridge 4 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_1_DEF_L2 = 192, /**< Bridge 6 Wire Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_2_DEF_L2 = 193, /**< Bridge 6 Wire Sensor 2 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_3_DEF_L2 = 194, /**< Bridge 6 Wire Sensor 3 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_4_DEF_L2 = 195, /**< Bridge 6 Wire Sensor 4 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_1_ADV_L2 = 208, /**< Bridge 6 Wire Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_2_ADV_L2 = 209, /**< Bridge 6 Wire Sensor 2 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_3_ADV_L2 = 210, /**< Bridge 6 Wire Sensor 3 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_BRIDGE_6W_4_ADV_L2 = 211, /**< Bridge 6 Wire Sensor 4 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE = 256, /**< Voltage Input */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY = 272, /**< Voltage Output Pressure Sensor 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X = 273, /**< Voltage Output Pressure Sensor 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_3_DEF = 274, /**< Voltage Output Pressure Sensor 3 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT = 384, /**< Current Input */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2 = 385, /**< Current Output Pressure Sensor 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_2 = 386, /**< Current Output Pressure Sensor 2 */ + ADISENSE_CORE_SENSOR_TYPE_CUSTOM1 = 512, /**< Custom1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_PRESSURE_1 = 2048, /**< I2C Pressure Sensor 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_PRESSURE_2 = 2049, /**< I2C Pressure Sensor 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_HUMIDITY_HONEYWELL_HUMIDICON = 2112, /**< I2C Humidity Sensor 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_HUMIDITY_SENSIRION_SHT3X = 2113, /**< I2C Humidity Sensor 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_PRESSURE_HONEYWELL_TRUSTABILITY = 3072, /**< SPI Pressure Sensor 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_PRESSURE_2 = 3073, /**< SPI Pressure Sensor 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_HUMIDITY_1 = 3136, /**< SPI Humidity Sensor Type 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_HUMIDITY_2 = 3137, /**< SPI Humidity Sensor Type 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_1 = 3200, /**< SPI Accelerometer Sensor Type 1 3-Axis */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_2 = 3201 /**< SPI Accelerometer Sensor Type 2 3-Axis */ +} ADI_ADISENSE_CORE_Sensor_Type_Sensor_Type; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Sensor_Type_Struct + *! \brief Sensor Select Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Sensor_Type_t { + union { + struct { + uint16_t Sensor_Type : 12; /**< Sensor Type */ + uint16_t reserved12 : 4; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Sensor_Type_t; + +/*@}*/ + +/** @defgroup Sensor_Details Sensor Details (Sensor_Details) Register + * Sensor Details (Sensor_Details) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Sensor_Details_Measurement_Units + *! \brief Units of Sensor Measurement (Measurement_Units) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_SENSOR_DETAILS_UNITS_DEGC = 0, /**< Degrees C */ + ADISENSE_CORE_SENSOR_DETAILS_UNITS_DEGF = 1 /**< Degrees F */ +} ADI_ADISENSE_CORE_Sensor_Details_Measurement_Units; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Sensor_Details_Reference_Select + *! \brief Reference Selection (Reference_Select) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_SENSOR_DETAILS_REF_INT = 0, /**< Internal Reference */ + ADISENSE_CORE_SENSOR_DETAILS_REF_AVDD = 1, /**< AVDD */ + ADISENSE_CORE_SENSOR_DETAILS_REF_VEXT1 = 2, /**< External Voltage on Refin1 */ + ADISENSE_CORE_SENSOR_DETAILS_REF_VEXT2 = 3, /**< External Voltage on Refin2 */ + ADISENSE_CORE_SENSOR_DETAILS_REF_RINT1 = 4, /**< Internal Resistor1 */ + ADISENSE_CORE_SENSOR_DETAILS_REF_RINT2 = 5, /**< Internal Resistor2 */ + ADISENSE_CORE_SENSOR_DETAILS_REF_REXT1 = 6, /**< External Resistor on Refin1 */ + ADISENSE_CORE_SENSOR_DETAILS_REF_REXT2 = 7, /**< External Resistor on Refin2 */ + ADISENSE_CORE_SENSOR_DETAILS_REF_EXC = 8 /**< Bridge Excitation Voltage */ +} ADI_ADISENSE_CORE_Sensor_Details_Reference_Select; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Sensor_Details_PGA_Gain + *! \brief PGA Gain (PGA_Gain) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_1 = 0, /**< Gain of 1 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_2 = 1, /**< Gain of 2 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_4 = 2, /**< Gain of 4 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_8 = 3, /**< Gain of 8 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_16 = 4, /**< Gain of 16 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_32 = 5, /**< Gain of 32 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_64 = 6, /**< Gain of 64 */ + ADISENSE_CORE_SENSOR_DETAILS_PGA_GAIN_128 = 7 /**< Gain of 128 */ +} ADI_ADISENSE_CORE_Sensor_Details_PGA_Gain; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Sensor_Details_Struct + *! \brief Sensor Details Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Sensor_Details_t { + union { + struct { + uint32_t Measurement_Units : 4; /**< Units of Sensor Measurement */ + uint32_t Compensation_Channel : 4; /**< Indicates Which Channel is Used to Compensate Sensor Result */ + uint32_t Compensation_Channel2 : 4; /**< Indicates Channel for Second Term of Compensation */ + uint32_t Compensation_Channel3 : 4; /**< Indicates Channel for Third Term of Compensation */ + uint32_t reserved16 : 1; + uint32_t Do_Not_Publish : 1; /**< Do Not Publish Channel Result */ + uint32_t Reference_Buffer_Disable : 1; /**< Enable or Disable ADC Reference Buffer */ + uint32_t Vbias : 1; /**< Controls ADC Vbias Output */ + uint32_t Reference_Select : 4; /**< Reference Selection */ + uint32_t PGA_Gain : 3; /**< PGA Gain */ + uint32_t reserved27 : 1; + uint32_t Averaging : 3; /**< Number of ADC Results to Average */ + uint32_t reserved31 : 1; + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Sensor_Details_t; + +/*@}*/ + +/** @defgroup Channel_Excitation Excitation Current (Channel_Excitation) Register + * Excitation Current (Channel_Excitation) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Channel_Excitation_IOUT_Excitation_Current + *! \brief Current Source Value (IOUT_Excitation_Current) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_OFF = 0, /**< Disabled */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_50UA = 1, /**< 50 \mu;A */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_100UA = 2, /**< 100 \mu;A */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_250UA = 3, /**< 250 \mu;A */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_500UA = 4, /**< 500 \mu;A */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_750UA = 5, /**< 750 \mu;A */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_1000UA = 6, /**< 1000 \mu;A */ + ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_1000UA_2 = 7 /**< 1000 \mu;A */ +} ADI_ADISENSE_CORE_Channel_Excitation_IOUT_Excitation_Current; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Channel_Excitation_Struct + *! \brief Excitation Current Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Channel_Excitation_t { + union { + struct { + uint8_t IOUT_Excitation_Current : 3; /**< Current Source Value */ + uint8_t IOUT0_Disable : 1; /**< Disable First Current Source */ + uint8_t IOUT1_Disable : 1; /**< Disable Second Current Source */ + uint8_t reserved5 : 1; + uint8_t IOUT_Static_Swap_3Wire : 1; /**< Indicates 3-Wire Excitation Currents Should Be Swapped */ + uint8_t IOUT_Dont_Swap_3Wire : 1; /**< Indicates 3-Wire Excitation Currents Should Not Be Swapped */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Channel_Excitation_t; + +/*@}*/ + +/** @defgroup Settling_Time Settling Time (Settling_Time) Register + * Settling Time (Settling_Time) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Settling_Time_Struct + *! \brief Settling Time Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Settling_Time_t { + union { + struct { + uint16_t Settling_Time : 16; /**< Settling Time to Allow When Switching to Channel */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Settling_Time_t; + +/*@}*/ + +/** @defgroup Filter_Select ADC Digital Filter Selection (Filter_Select) Register + * ADC Digital Filter Selection (Filter_Select) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Filter_Select_ADC_Filter_Type + *! \brief ADC Digital Filter Type (ADC_Filter_Type) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_FILTER_SELECT_FILTER_FIR_25SPS = 0, /**< FIR Filter 25 SPS */ + ADISENSE_CORE_FILTER_SELECT_FILTER_FIR_20SPS = 1, /**< FIR Filter 20 SPS */ + ADISENSE_CORE_FILTER_SELECT_FILTER_SINC4 = 2, /**< Sinc4 Filter */ + ADISENSE_CORE_FILTER_SELECT_FILTER_TBD = 3 /**< TBD Filter */ +} ADI_ADISENSE_CORE_Filter_Select_ADC_Filter_Type; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Filter_Select_Struct + *! \brief ADC Digital Filter Selection Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Filter_Select_t { + union { + struct { + uint32_t ADC_FS : 11; /**< ADC Digital Filter Select */ + uint32_t ADC_Filter_Type : 5; /**< ADC Digital Filter Type */ + uint32_t reserved16 : 16; + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Filter_Select_t; + +/*@}*/ + +/** @defgroup High_Threshold_Limit High Threshold (High_Threshold_Limit) Register + * High Threshold (High_Threshold_Limit) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_High_Threshold_Limit_Struct + *! \brief High Threshold Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_High_Threshold_Limit_t { + union { + struct { + float High_Threshold; /**< Upper Limit for Sensor Alert Comparison */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_High_Threshold_Limit_t; + +/*@}*/ + +/** @defgroup Low_Threshold_Limit Low Threshold (Low_Threshold_Limit) Register + * Low Threshold (Low_Threshold_Limit) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Low_Threshold_Limit_Struct + *! \brief Low Threshold Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Low_Threshold_Limit_t { + union { + struct { + float Low_Threshold; /**< Lower Limit for Sensor Alert Comparison */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_Low_Threshold_Limit_t; + +/*@}*/ + +/** @defgroup Sensor_Offset Sensor Offset Adjustment (Sensor_Offset) Register + * Sensor Offset Adjustment (Sensor_Offset) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Sensor_Offset_Struct + *! \brief Sensor Offset Adjustment Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Sensor_Offset_t { + union { + struct { + float Sensor_Offset; /**< Sensor Offset Adjustment */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_Sensor_Offset_t; + +/*@}*/ + +/** @defgroup Sensor_Gain Sensor Gain Adjustment (Sensor_Gain) Register + * Sensor Gain Adjustment (Sensor_Gain) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Sensor_Gain_Struct + *! \brief Sensor Gain Adjustment Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Sensor_Gain_t { + union { + struct { + float Sensor_Gain; /**< Sensor Gain Adjustment */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_Sensor_Gain_t; + +/*@}*/ + +/** @defgroup Alert_Code_Ch Per-Channel Detailed Alert-Code Information (Alert_Code_Ch) Register + * Per-Channel Detailed Alert-Code Information (Alert_Code_Ch) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Alert_Code_Ch_Struct + *! \brief Per-Channel Detailed Alert-Code Information Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Alert_Code_Ch_t { + union { + struct { + uint16_t Alert_Code_Ch : 16; /**< Per-Channel Code Indicating Type of Alert */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Alert_Code_Ch_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Config Digital Sensor Data Coding (Digital_Sensor_Config) Register + * Digital Sensor Data Coding (Digital_Sensor_Config) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Digital_Sensor_Config_Digital_Sensor_Coding + *! \brief Data Encoding of Sensor Result (Digital_Sensor_Coding) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_NONE = 0, /**< None/Invalid */ + ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_UNIPOLAR = 1, /**< Unipolar */ + ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_TWOS_COMPL = 2, /**< Twos Complement */ + ADISENSE_CORE_DIGITAL_SENSOR_CONFIG_CODING_OFFSET_BINARY = 3, /**< Offset Binary */ +} ADI_ADISENSE_CORE_Digital_Sensor_Config_Digital_Sensor_Coding; + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Config_Struct + *! \brief Digital Sensor Data Coding Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Config_t { + union { + struct { + uint16_t Digital_Sensor_Coding : 2; /**< Data Encoding of Sensor Result */ + uint16_t Digital_Sensor_LittleEndian : 1; /**< Data Endianness of Sensor Result */ + uint16_t Digital_Sensor_LeftAligned : 1; /**< Data Alignment within the data frame */ + uint16_t Digital_Sensor_Bit_Offset : 4; /**< Data Bit Offset, relative to alignment */ + uint16_t Digital_Sensor_Read_Bytes : 3; /**< Number of bytes to read from the sensor, minus 1 */ + uint16_t Digital_Sensor_Data_Bits : 5; /**< Number of Relevant Data Bits, minus 1 */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Config_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Address Sensor Address (Digital_Sensor_Address) Register + * Sensor Address (Digital_Sensor_Address) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Address_Struct + *! \brief Sensor Address Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Address_t { + union { + struct { + uint8_t Digital_Sensor_Address : 8; /**< I2C Address or Write Address Command for SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Address_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Num_Cmds Number of Configuration, Read Commands for Digital Sensors (Digital_Sensor_Num_Cmds) Register + * Number of Configuration, Read Commands for Digital Sensors (Digital_Sensor_Num_Cmds) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Num_Cmds_Struct + *! \brief Number of Configuration, Read Commands for Digital Sensors Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Num_Cmds_t { + union { + struct { + uint8_t Digital_Sensor_Num_Cfg_Cmds : 3; /**< Number of Configuration Commands for Digital Sensor */ + uint8_t reserved3 : 1; + uint8_t Digital_Sensor_Num_Read_Cmds : 3; /**< Number of Read Commands for Digital Sensor */ + uint8_t reserved7 : 1; + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Num_Cmds_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command1 Sensor Configuration Command1 (Digital_Sensor_Command1) Register + * Sensor Configuration Command1 (Digital_Sensor_Command1) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command1_Struct + *! \brief Sensor Configuration Command1 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command1_t { + union { + struct { + uint8_t Digital_Sensor_Command1 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command1_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command2 Sensor Configuration Command2 (Digital_Sensor_Command2) Register + * Sensor Configuration Command2 (Digital_Sensor_Command2) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command2_Struct + *! \brief Sensor Configuration Command2 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command2_t { + union { + struct { + uint8_t Digital_Sensor_Command2 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command2_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command3 Sensor Configuration Command3 (Digital_Sensor_Command3) Register + * Sensor Configuration Command3 (Digital_Sensor_Command3) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command3_Struct + *! \brief Sensor Configuration Command3 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command3_t { + union { + struct { + uint8_t Digital_Sensor_Command3 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command3_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command4 Sensor Configuration Command4 (Digital_Sensor_Command4) Register + * Sensor Configuration Command4 (Digital_Sensor_Command4) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command4_Struct + *! \brief Sensor Configuration Command4 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command4_t { + union { + struct { + uint8_t Digital_Sensor_Command4 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command4_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command5 Sensor Configuration Command5 (Digital_Sensor_Command5) Register + * Sensor Configuration Command5 (Digital_Sensor_Command5) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command5_Struct + *! \brief Sensor Configuration Command5 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command5_t { + union { + struct { + uint8_t Digital_Sensor_Command5 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command5_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command6 Sensor Configuration Command6 (Digital_Sensor_Command6) Register + * Sensor Configuration Command6 (Digital_Sensor_Command6) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command6_Struct + *! \brief Sensor Configuration Command6 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command6_t { + union { + struct { + uint8_t Digital_Sensor_Command6 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command6_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Command7 Sensor Configuration Command7 (Digital_Sensor_Command7) Register + * Sensor Configuration Command7 (Digital_Sensor_Command7) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Command7_Struct + *! \brief Sensor Configuration Command7 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Command7_t { + union { + struct { + uint8_t Digital_Sensor_Command7 : 8; /**< Configuration Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Command7_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd1 Sensor Read Command1 (Digital_Sensor_Read_Cmd1) Register + * Sensor Read Command1 (Digital_Sensor_Read_Cmd1) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd1_Struct + *! \brief Sensor Read Command1 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd1_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd1 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd1_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd2 Sensor Read Command2 (Digital_Sensor_Read_Cmd2) Register + * Sensor Read Command2 (Digital_Sensor_Read_Cmd2) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd2_Struct + *! \brief Sensor Read Command2 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd2_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd2 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd2_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd3 Sensor Read Command3 (Digital_Sensor_Read_Cmd3) Register + * Sensor Read Command3 (Digital_Sensor_Read_Cmd3) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd3_Struct + *! \brief Sensor Read Command3 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd3_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd3 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd3_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd4 Sensor Read Command4 (Digital_Sensor_Read_Cmd4) Register + * Sensor Read Command4 (Digital_Sensor_Read_Cmd4) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd4_Struct + *! \brief Sensor Read Command4 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd4_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd4 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd4_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd5 Sensor Read Command5 (Digital_Sensor_Read_Cmd5) Register + * Sensor Read Command5 (Digital_Sensor_Read_Cmd5) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd5_Struct + *! \brief Sensor Read Command5 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd5_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd5 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd5_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd6 Sensor Read Command6 (Digital_Sensor_Read_Cmd6) Register + * Sensor Read Command6 (Digital_Sensor_Read_Cmd6) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd6_Struct + *! \brief Sensor Read Command6 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd6_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd6 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd6_t; + +/*@}*/ + +/** @defgroup Digital_Sensor_Read_Cmd7 Sensor Read Command7 (Digital_Sensor_Read_Cmd7) Register + * Sensor Read Command7 (Digital_Sensor_Read_Cmd7) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd7_Struct + *! \brief Sensor Read Command7 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd7_t { + union { + struct { + uint8_t Digital_Sensor_Read_Cmd7 : 8; /**< Per Conversion Command to Send to Digital I2C/SPI Sensor */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Read_Cmd7_t; + +/*@}*/ + +/** @defgroup test_reg_0 Test Register 0 (test_reg_0) Register + * Test Register 0 (test_reg_0) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADSENSE_TEST_test_reg_0_Struct + *! \brief Test Register 0 Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADSENSE_TEST_test_reg_0_t { + union { + struct { + uint8_t Test_Command : 8; /**< Test_Command */ + }; + }; +} ADI_ADSENSE_TEST_test_reg_0_t; + +/*@}*/ + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_test_adc_cal_temp + *! \brief ADC-derived calibration temperature + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_test_adc_cal_temp_t { + union { + struct { + float Temperature; /**< Current temperature from ADC, used for calibration unless REG_ADISENSE_TEST_USER_CAL_TEMP is set */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_test_adc_cal_temp_t; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_test_user_cal_temp + *! \brief User-specified calibration temperature + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_test_user_cal_temp_t { + union { + struct { + float Temperature; /**< Fixed temperature reference to use for calibration. Ignored if set as NaN. */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_test_user_cal_temp_t; + +#if defined (__CC_ARM) +#pragma pop +#endif + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/crc16.c Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,75 @@ +/* + * Copyright 2001-2010 Georges Menie (www.menie.org) + * 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 the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, 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. + */ + +#include "crc16.h" + +/* CRC16 implementation acording to CCITT standards */ + +static const unsigned short crc16tab[256]= { + 0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7, + 0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef, + 0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6, + 0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de, + 0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485, + 0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d, + 0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4, + 0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc, + 0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823, + 0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b, + 0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12, + 0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a, + 0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41, + 0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49, + 0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70, + 0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78, + 0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f, + 0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067, + 0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e, + 0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256, + 0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d, + 0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405, + 0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c, + 0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634, + 0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab, + 0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3, + 0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a, + 0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92, + 0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9, + 0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1, + 0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8, + 0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0 +}; + +unsigned short crc16_ccitt(const void *buf, int len) +{ + register int counter; + register unsigned short crc = 0; + for( counter = 0; counter < len; counter++) + crc = (crc<<8) ^ crc16tab[((crc>>8) ^ *(char *)buf++)&0x00FF]; + return crc; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/crc16.h Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,34 @@ +/* + * Copyright 2001-2010 Georges Menie (www.menie.org) + * 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 the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, 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 _CRC16_H_ +#define _CRC16_H_ + +unsigned short crc16_ccitt(const void *buf, int len); + +#endif /* _CRC16_H_ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mbed/adi_sense_gpio.cpp Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,290 @@ +/*! + ****************************************************************************** + * @file: adi_sense_gpio.cpp + * @brief: ADI Sense OS-dependent wrapper layer for GPIO interface + *----------------------------------------------------------------------------- + */ + +/****************************************************************************** +Copyright 2017 (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. + * + *****************************************************************************/ + +#include <mbed.h> + +#include "inc/adi_sense_gpio.h" +#include "inc/adi_sense_log.h" + +class GpioContext +{ +public: + GpioContext( + PinName resetPin, + PinName errorPin, + PinName alertPin, + PinName datareadyPin) + : _reset(resetPin), + _error(errorPin), + _alert(alertPin), + _dataready(datareadyPin), + _errorIrq(errorPin), + _alertIrq(alertPin), + _datareadyIrq(datareadyPin) {} + + ADI_SENSE_RESULT get( + ADI_SENSE_GPIO_PIN ePinId, + bool_t *pState); + + ADI_SENSE_RESULT set( + ADI_SENSE_GPIO_PIN ePinId, + bool_t state); + + ADI_SENSE_RESULT enableIrq( + ADI_SENSE_GPIO_PIN ePinId, + ADI_SENSE_GPIO_CALLBACK callbackFn, + void *pArg); + + ADI_SENSE_RESULT disableIrq( + ADI_SENSE_GPIO_PIN ePinId); + +private: + DigitalOut _reset; + + DigitalIn _error; + DigitalIn _alert; + DigitalIn _dataready; + + InterruptIn _errorIrq; + InterruptIn _alertIrq; + InterruptIn _datareadyIrq; + + ADI_SENSE_GPIO_CALLBACK _errorIrqCallback; + ADI_SENSE_GPIO_CALLBACK _alertIrqCallback; + ADI_SENSE_GPIO_CALLBACK _datareadyIrqCallback; + + void *_errorIrqArg; + void *_alertIrqArg; + void *_datareadyIrqArg; + + void _errorIrqHandler() + { + _errorIrqCallback(ADI_SENSE_GPIO_PIN_ERROR, _errorIrqArg); + } + void _alertIrqHandler() + { + _alertIrqCallback(ADI_SENSE_GPIO_PIN_ALERT, _alertIrqArg); + } + void _datareadyIrqHandler() + { + _datareadyIrqCallback(ADI_SENSE_GPIO_PIN_DATAREADY, _datareadyIrqArg); + } +}; + +ADI_SENSE_RESULT GpioContext::get( + ADI_SENSE_GPIO_PIN ePinId, + bool_t *pState) +{ + switch(ePinId) + { + case ADI_SENSE_GPIO_PIN_ERROR: + *pState = _error; + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_ALERT: + *pState = _alert; + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_DATAREADY: + *pState = _dataready; + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_RESET: + *pState = _reset; + return ADI_SENSE_SUCCESS; + default: + return ADI_SENSE_INVALID_DEVICE_NUM; + } +} + +ADI_SENSE_RESULT GpioContext::set( + ADI_SENSE_GPIO_PIN ePinId, + bool_t state) +{ + switch(ePinId) + { + case ADI_SENSE_GPIO_PIN_RESET: + _reset = state; + break; + default: + return ADI_SENSE_INVALID_DEVICE_NUM; + } + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT GpioContext::enableIrq( + ADI_SENSE_GPIO_PIN ePinId, + ADI_SENSE_GPIO_CALLBACK callbackFn, + void *pArg) +{ + switch(ePinId) + { + case ADI_SENSE_GPIO_PIN_ERROR: + _errorIrqCallback = callbackFn; + _errorIrqArg = pArg; + _errorIrq.rise(callback(this, &GpioContext::_errorIrqHandler)); + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_ALERT: + _alertIrqCallback = callbackFn; + _alertIrqArg = pArg; + _alertIrq.rise(callback(this, &GpioContext::_alertIrqHandler)); + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_DATAREADY: + _datareadyIrqCallback = callbackFn; + _datareadyIrqArg = pArg; + _datareadyIrq.rise(callback(this, &GpioContext::_datareadyIrqHandler)); + return ADI_SENSE_SUCCESS; + default: + return ADI_SENSE_INVALID_DEVICE_NUM; + } +} + +ADI_SENSE_RESULT GpioContext::disableIrq( + ADI_SENSE_GPIO_PIN ePinId) +{ + switch(ePinId) + { + case ADI_SENSE_GPIO_PIN_ERROR: + _errorIrq.rise(NULL); + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_ALERT: + _alertIrq.rise(NULL); + return ADI_SENSE_SUCCESS; + case ADI_SENSE_GPIO_PIN_DATAREADY: + _datareadyIrq.rise(NULL); + return ADI_SENSE_SUCCESS; + default: + return ADI_SENSE_INVALID_DEVICE_NUM; + } +} + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Open the GPIO interface and allocate resources + */ +ADI_SENSE_RESULT adi_sense_GpioOpen( + ADI_SENSE_PLATFORM_GPIO_CONFIG *pConfig, + ADI_SENSE_GPIO_HANDLE *phDevice) +{ + GpioContext *pCtx = new GpioContext((PinName)pConfig->resetPin, + (PinName)pConfig->errorPin, + (PinName)pConfig->alertPin, + (PinName)pConfig->datareadyPin); + if (!pCtx) + { + ADI_SENSE_LOG_ERROR("Failed to allocate memory for GPIO context"); + return ADI_SENSE_NO_MEM; + } + + *phDevice = reinterpret_cast<ADI_SENSE_GPIO_HANDLE>(pCtx); + return ADI_SENSE_SUCCESS; +} + +/* + * Get the state of the specified GPIO pin + */ +ADI_SENSE_RESULT adi_sense_GpioGet( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinId, + bool_t *pbState) +{ + GpioContext *pCtx = reinterpret_cast<GpioContext *>(hDevice); + + return pCtx->get(ePinId, pbState); +} + +/* + * Set the state of the specified GPIO pin + */ +ADI_SENSE_RESULT adi_sense_GpioSet( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinId, + bool_t bState) +{ + GpioContext *pCtx = reinterpret_cast<GpioContext *>(hDevice); + + return pCtx->set(ePinId, bState); +} + +/* + * Enable interrupt notifications on the specified GPIO pin + */ +ADI_SENSE_RESULT adi_sense_GpioIrqEnable( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinId, + ADI_SENSE_GPIO_CALLBACK callback, + void *arg) +{ + GpioContext *pCtx = reinterpret_cast<GpioContext *>(hDevice); + + return pCtx->enableIrq(ePinId, callback, arg); +} + +/* + * Disable interrupt notifications on the specified GPIO pin + */ +ADI_SENSE_RESULT adi_sense_GpioIrqDisable( + ADI_SENSE_GPIO_HANDLE hDevice, + ADI_SENSE_GPIO_PIN ePinId) +{ + GpioContext *pCtx = reinterpret_cast<GpioContext *>(hDevice); + + return pCtx->disableIrq(ePinId); +} + +/* + * Close the GPIO interface and free resources + */ +void adi_sense_GpioClose( + ADI_SENSE_GPIO_HANDLE hDevice) +{ + GpioContext *pCtx = reinterpret_cast<GpioContext *>(hDevice); + + delete pCtx; +} + +#ifdef __cplusplus +} +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mbed/adi_sense_log.cpp Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,112 @@ +/*! + ****************************************************************************** + * @file: adi_sense_log.c + * @brief: ADI Sense OS-dependent wrapper layer for log functions + *----------------------------------------------------------------------------- + */ + +/****************************************************************************** +Copyright 2017 (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. + * + *****************************************************************************/ + +#include <mbed.h> +#include "inc/adi_sense_log.h" + +#define ADI_SENSE_LOG_UART_BAUDRATE (115200) + +#ifdef TARGET_STM32F411xE +#define ADI_SENSE_LOG_UART_TX_PIN (PA_11) +#define ADI_SENSE_LOG_UART_RX_PIN (PA_12) +#else +#error "unsupported target platform" +#endif + +static Serial *gpUartDevice; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Open the Log interface and allocate resources + */ +ADI_SENSE_RESULT adi_sense_LogOpen(void) +{ + gpUartDevice = new Serial(ADI_SENSE_LOG_UART_TX_PIN, + ADI_SENSE_LOG_UART_RX_PIN, + ADI_SENSE_LOG_UART_BAUDRATE); + if (!gpUartDevice) + { + ADI_SENSE_LOG_ERROR("Failed to allocate memory for Log UART context"); + return ADI_SENSE_NO_MEM; + } + + return ADI_SENSE_SUCCESS; +} + +/* + * Close the Log interface and free resources + */ +void adi_sense_LogClose(void) +{ + if (gpUartDevice) + { + delete gpUartDevice; + gpUartDevice = 0; + } +} + +/* + * Print a log message to the platform log interface + */ +void adi_sense_Log(ADI_SENSE_LOG_LEVEL level, const char* format, ...) +{ + char buffer[256]; + va_list va_args; + + if (!gpUartDevice) + return; + + va_start(va_args, format); + vsnprintf(buffer, sizeof(buffer), format, va_args); + va_end(va_args); + + gpUartDevice->printf("%s\r\n", buffer); +} + +#ifdef __cplusplus +} +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mbed/adi_sense_spi.cpp Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,210 @@ +/*! + ****************************************************************************** + * @file: adi_sense_spi.cpp + * @brief: ADI Sense OS-dependent wrapper layer for SPI interface + *----------------------------------------------------------------------------- + */ + +/****************************************************************************** +Copyright 2017 (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. + * + *****************************************************************************/ + +#include <mbed.h> + +#include "inc/adi_sense_spi.h" +#include "inc/adi_sense_log.h" + +#define ADI_SENSE_SPI_MODE 0 /* CPOL=0, CPHA=0 */ +#define ADI_SENSE_SPI_FRAME_SIZE 8 /* 8-bit frame size */ + +class SpiContext +{ +public: + SpiContext( + PinName mosiPin, + PinName misoPin, + PinName sckPin, + PinName csPin, + unsigned maxSpeed); + + int transfer( + void *pTxData, + void *pRxData, + unsigned nLength, + bool bCsHold); + +private: + SPI _spi; + DigitalOut _cs; + + event_callback_t _callback; + volatile int _cbEvent; + volatile bool _cbFired; + + void _cbHandler( + int event); + + int _waitForCallback( + void); +}; + +SpiContext::SpiContext(PinName mosiPin, + PinName misoPin, + PinName sckPin, + PinName csPin, + unsigned maxSpeed) + : _spi(mosiPin, misoPin, sckPin), + _cs(csPin, 1) +{ + _cbEvent = 0; + _cbFired = false; + _callback.attach(this, &SpiContext::_cbHandler); + + _spi.format(ADI_SENSE_SPI_FRAME_SIZE, ADI_SENSE_SPI_MODE); + _spi.frequency(maxSpeed); +} + +void SpiContext::_cbHandler(int event) +{ + _cbEvent = event; + _cbFired = true; +} + +int SpiContext::_waitForCallback(void) +{ + int rc = 0; + + while ((_cbFired != true) && (_cbEvent != SPI_EVENT_COMPLETE)) + { ; } + + _cbFired = false; + _cbEvent = 0; + + return rc; +} + +int SpiContext::transfer( + void *pTxData, + void *pRxData, + unsigned nLength, + bool bCsHold) +{ + int rc = 0; + + _cs = 0; + + rc = _spi.transfer((uint8_t *)pTxData, nLength, + (uint8_t *)pRxData, nLength, + _callback, SPI_EVENT_COMPLETE); + if (rc < 0) + { + _cs = 1; + return rc; + } + + rc = _waitForCallback(); + if ((rc < 0) || !bCsHold) + _cs = 1; + + return rc; +} + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Open the SPI interface and allocate resources + */ +ADI_SENSE_RESULT adi_sense_SpiOpen( + ADI_SENSE_PLATFORM_SPI_CONFIG *pConfig, + ADI_SENSE_SPI_HANDLE *phDevice) +{ + SpiContext *pCtx = new SpiContext((PinName)pConfig->mosiPin, + (PinName)pConfig->misoPin, + (PinName)pConfig->sckPin, + (PinName)pConfig->csPin, + pConfig->maxSpeedHz); + if (!pCtx) + { + ADI_SENSE_LOG_ERROR("Failed to allocate memory for SPI interface"); + return ADI_SENSE_NO_MEM; + } + + *phDevice = reinterpret_cast<ADI_SENSE_SPI_HANDLE>(pCtx); + return ADI_SENSE_SUCCESS; +} + +/* + * Execute a bi-directional data transfer on the SPI interface + */ +ADI_SENSE_RESULT +adi_sense_SpiTransfer( + ADI_SENSE_SPI_HANDLE hDevice, + void *pTxData, + void *pRxData, + unsigned nLength, + bool bCsHold) +{ + SpiContext *pCtx = reinterpret_cast<SpiContext *>(hDevice); + + if (pCtx->transfer(pTxData, pRxData, nLength, bCsHold) < 0) + { + ADI_SENSE_LOG_ERROR("Failed to complete SPI transfer"); + return ADI_SENSE_FAILURE; + } + + return ADI_SENSE_SUCCESS; +} + +/* + * Close the SPI interface and free resources + */ +void adi_sense_SpiClose( + ADI_SENSE_SPI_HANDLE hDevice) +{ + SpiContext *pCtx = reinterpret_cast<SpiContext *>(hDevice); + + delete pCtx; +} + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mbed/adi_sense_time.cpp Thu Jan 25 16:00:23 2018 +0000 @@ -0,0 +1,64 @@ +/*! + ****************************************************************************** + * @file: adi_sense_time.c + * @brief: ADI Sense OS-dependent wrapper layer for time functions + *----------------------------------------------------------------------------- + */ + +/****************************************************************************** +Copyright 2017 (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. + * + *****************************************************************************/ + +#include <mbed.h> + +#include "inc/adi_sense_time.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Wait for a specified number of microseconds + */ +void adi_sense_TimeDelayUsec( + const unsigned microseconds) +{ + wait_us(microseconds); +} + +#ifdef __cplusplus +} +#endif +