Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of AdiSense1000_V21 by
Revision 27:567abf893938, committed 2018-03-26
- Comitter:
- Dan O'Donovan
- Date:
- Mon Mar 26 20:28:05 2018 +0100
- Branch:
- v2.0
- Parent:
- 26:12d0204be712
- Child:
- 29:57edca10d78c
- Commit message:
- Adding host library and example code for v1.1 release
Changed in this revision
--- a/common/utils.c Mon Mar 26 14:50:05 2018 +0000 +++ b/common/utils.c Mon Mar 26 20:28:05 2018 +0100 @@ -116,17 +116,33 @@ void utils_printSamples( ADI_SENSE_DATA_SAMPLE *pSampleBuffer, - uint32_t nNumSamples) + uint32_t nNumSamples, + ADI_SENSE_MEASUREMENT_MODE eMeasurementMode) { + bool fftMode = (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_FFT); + 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" : ""); + if (fftMode) + { + ADI_SENSE_LOG_INFO("Sample # %2d Channel # %2d :: Bin/Raw %8d :: Magnitude %e :: 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" : ""); + } + else + { + ADI_SENSE_LOG_INFO("Sample # %2d Channel # %2d :: Raw %8d :: Processed %f :: 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" : ""); + } } } @@ -217,31 +233,30 @@ return res; /* - * Retrieve the number of samples per cycle, per DATAREADY pulse, etc. for this configuration. + * 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; + uint8_t nBytesPerSample; res = adi_sense_1000_GetDataReadyModeInfo(hDevice, eMeasurementMode, &eOperatingMode, &eDataReadyMode, &nSamplesPerDataready, - &nSamplesPerCycle); + &nSamplesPerCycle, + &nBytesPerSample); 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); + pSampleBuffer = malloc(sizeof(ADI_SENSE_DATA_SAMPLE) * + nSamplesPerDataready); if (pSampleBuffer == NULL) { ADI_SENSE_LOG_ERROR("Failed to allocate sample buffer"); @@ -261,53 +276,58 @@ /* * Loop continuously unless operating mode is single-cycle */ - do { + uint32_t nSampleCount = 0; + while (true) + { 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 + * Wait until the next batch of 1 or more samples is ready, continuously + * checking DATAREADY until it is asserted */ - do { - /* - * Wait for the cycle to complete, continuously checking DATAREADY until it is asserted - */ - while (! (bDataReady || bError)) - ; + while (! (bDataReady || bError)) + ; + + if (bError) + break; - if (! bError) + /* + * Get data samples from the measurement cycle, if no error has occurred + */ + bDataReady = false; + res = adi_sense_GetData(hDevice, eMeasurementMode, pSampleBuffer, + nBytesPerSample, nSamplesPerDataready, + &nReturned); + if (res != ADI_SENSE_SUCCESS) + { + if (res == ADI_SENSE_INCOMPLETE) { /* - * Retrieve the data samples from the measurement cycle, if no error has occurred + * This is expected in cases where cycleSkipCount may + * be non-zero for some channels, resulting in + * variable-length sequences */ - 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; - } - } + ADI_SENSE_LOG_DEBUG("Retrieved %u of %u requested data samples", + nReturned, nSamplesPerDataready); } - } while (!bError && (nCurrentSamples < nSamplesPerCycle)); + else + { + ADI_SENSE_LOG_WARN("Failed to get data samples from device"); + return res; + } + } /* - * Display the data samples + * Display the data samples. + * + * NOTE: this requires a sufficient idle time between subsequent + * DATAREADY pulses to allow printing to occur. Otherwise, + * subsequent samples may be missed if not retrieved promptly when + * the next DATAREADY assertion occurs. */ - utils_printSamples(pSampleBuffer, nCurrentSamples); + utils_printSamples(pSampleBuffer, nReturned, eMeasurementMode); + nSampleCount += nReturned; /* * Check and print device status if errors/alerts have been triggered @@ -331,7 +351,34 @@ break; } } - } while (eOperatingMode != ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE); + + if (eOperatingMode == ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE) + { + /* + * In this mode, break out of the loop when the measurement command + * has completed. + * + * One option is to check for the expected number of samples to be + * returned for the cycle. However, cycles may have variable-length + * sequences if the cycleSkipCount option is non-zero for any of the + * channels. + * + * So, instead, we check for the command-running status, which + * will de-assert in this mode when the measurement command has + * completed a single cycle. + */ + bool_t bCommandRunning; + res = adi_sense_GetCommandRunningState(hDevice, &bCommandRunning); + if (res != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to get command-running status"); + return res; + } + + if (!bCommandRunning && !bDataReady) + break; + } + } res = adi_sense_StopMeasurement(hDevice); if (res != ADI_SENSE_SUCCESS) @@ -348,4 +395,3 @@ return ADI_SENSE_SUCCESS; } -
--- a/common/utils.h Mon Mar 26 14:50:05 2018 +0000 +++ b/common/utils.h Mon Mar 26 20:28:05 2018 +0100 @@ -15,7 +15,8 @@ /* Utility function to print data samples read from the ADI Sense device */ void utils_printSamples( ADI_SENSE_DATA_SAMPLE *pSampleBuffer, - uint32_t numSamples); + uint32_t nNumSamples, + ADI_SENSE_MEASUREMENT_MODE eMeasurementMode); /* Utility function to register callbacks for ADI Sense device notification signals */ ADI_SENSE_RESULT utils_registerCallbacks( @@ -43,4 +44,3 @@ #endif #endif /* __UTILS_H__ */ -
--- a/current_honeywellPressure_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/current_honeywellPressure_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: current_honeywellPressure_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,13 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + * + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG current_honeywellPressure_config = { @@ -111,4 +113,3 @@ }, }, }; -
--- a/doc/README.md Mon Mar 26 14:50:05 2018 +0000 +++ b/doc/README.md Mon Mar 26 20:28:05 2018 +0100 @@ -32,4 +32,3 @@ topics such as processor configuration and dynamic characteristics - [Porting Guide](doc/porting.md) includes useful information for anyone who wishes to port the ADISENSE Host Library to a new host processor platform -
--- a/doc/adsns1000.md Mon Mar 26 14:50:05 2018 +0000 +++ b/doc/adsns1000.md Mon Mar 26 20:28:05 2018 +0100 @@ -119,4 +119,3 @@ - Analog Supply Voltage - The voltage on VDD is referenced to GND - The differential between VDD and GND must be between 3 V and 3.6 V -
--- a/doc/key_topics.md Mon Mar 26 14:50:05 2018 +0000 +++ b/doc/key_topics.md Mon Mar 26 20:28:05 2018 +0100 @@ -174,33 +174,57 @@ 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. +The sequence is constructed according to a number of configurable parameters: +- which channels are enabled +- number of measurements to be performed per channel +- channel priorities +- cycle type selection + +When the selected cycle type is @ref ADI_SENSE_1000_CYCLE_TYPE_FULL, +the full number of requested measurements is carried out on a channel before +advancing to the next channel in the sequence. Channels are visited in +priority/ascending order. + +When the selected cycle type is @ref ADI_SENSE_1000_CYCLE_TYPE_SWITCH, +the arrangement is similar to round-robin scheduling - a measurement is carried +out on each enabled channel, in priority/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: +By default, channels are arranged in the measurement sequence based on ascending +order of channel ID. However, a priority-level may be specified per channel to +force a different ordering of the channels, with higher-priority channels +appearing before lower-priority channels. Channels with equal priority are +ordered by ascending order of channel ID. Lower numbers indicate higher +priority, with 0 being the highest. -channelId | measurementsPerCycle ---------- | -------------------- - CJC_1 | 4 - SENSOR_0 | 2 - I2C_1 | 3 - SPI_0 | 1 +For example, lets say channels [0, 3, 4, 5] are enabled, with cycleType as @ref +ADI_SENSE_1000_CYCLE_TYPE_SWITCH, and measurementsPerCycle and priority +(0=highest) set as follows: + +channelId | priority | measurementsPerCycle +--------- | -------- | -------------------- + CJC_1 | 1 | 4 + SENSOR_0 | 2 | 2 + I2C_1 | 0 | 3 + SPI_0 | 2 | 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** | +| **I2C_1** | **CJC_1** | **SENSOR_0** | **SPI_0** | **I2C_1** | **CJC_1** | **SENSOR_0** | **I2C_1** | **CJC_1** | **CJC_1** | When measurement data samples are retrieved from the ADISENSE by the host application, this is the order in which those data samples will appear. -The ADSNS1000 module has 11 measurement ports however when ADXL used on the SPI -port this equates to 3 measurements. The ADSNS1000 allows for a maximum of 128 -measurementsPerCycle. Therefore a single cycle can produce a maximum of 1664 +Changing the cycleType to @ref ADI_SENSE_1000_CYCLE_TYPE_FULL in the example above +would generate the following sequence: + +| **I2C_1** | **I2C_1** | **I2C_1** | **CJC_1** | **CJC_1** | **CJC_1** | **CJC_1** | **SENSOR_0** | **SENSOR_0** | **SPI_0** | + +The ADSNS1000 module has 11 measurement ports; however, when ADXL used on the +SPI port this equates to 3 measurements. The ADSNS1000 allows for a maximum of +128 measurementsPerCycle. Therefore 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} @@ -448,4 +472,3 @@ 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. -
--- a/doc/porting.md Mon Mar 26 14:50:05 2018 +0000 +++ b/doc/porting.md Mon Mar 26 20:28:05 2018 +0100 @@ -18,4 +18,3 @@ in the following sub-directory within the ADISENSE Host Library source package: <path_to_library>/host/src/mbed/ -
--- a/i2c0_honeywellHumidicon_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/i2c0_honeywellHumidicon_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: i2c0_honeywellHumidicon_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG i2c0_honeywellHumidicon_config = { @@ -103,4 +104,3 @@ }, }, }; -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/i2c0_onsemiNOA1305_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -0,0 +1,133 @@ +/* +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. + * +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. + * + *****************************************************************************/ + +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ +#include "inc/adi_sense_config_types.h" + +ADI_SENSE_CONFIG i2c0_onsemiNOA1305_config = { + .versionId = { .major = 1, .minor = 4 }, + .productId = ADI_SENSE_PRODUCT_ID_ADSNS1000, + .adisense1000 = { + .power = { + .powerMode = ADI_SENSE_1000_POWER_MODE_FULL, + }, + .measurement = { + .operatingMode = ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE, + .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE, + }, + .channels = { + [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CJC_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_3] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CURRENT_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = { + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE, + .measurementsPerCycle = 10, + .extraSettlingTime = 50000, + .i2cChannelConfig = { + .sensor = ADI_SENSE_1000_I2C_SENSOR_LIGHT_ONSEMI_NOA1305, + .deviceAddress = 0x39, + .configurationCommand = { + /* + * Optional configuration command, used here to change + * the integration time of the sensor from 200ms + * (default) to 50ms for increased sensitivity, setting + * INTEGRATION_TIME (register 0x02) to 50ms (value 0x04) + */ + .command = { 0x02, 0x04 }, + .commandLength = 2, + }, + }, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = { + .enableChannel = false, + }, + }, + }, +};
--- a/i2c0_sensirionSHT3X_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/i2c0_sensirionSHT3X_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: i2c0_sensirionSHT3X_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG i2c0_sensirionSHT3X_config = { @@ -103,4 +104,3 @@ }, }, }; -
--- a/inc/adi_sense_1000/adi_sense_1000_api.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_api.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,8 +1,20 @@ -/*! - ****************************************************************************** - * @file: adi_sense_api.h - * @brief: ADSNS1000 Host Library Application Programming Interface (API) - *----------------------------------------------------------------------------- +/* +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. */ /* @@ -40,6 +52,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_api.h + * @brief: ADSNS1000 Host Library Application Programming Interface (API) + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_1000_API_H__ #define __ADI_SENSE_1000_API_H__ @@ -210,6 +229,27 @@ uint32_t nMeasurementsPerCycle); /*! + * @brief Update priority level for a specific channel. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] eChannelId Selects the channel to be updated + * @param[in] ePriority Specifies the channel priority level + * + * @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 re-prioritised. + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetChannelPriority( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_CHANNEL_PRIORITY ePriority); + +/*! * @brief Update the measurement threshold limits for a specified channel. * * @param[in] hDevice ADISENSE device context handle @@ -240,6 +280,27 @@ float32_t fHighThresholdLimit, float32_t fLowThresholdLimit); + +/*! + * @brief Set a sensor specific parameter for a specified channel. + * + * @param[in] hDevice ADI Sense device context handle + * @param[in] eChannelId Selects the channel to be updated + * @param[in] fSensorParam Sensor specific parameter + * + * @return Status + * - #ADI_SENSE_SUCCESS Call completed successfully. + * + * @details Translates configuration details provided into device-specific + * register settings and updates device configuration registers. + * Allows optional sensor-specific parameter to be specified + * + * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called + */ +ADI_SENSE_RESULT adi_sense_1000_SetSensorParameter( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + float32_t fSensorParam); /*! * @brief Update the extra settling time for a specified channel. * @@ -344,6 +405,7 @@ * available when DATAREADY is asserted * @param[out] pnSamplesPerCycle Pointer to return the calculated number of samples * produced per measurement cycle + * @param[out] pnBytesPerSample Pointer to return the size, in bytes, of each sample * * @return Status * - #ADI_SENSE_SUCCESS Call completed successfully. @@ -360,7 +422,8 @@ ADI_SENSE_1000_OPERATING_MODE * const peOperatingMode, ADI_SENSE_1000_DATAREADY_MODE * const peDataReadyMode, uint32_t * const pnSamplesPerDataready, - uint32_t * const pnSamplesPerCycle); + uint32_t * const pnSamplesPerCycle, + uint8_t * const pnBytesPerSample); #ifdef __cplusplus } @@ -371,4 +434,3 @@ */ #endif /* __ADI_SENSE_1000_API_H__ */ -
--- a/inc/adi_sense_1000/adi_sense_1000_config.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_config.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,8 +1,20 @@ -/*! - ****************************************************************************** - * @file: adi_sense_1000_config.h - * @brief: Configuration type definitions for ADSNS1000. - *----------------------------------------------------------------------------- +/* +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. */ /* @@ -44,6 +56,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_1000_config.h + * @brief: Configuration type definitions for ADSNS1000. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_1000_CONFIG_H__ #define __ADI_SENSE_1000_CONFIG_H__ @@ -61,6 +80,29 @@ /*! Maximum length allowed for a digital sensor command */ #define ADI_SENSE_1000_SENSOR_COMMAND_MAX_LENGTH 7 +/*! ADSNS1000 channel priority options */ +typedef enum { + ADI_SENSE_1000_CHANNEL_PRIORITY_0 = 0, + ADI_SENSE_1000_CHANNEL_PRIORITY_1, + ADI_SENSE_1000_CHANNEL_PRIORITY_2, + ADI_SENSE_1000_CHANNEL_PRIORITY_3, + ADI_SENSE_1000_CHANNEL_PRIORITY_4, + ADI_SENSE_1000_CHANNEL_PRIORITY_5, + ADI_SENSE_1000_CHANNEL_PRIORITY_6, + ADI_SENSE_1000_CHANNEL_PRIORITY_7, + ADI_SENSE_1000_CHANNEL_PRIORITY_8, + ADI_SENSE_1000_CHANNEL_PRIORITY_9, + ADI_SENSE_1000_CHANNEL_PRIORITY_10, + ADI_SENSE_1000_CHANNEL_PRIORITY_11, + ADI_SENSE_1000_CHANNEL_PRIORITY_12, + ADI_SENSE_1000_CHANNEL_PRIORITY_13, + ADI_SENSE_1000_CHANNEL_PRIORITY_14, + ADI_SENSE_1000_CHANNEL_PRIORITY_15, + + ADI_SENSE_1000_CHANNEL_PRIORITY_HIGHEST = ADI_SENSE_1000_CHANNEL_PRIORITY_0, + ADI_SENSE_1000_CHANNEL_PRIORITY_LOWEST = ADI_SENSE_1000_CHANNEL_PRIORITY_15, +} ADI_SENSE_1000_CHANNEL_PRIORITY; + /*! ADSNS1000 operating mode options */ typedef enum { ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE = 1, @@ -94,7 +136,7 @@ */ } ADI_SENSE_1000_DATAREADY_MODE; -/*! ADSNS1000 data power mode options */ +/*! ADSNS1000 power mode options */ typedef enum { ADI_SENSE_1000_POWER_MODE_LOW = 1, /*!< Lowest ADC power consumption mode, with lowest conversion rate */ @@ -104,6 +146,16 @@ /*!< Highest ADC power consumption mode, with highest conversion rate */ } ADI_SENSE_1000_POWER_MODE; +/*! ADSNS1000 measurement cycle types */ +typedef enum +{ + ADI_SENSE_1000_CYCLE_TYPE_SWITCH = 0, + /*!< Switch channels after every conversion */ + ADI_SENSE_1000_CYCLE_TYPE_FULL = 1 + /*!< Perform full number of requested conversions on a channel + * consecutively before switching to the next channel */ +} ADI_SENSE_1000_CYCLE_TYPE; + /*! ADSNS1000 measurement unit options * * Optionally select a measurement unit for final conversion results. @@ -184,6 +236,15 @@ /*!< 1mA excitation current enabled */ } ADI_SENSE_1000_ADC_EXC_CURRENT; +/*! ADSNS1000 analog sensor excitation current ratios used for diode sensor + * + * @note applicable only to a diode sensor + */ +typedef enum { + ADI_SENSE_1000_ADC_EXC_CURRENT_IOUT_DIODE_DEFAULT = 0, + ADI_SENSE_1000_ADC_EXC_CURRENT_IOUT_DIODE_MAX, +} ADI_SENSE_1000_ADC_EXC_CURRENT_DIODE_RATIO; + /*! ADSNS1000 analog reference selection options * * @note applicable only to ADC analog sensor channels, and @@ -247,6 +308,58 @@ /*!< FIR post filter, producing a 25sps output sample rate */ } ADI_SENSE_1000_ADC_FILTER_TYPE; +/*! ADSNS1000 FFT sequence mode options + * + * @note applicable only for FFT measurement modes + */ +typedef enum { + ADI_SENSE_1000_FFT_MODE_SINGLE = 0, + /*!< Performs a single sequence of FFTs on selected channels and stops */ + ADI_SENSE_1000_FFT_MODE_CONTINUOUS, + /*!< Performs continuous sequences of FFTs on selected channels */ +} ADI_SENSE_1000_FFT_MODE; + +/*! ADSNS1000 FFT size options (number of bins) + * + * @note applicable only for FFT measurement modes + */ +typedef enum { + ADI_SENSE_1000_FFT_SIZE_256 = 0, + /*!< 256 bins */ + ADI_SENSE_1000_FFT_SIZE_512, + /*!< 512 bins */ + ADI_SENSE_1000_FFT_SIZE_1024, + /*!< 1024 bins */ + ADI_SENSE_1000_FFT_SIZE_2048, + /*!< 2048 bins */ +} ADI_SENSE_1000_FFT_SIZE; + +/*! ADSNS1000 FFT window type options + * + * @note applicable only for FFT measurement modes + */ +typedef enum { + ADI_SENSE_1000_FFT_WINDOW_NONE = 0, + /*!< No Window */ + ADI_SENSE_1000_FFT_WINDOW_HANN, + /*!< Hann Window */ + ADI_SENSE_1000_FFT_WINDOW_BLACKMAN_HARRIS, + /*!< Blackman-Harris Window */ +} ADI_SENSE_1000_FFT_WINDOW; + +/*! ADSNS1000 FFT output format options + * + * @note applicable only for FFT measurement modes + */ +typedef enum { + ADI_SENSE_1000_FFT_OUTPUT_FULL = 0, + /*!< N/2-Term Amplitude Response */ + ADI_SENSE_1000_FFT_OUTPUT_FULL_WITH_RAW, + /**< N/2-Term Amplitude Response Plus N Raw ADC Samples */ + ADI_SENSE_1000_FFT_OUTPUT_MAX16, + /*!< Bin-Number and Amplitude of 16 Highest Peaks of Amplitude Response */ +} ADI_SENSE_1000_FFT_OUTPUT; + /*! ADSNS1000 Power Configuration options */ typedef struct { ADI_SENSE_1000_POWER_MODE powerMode; @@ -281,6 +394,10 @@ * successive measurement cycle. Applicable only when operatingMode is * not ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE */ + ADI_SENSE_1000_CYCLE_TYPE cycleType; + /*!< Cycle type - specifies how the channel list is traversed with each + * conversion during the cycle. + */ float32_t externalRef1Value; /*!< Resistance/voltage value connected to external reference input #1. * Applicable only if the selected reference type is @@ -303,8 +420,10 @@ * specific sensor types */ typedef struct { - ADI_SENSE_1000_ADC_EXC_CURRENT outputLevel; + ADI_SENSE_1000_ADC_EXC_CURRENT outputLevel; /*!< Excitation current output level */ + ADI_SENSE_1000_ADC_EXC_CURRENT_DIODE_RATIO diodeRatio; + /*!< Excitation current output diode ratio */ } ADI_SENSE_1000_ADC_EXC_CURRENT_CONFIG; /*! ADSNS1000 ADC Filter configuration @@ -452,6 +571,8 @@ /*!< 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 enableFFT; + /*!< Option to include this channel in FFT mode measurements */ 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 @@ -490,17 +611,37 @@ /*!< Optional gain adjustment value applied to each processed sample. * Set to NaN or 1.0 if not required. */ + float32_t sensorParameter; + /*!< Optional sensor parameter adjustment. + * Set to NaN or 0 if not required. + */ uint32_t measurementsPerCycle; /*!< The number of measurements to obtain from this channel within each * cycle. Each enabled channel is measured in turn, until the number of * measurements requested for the channel has been reached. A different * number of measurements-per-cycle may be specified for each channel. */ + uint32_t cycleSkipCount; + /*!< Optional number of cycles to skip, such that this channel is included + * in the sequence in only one of every (cycleSkipCount + 1) cycles that + * occur. If set to 0 (default), this channel is included in every cycle; + * if set to 1, this channel is included in every 2nd cycle; if set to 2, + * this channel is included in every 3rd cycle, and so on. + */ uint32_t extraSettlingTime; /*!< A minimum settling time is applied internally for each channel, based * on the sensor type. However, additional settling time (microseconds) * can optionally be specified. Set to 0 if not required. */ + ADI_SENSE_1000_CHANNEL_PRIORITY priority; + /*!< By default, channels are arranged in the measurement sequence based on + * ascending order of channel ID. However, a priority-level may be + * specified per channel to force a different ordering of the channels, + * with higher-priority channels appearing before lower-priority channels. + * Channels with equal priority are ordered by ascending order of channel + * ID. Lower numbers indicate higher priority, with 0 being the highest. + * Set to 0 if not required. + */ union { ADI_SENSE_1000_ADC_CHANNEL_CONFIG adcChannelConfig; /*!< ADC channel configuration - applicable only to ADC channels */ @@ -530,6 +671,18 @@ /*!< Option to enable Open-Circuit Detection at a selected cycle interval */ } ADI_SENSE_1000_DIAGNOSTICS_CONFIG; +/*! ADSNS1000 FFT Measurement Mode configuration options */ +typedef struct { + ADI_SENSE_1000_FFT_MODE mode; + /*!< FFT sequence mode */ + ADI_SENSE_1000_FFT_SIZE size; + /*!< FFT size selection */ + ADI_SENSE_1000_FFT_WINDOW window; + /*!< FFT window type selection */ + ADI_SENSE_1000_FFT_OUTPUT output; + /*!< FFT output type selection */ +} ADI_SENSE_1000_FFT_CONFIG; + /*! ADSNS1000 Device configuration details */ typedef struct { ADI_SENSE_1000_POWER_CONFIG power; @@ -538,6 +691,8 @@ /*!< Measurement configuration details */ ADI_SENSE_1000_DIAGNOSTICS_CONFIG diagnostics; /*!< Diagnostics configuration details */ + ADI_SENSE_1000_FFT_CONFIG fft; + /*!< FFT configuration details */ ADI_SENSE_1000_CHANNEL_CONFIG channels[ADI_SENSE_1000_MAX_CHANNELS]; /*!< Channel-specific configuration details */ } ADI_SENSE_1000_CONFIG; @@ -551,4 +706,3 @@ */ #endif /* __ADI_SENSE_1000_CONFIG_H__ */ -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_host_comms.h Mon Mar 26 20:28:05 2018 +0100 @@ -0,0 +1,75 @@ +/* +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. +*/ + +#ifndef __ADI_SENSE_1000_HOST_COMMS_H__ +#define __ADI_SENSE_1000_HOST_COMMS_H__ + +#include "adi_sense_types.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 ADI_SENSE_1000_HOST_COMMS_CMD_MASK 0xF800 +#define ADI_SENSE_1000_HOST_COMMS_ADR_MASK 0x07FF + +/* + * The following commands are currently supported, anything else is treated + * as an error + */ +#define ADI_SENSE_1000_HOST_COMMS_WRITE_CMD 0x8000 +#define ADI_SENSE_1000_HOST_COMMS_READ_CMD 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 ADI_SENSE_1000_HOST_COMMS_CMD_RESP_0 0xF0 +#define ADI_SENSE_1000_HOST_COMMS_CMD_RESP_1 0xE1 + +/* + * The following minimum delay, in microseconds, must be inserted after each SPI + * transfer to allow time for it to be processed by the device + */ +#define ADI_SENSE_1000_HOST_COMMS_XFER_DELAY (20) + +/*! ADSNS1000 Sensor Result bit field structure */ +typedef struct _ADI_SENSE_1000_Sensor_Result_t { + union { + struct { + float32_t Sensor_Result; /**< Linearized and compensated sensor result */ + uint32_t Channel_ID : 4; /**< Indicates which channel this result 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 sensor data field is valid */ + uint32_t Ch_Valid : 1; /**< Indicates if this Result structure is valid */ + uint32_t Raw_Sample : 24; /**< Raw sensor data value */ + }; + uint64_t VALUE64; + }; +} ADI_SENSE_1000_Sensor_Result_t; + +#endif /* __ADI_SENSE_1000_HOST_COMMS_H__ */
--- a/inc/adi_sense_1000/adi_sense_1000_lut_data.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_lut_data.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_1000_lut_data.h - * @brief: Look-Up Table data-type definitions for ADSNS1000 API. - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: + * @brief: Look-Up Table data-type definitions for ADSNS1000 API. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_1000_LUT_DATA_H__ #define __ADI_SENSE_1000_LUT_DATA_H__ @@ -348,7 +348,7 @@ * * @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. + * to the ADI_SENSE_LUT type for further parsing/processing. */ typedef struct __attribute__((packed, aligned(4))) { ADI_SENSE_1000_LUT_HEADER header; @@ -366,4 +366,3 @@ */ #endif /* __ADI_SENSE_1000_LUT_DATA_H__ */ -
--- a/inc/adi_sense_1000/adi_sense_1000_sensor_types.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_1000/adi_sense_1000_sensor_types.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_1000_sensor_types.h - * @brief: Sensor type definitions for ADSNS1000. - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: + * @brief: Sensor type definitions for ADSNS1000. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_1000_SENSOR_TYPES_H__ #define __ADI_SENSE_1000_SENSOR_TYPES_H__ @@ -597,41 +597,111 @@ * @note For use with Analog Sensor channels only * @note Bridge Excition Voltage must be selected as reference */ - ADI_SENSE_1000_ADC_SENSOR_VOLTAGE = 256, + ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_TYPEA_DEF_L1 = 224, + /*!< Standard Diode two current temperature sensor with default + * linearisation equation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_TYPEA_DEF_L1 = 225, + /*!< Standard Diode three current temperature sensor with default + * linearisation equation and default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_1_DEF_L2 = 238, + /*!< Standard Diode two current sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_1_DEF_L2 = 239, + /*!< Standard Diode three current sensor with user-defined linearisation and + * default configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_TYPEA_ADV_L1 = 240, + /*!< Standard Diode two current temperature sensor with default + * linearisation equation and advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_TYPEA_ADV_L1 = 241, + /*!< Standard Diode three current sensor with default linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_1_ADV_L2 = 254, + /*!< Standard Diode two current sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_1_ADV_L2 = 255, + /*!< Standard Diode three current sensor with user-defined linearisation and + * advanced configuration options + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_MICROPHONE_A_DEF_L1 = 256, + /*!< Generic microphone sensor with external amplifier and bias + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_MICROPHONE_B_DEF_L1 = 257, + /*!< Generic microphone sensor without external amplifier + * + * @note For use with Analog Sensor channels only + */ + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE = 512, /*!< 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, + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY = 528, /*!< 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, + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X = 529, /*!< 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, + ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_1_DEF_L2 = 536, + /*!< 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_VOLTAGE_PRESSURE_2_DEF_L2 = 537, /*!< 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, + ADI_SENSE_1000_ADC_SENSOR_CURRENT = 768, /*!< 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, + ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2 = 784, /*!< 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, + ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_1_DEF_L2 = 792, + /*!< 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_CURRENT_PRESSURE_2_DEF_L2 = 793, /*!< Generic pressure current sensor with user-defined * linearisation and default configuration options * @@ -659,6 +729,12 @@ * * @note For use with I2C Digital Sensor channels only */ + ADI_SENSE_1000_I2C_SENSOR_LIGHT_ONSEMI_NOA1305 = 2176, + /*!< ON-Semiconductor NOA1305 ambient light sensor with default + * linearisation and default configuration options + * + * @note For use with I2C Digital Sensor channels only + */ } ADI_SENSE_1000_I2C_SENSOR_TYPE; /*! ADSNS1000 SPI digital sensor type options @@ -687,6 +763,18 @@ * 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_ACCELEROMETER_ADI_ADXL355 = 3201, + /*!< Analog Devices ADxL355 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 @@ -698,4 +786,3 @@ */ #endif /* __ADI_SENSE_1000_SENSOR_TYPES_H__ */ -
--- a/inc/adi_sense_api.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_api.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_api.h - * @brief: ADISENSE Host Library Application Programming Interface (API) - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_api.h + * @brief: ADISENSE Host Library Application Programming Interface (API) + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_API_H__ #define __ADI_SENSE_API_H__ @@ -206,6 +206,9 @@ 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_FFT, + /*!< In this mode, FFT mode measurement cycle(s) are executed and data + * samples are returned based on FFT-specific configuration parameters. */ } ADI_SENSE_MEASUREMENT_MODE; @@ -541,6 +544,7 @@ * @param[in] eMeasurementMode 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] nBytesPerSample The size, in bytes, of each sample. * @param[in] nRequested Number of requested data samples. * @param[out] pnReturned Number of valid data samples successfully retrieved. * @@ -557,6 +561,7 @@ ADI_SENSE_DEVICE_HANDLE const hDevice, ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode, ADI_SENSE_DATA_SAMPLE * const pSamples, + uint8_t const nBytesPerSample, uint32_t const nRequested, uint32_t * const pnReturned); @@ -584,4 +589,3 @@ */ #endif /* __ADI_SENSE_API_H__ */ -
--- a/inc/adi_sense_config_types.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_config_types.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_config_types.h - * @brief: Type definitions for ADISENSE API. - *----------------------------------------------------------------------------- - */ - /* Copyright (c) 2017 Analog Devices, Inc. @@ -44,6 +37,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_config_types.h + * @brief: Type definitions for ADISENSE API. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_CONFIG_TYPES_H__ #define __ADI_SENSE_CONFIG_TYPES_H__ @@ -100,4 +100,3 @@ */ #endif /* __ADI_SENSE_CONFIG_TYPES_H__ */ -
--- a/inc/adi_sense_gpio.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_gpio.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_gpio.h - * @brief: ADISENSE OS-dependent wrapper layer for GPIO interface - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_gpio.h + * @brief: ADISENSE OS-dependent wrapper layer for GPIO interface + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_GPIO_H__ #define __ADI_SENSE_GPIO_H__ @@ -75,7 +75,7 @@ typedef void* ADI_SENSE_GPIO_HANDLE; #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -174,4 +174,3 @@ */ #endif /* __ADI_SENSE_GPIO_H__ */ -
--- a/inc/adi_sense_log.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_log.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_log.h - * @brief: ADISENSE OS-dependent wrapper layer for log functions - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_log.h + * @brief: ADISENSE OS-dependent wrapper layer for log functions + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_LOG_H__ #define __ADI_SENSE_LOG_H__ @@ -77,7 +77,7 @@ #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -117,4 +117,3 @@ */ #endif /* __ADI_SENSE_LOG_H__ */ -
--- a/inc/adi_sense_platform.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_platform.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: - * @brief: Platform-specific type definitions for ADISENSE API. - *----------------------------------------------------------------------------- - */ - /* Copyright (c) 2017 Analog Devices, Inc. @@ -44,6 +37,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: + * @brief: Platform-specific type definitions for ADISENSE API. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_PLATFORM_H__ #define __ADI_SENSE_PLATFORM_H__ @@ -63,4 +63,3 @@ #endif #endif /* __ADI_SENSE_PLATFORM_H__ */ -
--- a/inc/adi_sense_spi.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_spi.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_spi.h - * @brief: ADISENSE OS-dependent wrapper layer for SPI interface - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_spi.h + * @brief: ADISENSE OS-dependent wrapper layer for SPI interface + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_SPI_H__ #define __ADI_SENSE_SPI_H__ @@ -56,7 +56,7 @@ typedef void * ADI_SENSE_SPI_HANDLE; #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -111,4 +111,3 @@ */ #endif /* __ADI_SENSE_SPI_H__ */ -
--- a/inc/adi_sense_time.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_time.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_time.h - * @brief: ADISENSE OS Dependant wrapper layer for time functions - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_time.h + * @brief: ADISENSE OS Dependant wrapper layer for time functions + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_TIME_H__ #define __ADI_SENSE_TIME_H__ @@ -52,7 +52,7 @@ */ #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -73,4 +73,3 @@ */ #endif /* __ADI_SENSE_TIME_H__ */ -
--- a/inc/adi_sense_types.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/adi_sense_types.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_types.h - * @brief: Type definitions for ADISENSE API. - *----------------------------------------------------------------------------- - */ - /* Copyright 2017 (c) Analog Devices, Inc. @@ -40,6 +33,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: adi_sense_types.h + * @brief: Type definitions for ADISENSE API. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_TYPES_H__ #define __ADI_SENSE_TYPES_H__ @@ -103,4 +103,3 @@ } ADI_SENSE_RESULT; #endif /* __ADI_SENSE_TYPES_H__ */ -
--- a/inc/mbed/adi_sense_platform.h Mon Mar 26 14:50:05 2018 +0000 +++ b/inc/mbed/adi_sense_platform.h Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: - * @brief: mbed platform-specific type definitions for ADISENSE API. - *----------------------------------------------------------------------------- - */ - /* Copyright (c) 2017 Analog Devices, Inc. @@ -44,6 +37,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*! + ****************************************************************************** + * @file: + * @brief: mbed platform-specific type definitions for ADISENSE API. + *----------------------------------------------------------------------------- + */ + #ifndef __ADI_SENSE_PLATFORM_MBED_H__ #define __ADI_SENSE_PLATFORM_MBED_H__ @@ -66,4 +66,3 @@ } ADI_SENSE_PLATFORM_GPIO_CONFIG; #endif /* __ADI_SENSE_PLATFORM_MBED_H__ */ -
--- a/main.cpp Mon Mar 26 14:50:05 2018 +0000 +++ b/main.cpp Mon Mar 26 20:28:05 2018 +0100 @@ -1,7 +1,20 @@ /* - ****************************************************************************** - * file: main.cpp - *----------------------------------------------------------------------------- +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. * Copyright 2017 (c) Analog Devices, Inc. @@ -37,6 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + *----------------------------------------------------------------------------- + * + */ #include "mbed.h" #include "inc/adi_sense_api.h" #include "inc/adi_sense_1000/adi_sense_1000_api.h" @@ -44,8 +63,11 @@ #include "common/utils.h" extern ADI_SENSE_CONFIG sensor0_rtd_2w_pt100_config; +extern ADI_SENSE_CONFIG sensor0_microphone_config; +extern ADI_SENSE_CONFIG sensor0_diode_2c_config; extern ADI_SENSE_CONFIG sensor1_typeK_cjc1_config; extern ADI_SENSE_CONFIG sensor1_rtd_3w_pt100_config; +extern ADI_SENSE_CONFIG sensor1_diode_3c_config; extern ADI_SENSE_CONFIG sensor2_typeT_cjc0_config; extern ADI_SENSE_CONFIG sensor2_bridge_6w_pressure_config; extern ADI_SENSE_CONFIG sensor3_typeJ_cjc0_config; @@ -54,8 +76,10 @@ extern ADI_SENSE_CONFIG current_honeywellPressure_config; extern ADI_SENSE_CONFIG i2c0_honeywellHumidicon_config; extern ADI_SENSE_CONFIG i2c0_sensirionSHT3X_config; +extern ADI_SENSE_CONFIG i2c0_onsemiNOA1305_config; extern ADI_SENSE_CONFIG spi0_honeywellTrustability_config; extern ADI_SENSE_CONFIG spi0_adiAdxl362_config; +extern ADI_SENSE_CONFIG spi0_adiAdxl355_config; extern ADI_SENSE_CONFIG multichannel_continuous_config; extern ADI_SENSE_CONFIG multichannel_multicycle_config; extern ADI_SENSE_CONFIG multichannel_singlecycle_config; @@ -83,6 +107,7 @@ int main() { ADI_SENSE_RESULT res; + ADI_SENSE_STATUS status; ADI_SENSE_DEVICE_HANDLE hDevice; ADI_SENSE_MEASUREMENT_MODE eMeasurementMode = ADI_SENSE_MEASUREMENT_MODE_NORMAL; bool_t bDeviceReady; @@ -138,6 +163,20 @@ ADI_SENSE_LOG_ERROR("Failed to apply device configuration"); return res; } + /* + * Check device status after updating the configuration + */ + 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); + } /* * Kick off the measurement cycle here @@ -157,4 +196,3 @@ return 0; } -
--- a/multichannel_continuous_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/multichannel_continuous_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -241,4 +241,3 @@ }, }, }; -
--- a/multichannel_multicycle_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/multichannel_multicycle_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -245,4 +245,3 @@ }, }, }; -
--- a/multichannel_singlecycle_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/multichannel_singlecycle_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -240,4 +240,3 @@ }, }, }; -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sensor0_diode_2c_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -0,0 +1,118 @@ +/*! + ****************************************************************************** + * @file: sensor0_diode_config.cpp + * @brief: + *----------------------------------------------------------------------------- + * +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 "inc/adi_sense_config_types.h" + +ADI_SENSE_CONFIG sensor0_diode_2c_config = { + .versionId = { .major = 1, .minor = 4 }, + .productId = ADI_SENSE_PRODUCT_ID_ADSNS1000, + .adisense1000 = { + .power = { + .powerMode = ADI_SENSE_1000_POWER_MODE_FULL, + }, + .measurement = { + .operatingMode = ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE, + .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE, + }, + .channels = { + [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CJC_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = { + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE, + .measurementsPerCycle = 10, + .extraSettlingTime = 0, + .sensorParameter = 1.003, + .adcChannelConfig = { + .sensor = ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_TYPEA_DEF_L1, + .gain = ADI_SENSE_1000_ADC_GAIN_2X, + .current = { + .outputLevel = ADI_SENSE_1000_ADC_EXC_CURRENT_50uA, + .diodeRatio = ADI_SENSE_1000_ADC_EXC_CURRENT_IOUT_DIODE_DEFAULT, + }, + .filter = { + .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS, + }, + .reference = { + .type = ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL, + .disableBuffer = false, + }, + .enableVbias = false, + }, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_3] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CURRENT_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = { + .enableChannel = false, + }, + }, + }, +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sensor0_microphone_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -0,0 +1,114 @@ +/* +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. + * + *****************************************************************************/ + +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ +#include "inc/adi_sense_config_types.h" + +ADI_SENSE_CONFIG sensor0_microphone_config = { + .versionId = { .major = 1, .minor = 4 }, + .productId = ADI_SENSE_PRODUCT_ID_ADSNS1000, + .adisense1000 = { + .power = { + .powerMode = ADI_SENSE_1000_POWER_MODE_FULL, + }, + .measurement = { + .operatingMode = ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE, + .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE, + }, + .channels = { + [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CJC_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = { + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE, + .measurementsPerCycle = 10, + .extraSettlingTime = 0, + .adcChannelConfig = { + .sensor = ADI_SENSE_1000_ADC_SENSOR_MICROPHONE_B_DEF_L1, + .gain = ADI_SENSE_1000_ADC_GAIN_1X, + .filter = { + .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS, + }, + .reference = { + .type = ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL, + .disableBuffer = false, + }, + .enableVbias = true, + }, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_3] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CURRENT_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = { + .enableChannel = false, + }, + }, + }, +};
--- a/sensor0_rtd-2w-pt100_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor0_rtd-2w-pt100_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor0_rtd-2w-pt100_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor0_rtd_2w_pt100_config = { @@ -114,4 +115,3 @@ }, }, }; -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sensor1_diode_3c_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -0,0 +1,118 @@ +/*! + ****************************************************************************** + * @file: sensor0_diode_config.cpp + * @brief: + *----------------------------------------------------------------------------- + * +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 "inc/adi_sense_config_types.h" + +ADI_SENSE_CONFIG sensor1_diode_3c_config = { + .versionId = { .major = 1, .minor = 4 }, + .productId = ADI_SENSE_PRODUCT_ID_ADSNS1000, + .adisense1000 = { + .power = { + .powerMode = ADI_SENSE_1000_POWER_MODE_FULL, + }, + .measurement = { + .operatingMode = ADI_SENSE_1000_OPERATING_MODE_SINGLECYCLE, + .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE, + }, + .channels = { + [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CJC_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = { + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE, + .measurementsPerCycle = 10, + .extraSettlingTime = 0, + .sensorParameter = 1.003, + .adcChannelConfig = { + .sensor = ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_TYPEA_DEF_L1, + .gain = ADI_SENSE_1000_ADC_GAIN_2X, + .current = { + .outputLevel = ADI_SENSE_1000_ADC_EXC_CURRENT_50uA, + .diodeRatio = ADI_SENSE_1000_ADC_EXC_CURRENT_IOUT_DIODE_DEFAULT, + }, + .filter = { + .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS, + }, + .reference = { + .type = ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL, + .disableBuffer = false, + }, + .enableVbias = false, + }, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_3] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CURRENT_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = { + .enableChannel = false, + }, + }, + }, +};
--- a/sensor1_rtd-3w-pt100_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor1_rtd-3w-pt100_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor1_rtd-3w-pt100_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor1_rtd_3w_pt100_config = { @@ -114,4 +115,3 @@ }, }, }; -
--- a/sensor1_typeK_cjc1_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor1_typeK_cjc1_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor1_typeK_cjc1_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor1_typeK_cjc1_config = { @@ -130,4 +131,3 @@ }, }, }; -
--- a/sensor2_bridge-6w-pressure_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor2_bridge-6w-pressure_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor2_bridge-6w-pressure_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor2_bridge_6w_pressure_config = { @@ -111,4 +112,3 @@ }, }, }; -
--- a/sensor2_typeT_cjc0_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor2_typeT_cjc0_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor2_typeT_cjc0_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor2_typeT_cjc0_config = { @@ -130,4 +131,3 @@ }, }, }; -
--- a/sensor3_thermistor-10k-ntc_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor3_thermistor-10k-ntc_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor3_thermistor-10k-ntc_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor3_thermistor_10k_ntc_config = { @@ -111,4 +112,3 @@ }, }, }; -
--- a/sensor3_typeJ_cjc0_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/sensor3_typeJ_cjc0_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: sensor3_typeJ_cjc0_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG sensor3_typeJ_cjc0_config = { @@ -130,4 +131,3 @@ }, }, }; -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spi0_adiAdxl355_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -0,0 +1,130 @@ +/* +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. + * +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. + * + *****************************************************************************/ + +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ +#include "inc/adi_sense_config_types.h" + +ADI_SENSE_CONFIG spi0_adiAdxl355_config = { + .versionId = { .major = 1, .minor = 4 }, + .productId = ADI_SENSE_PRODUCT_ID_ADSNS1000, + .adisense1000 = { + .power = { + .powerMode = ADI_SENSE_1000_POWER_MODE_FULL, + }, + .measurement = { + .operatingMode = ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS, + .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE, + .cycleInterval = 1000000, + }, + .channels = { + [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CJC_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SENSOR_3] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_CURRENT_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_I2C_1] = { + .enableChannel = false, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = { + /* Accelerometer X-Axis (and common settings for physical channel) */ + .enableChannel = true, + .disablePublishing = false, + .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE, + .measurementsPerCycle = 10, + .extraSettlingTime = 1000, + .spiChannelConfig = { + .sensor = ADI_SENSE_1000_SPI_SENSOR_ACCELEROMETER_ADI_ADXL355, + .configurationCommand = { + .command = { 0x58, 0x83 }, /* +/-8G range */ + .commandLength = 2, + }, + }, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = { + /* Accelerometer Y-Axis (virtual channel) */ + .enableChannel = true, + }, + [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = { + /* Accelerometer Z-Axis (virtual channel) */ + .enableChannel = true, + }, + }, + }, +};
--- a/spi0_adiAdxl362_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/spi0_adiAdxl362_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: spi0_adiAdxl362_config.c - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG spi0_adiAdxl362_config = { @@ -121,4 +122,3 @@ }, }, }; -
--- a/spi0_honeywellTrustability_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/spi0_honeywellTrustability_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: spi0_honeywellTrustability_config.c - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG spi0_honeywellTrustability_config = { @@ -102,4 +103,3 @@ }, }, }; -
--- a/src/adi_sense_1000.c Mon Mar 26 14:50:05 2018 +0000 +++ b/src/adi_sense_1000.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,2347 +1,2661 @@ -/*! - ****************************************************************************** - * @file: adi_sense_1000.c - * @brief: ADISENSE API implementation for ADSNS1000 - *----------------------------------------------------------------------------- - */ - -/****************************************************************************** -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 "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 ADISENSE 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 ADISENSE 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_LUT, 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 = (ADI_SENSE_DEVICE_STATUS_FLAGS)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 ADISENSE 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 = ADI_SENSE_1000_CHANNEL_ID_CJC_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 = (ADI_SENSE_PRODUCT_ID)((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; - } - else if (powerMode == ADI_SENSE_1000_POWER_MODE_MID) - { - powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_MID_POWER; - } - else if (powerMode == ADI_SENSE_1000_POWER_MODE_FULL) - { - powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER; - } - 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; -} - -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; - } - - 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.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_OFF; - } - else - { - 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; - } - } - - 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)); - - /* - * NOTE - the fall-through cases in the switch statement below are - * intentional, so temporarily disable related compiler warnings which may - * be produced here by GCC - */ -#ifndef __CC_ARM -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -#endif - - switch (pConfigCommand->commandLength) - { - 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) - { - 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; - }; - - /* Re-enable the implicit-fallthrough warning */ -#ifndef __CC_ARM -#pragma GCC diagnostic pop -#endif - - 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_Left_Aligned = pDataFormat->leftJustified ? 1 : 0; - sensorConfigReg.Digital_Sensor_Little_Endian = 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.0f && fLowThresholdLimit == 0.0f) - { - 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.0f)) - fGainAdjustment = 1.0f; - if (isnan(fOffsetAdjustment)) - fOffsetAdjustment = 0.0f; - - 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_ADSNS1000) - { - ADI_SENSE_LOG_ERROR("Configuration Product ID (0x%X) is not supported (0x%0X)", - pConfig->productId, ADI_SENSE_PRODUCT_ID_ADSNS1000); - 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 = ADI_SENSE_1000_CHANNEL_ID_CJC_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 *)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; -} - +/* +CONFIDENTIAL AND PROPRIETARY INFORMATION + +Copyright (c) 2018 Emutex Ltd. All rights reserved. +This software and documentation contain confidential and +proprietary information that is the property of +Emutex Ltd. The software and documentation are +furnished under a license agreement and may be used +or copied only in accordance with the terms of the license +agreement. No part of the software and documentation +may be reproduced, transmitted, or translated, in any +form or by any means, electronic, mechanical, manual, +optical, or otherwise, without prior written permission +of Emutex Ltd., or as expressly provided by the license agreement. +Reverse engineering is prohibited, and reproduction, +disclosure or use without specific written authorization +of Emutex Ltd. is strictly forbidden. + */ + +/****************************************************************************** +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. + * + *****************************************************************************/ + +/*! + ****************************************************************************** + * @file: + * @brief: ADISENSE API implementation for ADSNS1000 + *----------------------------------------------------------------------------- + */ + +#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_host_comms.h" + +#include "crc16.h" + +/* + * 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 ADISENSE 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 ADISENSE 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); + case ADI_SENSE_MEASUREMENT_MODE_FFT: + return executeCommand(hDevice, ADISENSE_CORE_COMMAND_CONVERT_FFT, 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_1, 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_1, 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_LUT, 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, + uint8_t const nBytesPerSample, + uint32_t const nRequested, + uint32_t * const pnReturned) +{ + ADI_SENSE_DEVICE_CONTEXT *pCtx = hDevice; + uint16_t command = ADI_SENSE_1000_HOST_COMMS_READ_CMD | + (REG_ADISENSE_CORE_DATA_FIFO & ADI_SENSE_1000_HOST_COMMS_ADR_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(ADI_SENSE_1000_HOST_COMMS_XFER_DELAY); + } while ((commandResponse[0] != ADI_SENSE_1000_HOST_COMMS_CMD_RESP_0) || + (commandResponse[1] != ADI_SENSE_1000_HOST_COMMS_CMD_RESP_1)); + + for (unsigned i = 0; i < nRequested; i++) + { + ADI_SENSE_1000_Sensor_Result_t sensorResult; + bool_t bHoldCs = true; + + /* Keep the CS signal asserted for all but the last sample */ + if ((i + 1) == nRequested) + bHoldCs = false; + + eRet = adi_sense_SpiTransfer(pCtx->hSpi, NULL, &sensorResult, + nBytesPerSample, bHoldCs); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to read data from FIFO register"); + return eRet; + } + + if (! sensorResult.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 = (ADI_SENSE_DEVICE_STATUS_FLAGS)0; + if (sensorResult.Ch_Error) + pSample->status |= ADI_SENSE_DEVICE_STATUS_ERROR; + if (sensorResult.Ch_Alert) + pSample->status |= ADI_SENSE_DEVICE_STATUS_ALERT; + + if (sensorResult.Ch_Raw) + pSample->rawValue = sensorResult.Raw_Sample; + else + pSample->rawValue = 0; + + pSample->channelId = sensorResult.Channel_ID; + pSample->processedValue = sensorResult.Sensor_Result; + + nValidSamples++; + } + *pnReturned = nValidSamples; + + adi_sense_TimeDelayUsec(ADI_SENSE_1000_HOST_COMMS_XFER_DELAY); + + return eRet; +} + +/* + * Close the given ADISENSE 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 = ADI_SENSE_1000_HOST_COMMS_WRITE_CMD | + (nAddress & ADI_SENSE_1000_HOST_COMMS_ADR_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(ADI_SENSE_1000_HOST_COMMS_XFER_DELAY); + } while ((commandResponse[0] != ADI_SENSE_1000_HOST_COMMS_CMD_RESP_0) || + (commandResponse[1] != ADI_SENSE_1000_HOST_COMMS_CMD_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(ADI_SENSE_1000_HOST_COMMS_XFER_DELAY); + + 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 = ADI_SENSE_1000_HOST_COMMS_READ_CMD | + (nAddress & ADI_SENSE_1000_HOST_COMMS_ADR_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(ADI_SENSE_1000_HOST_COMMS_XFER_DELAY); + } while ((commandResponse[0] != ADI_SENSE_1000_HOST_COMMS_CMD_RESP_0) || + (commandResponse[1] != ADI_SENSE_1000_HOST_COMMS_CMD_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(ADI_SENSE_1000_HOST_COMMS_XFER_DELAY); + + 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, + uint8_t * const pnBytesPerSample) +{ + unsigned nChannelsEnabled = 0; + unsigned nSamplesPerCycle = 0; + + ADI_ADISENSE_CORE_Mode_t modeReg; + READ_REG_U8(hDevice, modeReg.VALUE8, CORE_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; + + + /* FFT mode is quite different to the other modes: + * - Each FFT result produces a batch of samples + * - The size of the batch depends on selected FFT size and output config options + * - DATAREADY will fire for each FFT result (once per channel) + * - The size of the cycle depends on the number of channels enabled for FFT + */ + if (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_FFT) + { + ADI_ADISENSE_CORE_FFT_Config_t fftConfigReg; + + unsigned nFftChannels; + unsigned nSamplesPerChannel; + + READ_REG_U32(hDevice, fftConfigReg.VALUE32, CORE_FFT_CONFIG); + + nFftChannels = fftConfigReg.FFT_Num_Channels + 1; + + if (fftConfigReg.FFT_Output == ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_MAX16) + { + nSamplesPerChannel = 16; + *pnBytesPerSample = 8; + } + else if (fftConfigReg.FFT_Output == ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL) + { + nSamplesPerChannel = (256 << fftConfigReg.FFT_Num_Bins) >> 1; + *pnBytesPerSample = 5; + } + else if (fftConfigReg.FFT_Output == ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL_WITH_RAW) + { + nSamplesPerChannel = (256 << fftConfigReg.FFT_Num_Bins); + *pnBytesPerSample = 8; + } + else + { + ADI_SENSE_LOG_ERROR("Invalid FFT output format option %d configured", + fftConfigReg.FFT_Output); + return ADI_SENSE_INVALID_PARAM; + } + + *pnSamplesPerDataready = nSamplesPerChannel; + *pnSamplesPerCycle = nSamplesPerChannel * nFftChannels; + + *peDataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE; + } + else + { + if (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_OMIT_RAW) + { + *pnBytesPerSample = 5; + } + else + { + *pnBytesPerSample = 8; + } + + for (ADI_SENSE_1000_CHANNEL_ID chId = ADI_SENSE_1000_CHANNEL_ID_CJC_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) || + (sensorTypeReg.Sensor_Type == + ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_2)) + 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; + } + + *pnSamplesPerCycle = nSamplesPerCycle; + + if (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 + { + /* Assume DRDY will be asserted after max. 1 cycle in test mode */ + if (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK) + { + *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; + } + } + + if (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 + { + /* Assume DRDY will be asserted after max. 1 cycle in test mode */ + if (eMeasurementMode == ADI_SENSE_MEASUREMENT_MODE_HEALTHCHECK) + *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 = (ADI_SENSE_PRODUCT_ID)((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; + } + else if (powerMode == ADI_SENSE_1000_POWER_MODE_MID) + { + powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_MID_POWER; + } + else if (powerMode == ADI_SENSE_1000_POWER_MODE_FULL) + { + powerConfigReg.Power_Mode_ADC = ADISENSE_CORE_POWER_CONFIG_ADC_FULL_POWER; + } + 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; +} + +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; + } + + 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_SetCycleControl( + ADI_SENSE_DEVICE_HANDLE hDevice, + uint32_t nCycleInterval, + ADI_SENSE_1000_CYCLE_TYPE eCycleType) +{ + 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; + + if (eCycleType == ADI_SENSE_1000_CYCLE_TYPE_SWITCH) + { + cycleControlReg.Cycle_Type = ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TYPE_SWITCH; + } + else if (eCycleType == ADI_SENSE_1000_CYCLE_TYPE_FULL) + { + cycleControlReg.Cycle_Type = ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TYPE_FULL; + } + else + { + ADI_SENSE_LOG_ERROR("Invalid cycle type %d specified", eCycleType); + return ADI_SENSE_INVALID_PARAM; + } + + 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; + } + + eRet = adi_sense_SetCycleControl(hDevice, + pMeasConfig->cycleInterval, + pMeasConfig->cycleType); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set cycle control"); + 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_SetFftConfig( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_FFT_CONFIG *pFftConfig, + ADI_SENSE_1000_CHANNEL_CONFIG *pChannels) +{ + ADI_ADISENSE_CORE_FFT_Config_t fftConfigReg; + ADI_ADISENSE_CORE_Mode_t modeReg; + uint32_t numFftChannels = 0; + + fftConfigReg.VALUE32 = REG_RESET_VAL(CORE_FFT_CONFIG); + + for (ADI_SENSE_1000_CHANNEL_ID id = ADI_SENSE_1000_CHANNEL_ID_CJC_0; + id < ADI_SENSE_1000_MAX_CHANNELS; + id++) + { + if (pChannels[id].enableFFT) + { + if (numFftChannels >= 4) /* TODO - temporary limit */ + { + ADI_SENSE_LOG_ERROR("Maximum limit of 4 FFT channels exceeded"); + return ADI_SENSE_INVALID_PARAM; + } + + numFftChannels++; + } + } + + if (numFftChannels > 0) + { + fftConfigReg.FFT_Num_Channels = numFftChannels - 1; + + switch (pFftConfig->size) + { + case ADI_SENSE_1000_FFT_SIZE_256: + fftConfigReg.FFT_Num_Bins = ADISENSE_CORE_FFT_CONFIG_FFT_BINS_256; + break; + case ADI_SENSE_1000_FFT_SIZE_512: + fftConfigReg.FFT_Num_Bins = ADISENSE_CORE_FFT_CONFIG_FFT_BINS_512; + break; + case ADI_SENSE_1000_FFT_SIZE_1024: + fftConfigReg.FFT_Num_Bins = ADISENSE_CORE_FFT_CONFIG_FFT_BINS_1024; + break; + case ADI_SENSE_1000_FFT_SIZE_2048: + fftConfigReg.FFT_Num_Bins = ADISENSE_CORE_FFT_CONFIG_FFT_BINS_2048; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid FFT size option %d specified", + pFftConfig->size); + return ADI_SENSE_INVALID_PARAM; + } + + switch (pFftConfig->window) + { + case ADI_SENSE_1000_FFT_WINDOW_NONE: + fftConfigReg.FFT_Window = ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_NONE; + break; + case ADI_SENSE_1000_FFT_WINDOW_HANN: + fftConfigReg.FFT_Window = ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_HANN; + break; + case ADI_SENSE_1000_FFT_WINDOW_BLACKMAN_HARRIS: + fftConfigReg.FFT_Window = ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_BLACKMANN_HARRIS; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid FFT window option %d specified", + pFftConfig->window); + return ADI_SENSE_INVALID_PARAM; + } + + switch (pFftConfig->output) + { + case ADI_SENSE_1000_FFT_OUTPUT_FULL: + fftConfigReg.FFT_Output = ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL; + break; + case ADI_SENSE_1000_FFT_OUTPUT_MAX16: + fftConfigReg.FFT_Output = ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_MAX16; + break; + case ADI_SENSE_1000_FFT_OUTPUT_FULL_WITH_RAW: + fftConfigReg.FFT_Output = ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL_WITH_RAW; + break; + default: + ADI_SENSE_LOG_ERROR("Invalid FFT output format option %d specified", + pFftConfig->output); + return ADI_SENSE_INVALID_PARAM; + } + } + WRITE_REG_U32(hDevice, fftConfigReg.VALUE32, CORE_FFT_CONFIG); + + if (numFftChannels > 0) + { + READ_REG_U8(hDevice, modeReg.VALUE8, CORE_MODE); + + if (pFftConfig->mode == ADI_SENSE_1000_FFT_MODE_SINGLE) + { + modeReg.FFT_Mode = ADISENSE_CORE_MODE_FFT_MODE_SINGLE; + } + else if (pFftConfig->mode == ADI_SENSE_1000_FFT_MODE_CONTINUOUS) + { + modeReg.FFT_Mode = ADISENSE_CORE_MODE_FFT_MODE_CONTINUOUS; + } + else + { + ADI_SENSE_LOG_ERROR("Invalid FFT mode %d specified", + pFftConfig->mode); + return ADI_SENSE_INVALID_PARAM; + } + + WRITE_REG_U8(hDevice, modeReg.VALUE8, CORE_MODE); + } + + 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; +} + +ADI_SENSE_RESULT adi_sense_1000_SetChannelOptions( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + ADI_SENSE_1000_CHANNEL_PRIORITY ePriority, + bool bEnableFft) +{ + ADI_ADISENSE_CORE_Channel_Options_t channelOptionsReg; + + channelOptionsReg.VALUE8 = REG_RESET_VAL(CORE_CHANNEL_OPTIONSn); + + CHECK_REG_FIELD_VAL(CORE_CHANNEL_OPTIONS_CHANNEL_PRIORITY, ePriority); + channelOptionsReg.Channel_Priority = ePriority; + channelOptionsReg.FFT_Enable_Ch = bEnableFft ? 1 : 0; + + WRITE_REG_U8(hDevice, channelOptionsReg.VALUE8, CORE_CHANNEL_OPTIONSn(eChannelId)); + + return ADI_SENSE_SUCCESS; +} + +ADI_SENSE_RESULT adi_sense_1000_SetChannelSkipCount( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + uint32_t nCycleSkipCount) +{ + ADI_ADISENSE_CORE_Channel_Skip_t channelSkipReg; + + channelSkipReg.VALUE16 = REG_RESET_VAL(CORE_CHANNEL_SKIPn); + + CHECK_REG_FIELD_VAL(CORE_CHANNEL_SKIP_CHANNEL_SKIP, nCycleSkipCount); + + channelSkipReg.Channel_Skip = nCycleSkipCount; + + WRITE_REG_U16(hDevice, channelSkipReg.VALUE16, CORE_CHANNEL_SKIPn(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: + case ADI_SENSE_1000_ADC_SENSOR_MICROPHONE_A_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_MICROPHONE_B_DEF_L1: + 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: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_TYPEA_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_TYPEA_DEF_L1: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_TYPEA_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_TYPEA_ADV_L1: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_2C_1_ADV_L2: + case ADI_SENSE_1000_ADC_SENSOR_DIODE_3C_1_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_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_2_DEF_L2: + 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_1_DEF_L2: + case ADI_SENSE_1000_ADC_SENSOR_CURRENT_PRESSURE_2_DEF_L2: + 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.IOUT_Excitation_Current = ADISENSE_CORE_CHANNEL_EXCITATION_IEXC_OFF; + } + else + { + 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->diodeRatio == ADI_SENSE_1000_ADC_EXC_CURRENT_IOUT_DIODE_DEFAULT) + { + channelExcitationReg.IOUT_Diode_Ratio = 0; + } + else + { + channelExcitationReg.IOUT_Diode_Ratio = 1; + } + + 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)); + + /* + * NOTE - the fall-through cases in the switch statement below are + * intentional, so temporarily disable related compiler warnings which may + * be produced here by GCC + */ +#ifndef __CC_ARM +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + + switch (pConfigCommand->commandLength) + { + 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) + { + 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; + }; + + /* Re-enable the implicit-fallthrough warning */ +#ifndef __CC_ARM +#pragma GCC diagnostic pop +#endif + + 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_Left_Aligned = pDataFormat->leftJustified ? 1 : 0; + sensorConfigReg.Digital_Sensor_Little_Endian = 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; + case ADI_SENSE_1000_I2C_SENSOR_LIGHT_ONSEMI_NOA1305: + sensorTypeReg.Sensor_Type = ADISENSE_CORE_SENSOR_TYPE_SENSOR_I2C_AMBIENTLIGHT_1; + 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; + case ADI_SENSE_1000_SPI_SENSOR_ACCELEROMETER_ADI_ADXL355: + sensorTypeReg.Sensor_Type = ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_2; + 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.0f && fLowThresholdLimit == 0.0f) + { + 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.0f)) + fGainAdjustment = 1.0f; + if (isnan(fOffsetAdjustment)) + fOffsetAdjustment = 0.0f; + + 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_SetSensorParameter( + ADI_SENSE_DEVICE_HANDLE hDevice, + ADI_SENSE_1000_CHANNEL_ID eChannelId, + float32_t fSensorParam) +{ + if (fSensorParam == 0.0) + fSensorParam = NAN; + + WRITE_REG_FLOAT(hDevice, fSensorParam, CORE_SENSOR_PARAMETERn(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) +{ + ADI_ADISENSE_CORE_Settling_Time_t settlingTimeReg; + + if (nSettlingTime < (1 << 12)) + { + settlingTimeReg.Settling_Time_Units = ADISENSE_CORE_SETTLING_TIME_MICROSECONDS; + } + else if (nSettlingTime < (1000 * (1 << 12))) + { + settlingTimeReg.Settling_Time_Units = ADISENSE_CORE_SETTLING_TIME_MILLISECONDS; + nSettlingTime /= 1000; + } + else + { + settlingTimeReg.Settling_Time_Units = ADISENSE_CORE_SETTLING_TIME_SECONDS; + nSettlingTime /= 1000000; + } + + CHECK_REG_FIELD_VAL(CORE_SETTLING_TIME_SETTLING_TIME, nSettlingTime); + settlingTimeReg.Settling_Time = nSettlingTime; + + WRITE_REG_U16(hDevice, settlingTimeReg.VALUE16, 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; + } + + eRet = adi_sense_1000_SetChannelOptions(hDevice, eChannelId, + pChannelConfig->priority, + pChannelConfig->enableFFT); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set priority for channel %d", + eChannelId); + return eRet; + } + + eRet = adi_sense_1000_SetChannelSkipCount(hDevice, eChannelId, + pChannelConfig->cycleSkipCount); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set cycle skip 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; + } + + /* Set sensor specific parameter */ + eRet = adi_sense_1000_SetSensorParameter(hDevice, eChannelId, + pChannelConfig->sensorParameter); + if (eRet != ADI_SENSE_SUCCESS) + { + ADI_SENSE_LOG_ERROR("Failed to set sensor parameter 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_ADSNS1000) + { + ADI_SENSE_LOG_ERROR("Configuration Product ID (0x%X) is not supported (0x%0X)", + pConfig->productId, ADI_SENSE_PRODUCT_ID_ADSNS1000); + 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 = ADI_SENSE_1000_CHANNEL_ID_CJC_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; + } + } + + eRet = adi_sense_1000_SetFftConfig(hDevice, &pDeviceConfig->fft, + pDeviceConfig->channels); + if (eRet) + { + ADI_SENSE_LOG_ERROR("Failed to set FFT configuration"); + 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 *)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; +}
--- a/src/adi_sense_1000/ADISENSE1000_REGISTERS.h Mon Mar 26 14:50:05 2018 +0000 +++ b/src/adi_sense_1000/ADISENSE1000_REGISTERS.h Mon Mar 26 20:28:05 2018 +0100 @@ -4,7 +4,7 @@ File : ADISENSE1000_REGISTERS.h Description : Register Definitions - Date : Feb 27, 2018 + Date : Mar 16, 2018 Copyright (c) 2018 Analog Devices, Inc. All Rights Reserved. This software is proprietary and confidential to Analog Devices, Inc. and @@ -30,7 +30,7 @@ #define __ADI_HAS_ADISENSE_TEST__ 1 /* ============================================================================================================================ - + ============================================================================================================================ */ /* ============================================================================================================================ @@ -68,7 +68,7 @@ #define REG_ADISENSE_SPI_INTERFACE_STATUS_A 0x00000011 /* ADISENSE_SPI Interface Status A */ /* ============================================================================================================================ - ADISENSE_SPI Register BitMasks, Positions & Enumerations + ADISENSE_SPI Register BitMasks, Positions & Enumerations ============================================================================================================================ */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_SPI_INTERFACE_CONFIG_A Pos/Masks Description @@ -243,6 +243,9 @@ #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_CH13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH13 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH14 */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_DETAIL_CH15 */ #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 */ @@ -256,8 +259,11 @@ #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_CH13 0x00000044 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH14 0x00000046 /* ADISENSE_CORE Detailed Error Information */ +#define REG_ADISENSE_CORE_ALERT_DETAIL_CH15 0x00000048 /* 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_ALERT_DETAIL_CHn_COUNT 16 #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 */ @@ -269,13 +275,23 @@ #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_DATA_FIFO 0x00000060 /* ADISENSE_CORE FIFO Buffer of Sensor Results */ +#define REG_ADISENSE_CORE_FFT_CONFIG_RESET 0x00000000 /* Reset Value for FFT_Config */ +#define REG_ADISENSE_CORE_FFT_CONFIG 0x00000068 /* ADISENSE_CORE FFT Configuration */ +#define REG_ADISENSE_CORE_ADVANCED_SENSOR_ACCESS_RESET 0x00000000 /* Reset Value for Advanced_Sensor_Access */ +#define REG_ADISENSE_CORE_ADVANCED_SENSOR_ACCESS 0x0000006E /* ADISENSE_CORE Enables Access to Advanced Sensor Configuration */ #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_EXT_FLASH_INDEX_RESET 0x00000000 /* Reset Value for Ext_Flash_Index */ +#define REG_ADISENSE_CORE_EXT_FLASH_INDEX 0x00000080 /* ADISENSE_CORE Start Position (Sample No.) for Retrieval of Ext. Flash Data */ +#define REG_ADISENSE_CORE_EXT_FLASH_SAMPLE_COUNT_RESET 0x00000000 /* Reset Value for Ext_Flash_Sample_Count */ +#define REG_ADISENSE_CORE_EXT_FLASH_SAMPLE_COUNT 0x00000084 /* ADISENSE_CORE Indicates How Many Samples Stored in External Flash */ +#define REG_ADISENSE_CORE_EXT_FLASH_DATA_RESET 0x00000000 /* Reset Value for Ext_Flash_Data */ +#define REG_ADISENSE_CORE_EXT_FLASH_DATA 0x00000088 /* ADISENSE_CORE Data Read Back from External Flash */ #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] */ @@ -290,6 +306,11 @@ #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_COUNT11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT11 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT12 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT13 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT14 */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_COUNT15 */ #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 */ @@ -301,8 +322,48 @@ #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_COUNT11 0x00000350 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT12 0x00000390 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT13 0x000003D0 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT14 0x00000410 /* ADISENSE_CORE Number of Channel Occurrences per Measurement Cycle */ +#define REG_ADISENSE_CORE_CHANNEL_COUNT15 0x00000450 /* 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_CHANNEL_COUNTn_COUNT 16 +#define REG_ADISENSE_CORE_CHANNEL_OPTIONSn_RESET 0x00000000 /* Reset Value for Channel_Options[n] */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS0 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS1 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS2 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS3 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS4 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS5 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS6 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS7 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS8 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS9 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS10 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS11 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS12 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS13 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS14 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_OPTIONS15 */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS0 0x00000091 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS1 0x000000D1 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS2 0x00000111 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS3 0x00000151 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS4 0x00000191 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS5 0x000001D1 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS6 0x00000211 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS7 0x00000251 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS8 0x00000291 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS9 0x000002D1 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS10 0x00000311 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS11 0x00000351 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS12 0x00000391 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS13 0x000003D1 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS14 0x00000411 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONS15 0x00000451 /* ADISENSE_CORE Position of Channel Within Sequence and Enable for FFT */ +#define REG_ADISENSE_CORE_CHANNEL_OPTIONSn(i) (REG_ADISENSE_CORE_CHANNEL_OPTIONS0 + ((i) * 64)) +#define REG_ADISENSE_CORE_CHANNEL_OPTIONSn_COUNT 16 #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 */ @@ -315,6 +376,11 @@ #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_TYPE11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE11 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE12 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE13 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE14 */ +#define REG_ADISENSE_CORE_SENSOR_TYPE15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_TYPE15 */ #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 */ @@ -326,8 +392,13 @@ #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_TYPE11 0x00000352 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE12 0x00000392 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE13 0x000003D2 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE14 0x00000412 /* ADISENSE_CORE Sensor Select */ +#define REG_ADISENSE_CORE_SENSOR_TYPE15 0x00000452 /* 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_TYPEn_COUNT 16 #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 */ @@ -340,6 +411,11 @@ #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_DETAILS11_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS11 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS12_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS12 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS13_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS13 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS14_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS14 */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS15_RESET 0x0000FFF0 /* Reset Value for REG_ADISENSE_CORE_SENSOR_DETAILS15 */ #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 */ @@ -351,8 +427,13 @@ #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_DETAILS11 0x00000354 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS12 0x00000394 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS13 0x000003D4 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS14 0x00000414 /* ADISENSE_CORE Sensor Details */ +#define REG_ADISENSE_CORE_SENSOR_DETAILS15 0x00000454 /* 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_SENSOR_DETAILSn_COUNT 16 #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 */ @@ -365,6 +446,11 @@ #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_EXCITATION11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION11 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION12 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION13 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION14 */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_EXCITATION15 */ #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 */ @@ -376,8 +462,13 @@ #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_EXCITATION11 0x00000358 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION12 0x00000398 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION13 0x000003D8 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION14 0x00000418 /* ADISENSE_CORE Excitation Current */ +#define REG_ADISENSE_CORE_CHANNEL_EXCITATION15 0x00000458 /* 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_CHANNEL_EXCITATIONn_COUNT 16 #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 */ @@ -390,6 +481,11 @@ #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_TIME11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME11 */ +#define REG_ADISENSE_CORE_SETTLING_TIME12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME12 */ +#define REG_ADISENSE_CORE_SETTLING_TIME13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME13 */ +#define REG_ADISENSE_CORE_SETTLING_TIME14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME14 */ +#define REG_ADISENSE_CORE_SETTLING_TIME15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SETTLING_TIME15 */ #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 */ @@ -401,8 +497,13 @@ #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_TIME11 0x0000035A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME12 0x0000039A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME13 0x000003DA /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME14 0x0000041A /* ADISENSE_CORE Settling Time */ +#define REG_ADISENSE_CORE_SETTLING_TIME15 0x0000045A /* 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_SETTLING_TIMEn_COUNT 16 #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 */ @@ -415,6 +516,11 @@ #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_SELECT11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT11 */ +#define REG_ADISENSE_CORE_FILTER_SELECT12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT12 */ +#define REG_ADISENSE_CORE_FILTER_SELECT13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT13 */ +#define REG_ADISENSE_CORE_FILTER_SELECT14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT14 */ +#define REG_ADISENSE_CORE_FILTER_SELECT15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_FILTER_SELECT15 */ #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 */ @@ -426,8 +532,13 @@ #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_SELECT11 0x0000035C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT12 0x0000039C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT13 0x000003DC /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT14 0x0000041C /* ADISENSE_CORE ADC Digital Filter Selection */ +#define REG_ADISENSE_CORE_FILTER_SELECT15 0x0000045C /* 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_FILTER_SELECTn_COUNT 16 #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 */ @@ -442,6 +553,9 @@ #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_LIMIT13_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT13 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT14_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT14 */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT15_RESET 0x7F800000 /* Reset Value for REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT15 */ #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 */ @@ -455,8 +569,11 @@ #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_LIMIT13 0x000003E0 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT14 0x00000420 /* ADISENSE_CORE High Threshold */ +#define REG_ADISENSE_CORE_HIGH_THRESHOLD_LIMIT15 0x00000460 /* 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_HIGH_THRESHOLD_LIMITn_COUNT 16 #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 */ @@ -471,6 +588,9 @@ #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_LIMIT13_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT13 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT14_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT14 */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT15_RESET 0xFF800000 /* Reset Value for REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT15 */ #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 */ @@ -484,8 +604,11 @@ #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_LIMIT13 0x000003E4 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT14 0x00000424 /* ADISENSE_CORE Low Threshold */ +#define REG_ADISENSE_CORE_LOW_THRESHOLD_LIMIT15 0x00000464 /* 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_LOW_THRESHOLD_LIMITn_COUNT 16 #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 */ @@ -500,6 +623,9 @@ #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_OFFSET13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET13 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET14 */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_OFFSET15 */ #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 */ @@ -513,8 +639,11 @@ #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_OFFSET13 0x000003E8 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET14 0x00000428 /* ADISENSE_CORE Sensor Offset Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_OFFSET15 0x00000468 /* 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_OFFSETn_COUNT 16 #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 */ @@ -529,6 +658,9 @@ #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_GAIN13_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN13 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN14_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN14 */ +#define REG_ADISENSE_CORE_SENSOR_GAIN15_RESET 0x3F800000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_GAIN15 */ #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 */ @@ -542,8 +674,11 @@ #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_GAIN13 0x000003EC /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN14 0x0000042C /* ADISENSE_CORE Sensor Gain Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_GAIN15 0x0000046C /* 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_SENSOR_GAINn_COUNT 16 #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 */ @@ -558,6 +693,9 @@ #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_CH13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH13 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH14 */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_ALERT_CODE_CH15 */ #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 */ @@ -571,8 +709,81 @@ #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_CH13 0x000003F0 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH14 0x00000430 /* ADISENSE_CORE Per-Channel Detailed Alert-Code Information */ +#define REG_ADISENSE_CORE_ALERT_CODE_CH15 0x00000470 /* 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_ALERT_CODE_CHn_COUNT 16 +#define REG_ADISENSE_CORE_CHANNEL_SKIPn_RESET 0x00000000 /* Reset Value for Channel_Skip[n] */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP0 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP1 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP2 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP3 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP4 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP5 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP6 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP7 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP8 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP9 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP10 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP11 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP12 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP13 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP14 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_CHANNEL_SKIP15 */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP0 0x000000B2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP1 0x000000F2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP2 0x00000132 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP3 0x00000172 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP4 0x000001B2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP5 0x000001F2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP6 0x00000232 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP7 0x00000272 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP8 0x000002B2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP9 0x000002F2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP10 0x00000332 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP11 0x00000372 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP12 0x000003B2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP13 0x000003F2 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP14 0x00000432 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIP15 0x00000472 /* ADISENSE_CORE Indicates If Channel Will Skip Some Measurement Cycles */ +#define REG_ADISENSE_CORE_CHANNEL_SKIPn(i) (REG_ADISENSE_CORE_CHANNEL_SKIP0 + ((i) * 64)) +#define REG_ADISENSE_CORE_CHANNEL_SKIPn_COUNT 16 +#define REG_ADISENSE_CORE_SENSOR_PARAMETERn_RESET 0x7FC00000 /* Reset Value for Sensor_Parameter[n] */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER0_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER0 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER1_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER1 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER2_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER2 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER3_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER3 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER4_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER4 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER5_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER5 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER6_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER6 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER7_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER7 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER8_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER8 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER9_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER9 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER10_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER10 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER11_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER11 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER12_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER12 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER13_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER13 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER14_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER14 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER15_RESET 0x7FC00000 /* Reset Value for REG_ADISENSE_CORE_SENSOR_PARAMETER15 */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER0 0x000000B4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER1 0x000000F4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER2 0x00000134 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER3 0x00000174 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER4 0x000001B4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER5 0x000001F4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER6 0x00000234 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER7 0x00000274 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER8 0x000002B4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER9 0x000002F4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER10 0x00000334 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER11 0x00000374 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER12 0x000003B4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER13 0x000003F4 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER14 0x00000434 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETER15 0x00000474 /* ADISENSE_CORE Sensor Parameter Adjustment */ +#define REG_ADISENSE_CORE_SENSOR_PARAMETERn(i) (REG_ADISENSE_CORE_SENSOR_PARAMETER0 + ((i) * 64)) +#define REG_ADISENSE_CORE_SENSOR_PARAMETERn_COUNT 16 #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 */ @@ -585,6 +796,11 @@ #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_CONFIG11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG11 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG12 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG13 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG14 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG15 */ #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 */ @@ -596,8 +812,13 @@ #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_CONFIG11 0x00000378 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG12 0x000003B8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG13 0x000003F8 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG14 0x00000438 /* ADISENSE_CORE Digital Sensor Data Coding */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_CONFIG15 0x00000478 /* 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_CONFIGn_COUNT 16 #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 */ @@ -610,6 +831,11 @@ #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_ADDRESS11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS11 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS12 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS13 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS14 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS15 */ #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 */ @@ -621,8 +847,13 @@ #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_ADDRESS11 0x0000037A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS12 0x000003BA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS13 0x000003FA /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS14 0x0000043A /* ADISENSE_CORE Sensor Address */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_ADDRESS15 0x0000047A /* 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_ADDRESSn_COUNT 16 #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 */ @@ -635,6 +866,11 @@ #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_CMDS11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS11 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS12 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS13 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS14 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS15 */ #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 */ @@ -646,8 +882,48 @@ #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_CMDS11 0x0000037B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS12 0x000003BB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS13 0x000003FB /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS14 0x0000043B /* ADISENSE_CORE Number of Configuration, Read Commands for Digital Sensors */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_NUM_CMDS15 0x0000047B /* 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_NUM_CMDSn_COUNT 16 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMSn_RESET 0x00000000 /* Reset Value for Digital_Sensor_Comms[n] */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS0_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS0 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS1_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS2_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS3_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS4_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS5_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS6_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS7_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS8_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS8 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS9_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS9 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS10_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS10 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS11_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS11 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS12_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS12 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS13_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS13 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS14_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS14 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS15_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS15 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS0 0x000000BC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS1 0x000000FC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS2 0x0000013C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS3 0x0000017C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS4 0x000001BC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS5 0x000001FC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS6 0x0000023C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS7 0x0000027C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS8 0x000002BC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS9 0x000002FC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS10 0x0000033C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS11 0x0000037C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS12 0x000003BC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS13 0x000003FC /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS14 0x0000043C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS15 0x0000047C /* ADISENSE_CORE Digital Sensor Communication Clock Configuration */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMSn(i) (REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMS0 + ((i) * 64)) +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMSn_COUNT 16 #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 */ @@ -660,6 +936,11 @@ #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_COMMAND111_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND111 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND112_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND112 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND113_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND113 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND114_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND114 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND115_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND115 */ #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 */ @@ -671,8 +952,13 @@ #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_COMMAND111 0x00000380 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND112 0x000003C0 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND113 0x00000400 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND114 0x00000440 /* ADISENSE_CORE Sensor Configuration Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND115 0x00000480 /* 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_COMMAND1n_COUNT 16 #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 */ @@ -685,6 +971,11 @@ #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_COMMAND211_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND211 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND212_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND212 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND213_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND213 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND214_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND214 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND215_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND215 */ #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 */ @@ -696,8 +987,13 @@ #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_COMMAND211 0x00000381 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND212 0x000003C1 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND213 0x00000401 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND214 0x00000441 /* ADISENSE_CORE Sensor Configuration Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND215 0x00000481 /* 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_COMMAND2n_COUNT 16 #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 */ @@ -710,6 +1006,11 @@ #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_COMMAND311_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND311 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND312_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND312 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND313_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND313 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND314_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND314 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND315_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND315 */ #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 */ @@ -721,8 +1022,13 @@ #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_COMMAND311 0x00000382 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND312 0x000003C2 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND313 0x00000402 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND314 0x00000442 /* ADISENSE_CORE Sensor Configuration Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND315 0x00000482 /* 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_COMMAND3n_COUNT 16 #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 */ @@ -735,6 +1041,11 @@ #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_COMMAND411_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND411 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND412_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND412 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND413_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND413 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND414_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND414 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND415_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND415 */ #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 */ @@ -746,8 +1057,13 @@ #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_COMMAND411 0x00000383 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND412 0x000003C3 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND413 0x00000403 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND414 0x00000443 /* ADISENSE_CORE Sensor Configuration Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND415 0x00000483 /* 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_COMMAND4n_COUNT 16 #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 */ @@ -760,6 +1076,11 @@ #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_COMMAND511_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND511 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND512_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND512 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND513_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND513 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND514_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND514 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND515_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND515 */ #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 */ @@ -771,8 +1092,13 @@ #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_COMMAND511 0x00000384 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND512 0x000003C4 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND513 0x00000404 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND514 0x00000444 /* ADISENSE_CORE Sensor Configuration Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND515 0x00000484 /* 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_COMMAND5n_COUNT 16 #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 */ @@ -785,6 +1111,11 @@ #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_COMMAND611_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND611 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND612_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND612 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND613_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND613 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND614_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND614 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND615_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND615 */ #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 */ @@ -796,8 +1127,13 @@ #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_COMMAND611 0x00000385 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND612 0x000003C5 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND613 0x00000405 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND614 0x00000445 /* ADISENSE_CORE Sensor Configuration Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND615 0x00000485 /* 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_COMMAND6n_COUNT 16 #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 */ @@ -810,6 +1146,11 @@ #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_COMMAND711_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND711 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND712_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND712 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND713_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND713 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND714_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND714 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND715_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND715 */ #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 */ @@ -821,8 +1162,13 @@ #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_COMMAND711 0x00000386 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND712 0x000003C6 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND713 0x00000406 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND714 0x00000446 /* ADISENSE_CORE Sensor Configuration Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_COMMAND715 0x00000486 /* 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_COMMAND7n_COUNT 16 #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 */ @@ -835,6 +1181,11 @@ #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_CMD111_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD111 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD112_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD112 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD113_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD113 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD114_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD114 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD115_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD115 */ #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 */ @@ -846,8 +1197,13 @@ #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_CMD111 0x00000388 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD112 0x000003C8 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD113 0x00000408 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD114 0x00000448 /* ADISENSE_CORE Sensor Read Command1 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD115 0x00000488 /* 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_CMD1n_COUNT 16 #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 */ @@ -860,6 +1216,11 @@ #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_CMD211_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD211 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD212_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD212 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD213_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD213 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD214_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD214 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD215_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD215 */ #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 */ @@ -871,8 +1232,13 @@ #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_CMD211 0x00000389 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD212 0x000003C9 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD213 0x00000409 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD214 0x00000449 /* ADISENSE_CORE Sensor Read Command2 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD215 0x00000489 /* 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_CMD2n_COUNT 16 #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 */ @@ -885,6 +1251,11 @@ #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_CMD311_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD311 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD312_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD312 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD313_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD313 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD314_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD314 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD315_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD315 */ #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 */ @@ -896,8 +1267,13 @@ #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_CMD311 0x0000038A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD312 0x000003CA /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD313 0x0000040A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD314 0x0000044A /* ADISENSE_CORE Sensor Read Command3 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD315 0x0000048A /* 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_CMD3n_COUNT 16 #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 */ @@ -910,6 +1286,11 @@ #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_CMD411_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD411 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD412_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD412 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD413_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD413 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD414_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD414 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD415_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD415 */ #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 */ @@ -921,8 +1302,13 @@ #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_CMD411 0x0000038B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD412 0x000003CB /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD413 0x0000040B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD414 0x0000044B /* ADISENSE_CORE Sensor Read Command4 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD415 0x0000048B /* 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_CMD4n_COUNT 16 #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 */ @@ -935,6 +1321,11 @@ #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_CMD511_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD511 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD512_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD512 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD513_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD513 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD514_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD514 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD515_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD515 */ #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 */ @@ -946,8 +1337,13 @@ #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_CMD511 0x0000038C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD512 0x000003CC /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD513 0x0000040C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD514 0x0000044C /* ADISENSE_CORE Sensor Read Command5 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD515 0x0000048C /* 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_CMD5n_COUNT 16 #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 */ @@ -960,6 +1356,11 @@ #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_CMD611_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD611 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD612_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD612 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD613_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD613 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD614_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD614 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD615_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD615 */ #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 */ @@ -971,8 +1372,13 @@ #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_CMD611 0x0000038D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD612 0x000003CD /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD613 0x0000040D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD614 0x0000044D /* ADISENSE_CORE Sensor Read Command6 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD615 0x0000048D /* 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_CMD6n_COUNT 16 #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 */ @@ -985,6 +1391,11 @@ #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_CMD711_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD711 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD712_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD712 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD713_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD713 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD714_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD714 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD715_RESET 0x00000000 /* Reset Value for REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD715 */ #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 */ @@ -996,11 +1407,16 @@ #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_CMD711 0x0000038E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD712 0x000003CE /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD713 0x0000040E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD714 0x0000044E /* ADISENSE_CORE Sensor Read Command7 */ +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD715 0x0000048E /* 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 +#define REG_ADISENSE_CORE_DIGITAL_SENSOR_READ_CMD7n_COUNT 16 /* ============================================================================================================================ - ADISENSE_CORE Register BitMasks, Positions & Enumerations + ADISENSE_CORE Register BitMasks, Positions & Enumerations ============================================================================================================================ */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_COMMAND Pos/Masks Description @@ -1012,20 +1428,43 @@ #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_LOAD_CONFIG_NO_LONGER_USED 0x00000005 /* Special_Command: Now 4 New Commands. Load Registers with Configuration from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_CONFIG_NO_LONGER_USED 0x00000006 /* Special_Command: Now 4 New Commands. 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_LUT 0x00000009 /* Special_Command: Save LUT to FLASH */ #define ENUM_ADISENSE_CORE_COMMAND_SYSTEM_CHECK 0x0000000A /* Special_Command: Full Suite of Measurement Diagnostics */ +#define ENUM_ADISENSE_CORE_COMMAND_CONVERT_FFT 0x0000000B /* Special_Command: Perform FFTs on Selected Channel(s) */ +#define ENUM_ADISENSE_CORE_COMMAND_ERASE_EXTERNAL_FLASH 0x00000010 /* Special_Command: Erase Contents of External Flash */ +#define ENUM_ADISENSE_CORE_COMMAND_POWER_DOWN 0x00000014 /* Special_Command: Enter Low Power State */ +#define ENUM_ADISENSE_CORE_COMMAND_LOAD_CONFIG_1 0x00000018 /* Special_Command: Load Registers with Configuration#1 from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_CONFIG_1 0x00000019 /* Special_Command: Store Current Registers to FLASH Configuration#1 */ +#define ENUM_ADISENSE_CORE_COMMAND_LOAD_CONFIG_2 0x0000001A /* Special_Command: Load Registers with Configuration#2 from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_CONFIG_2 0x0000001B /* Special_Command: Store Current Registers to FLASH Configuration#2 */ +#define ENUM_ADISENSE_CORE_COMMAND_LOAD_CONFIG_3 0x0000001C /* Special_Command: Load Registers with Configuration#3 from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_CONFIG_3 0x0000001D /* Special_Command: Store Current Registers to FLASH Configuration#3 */ +#define ENUM_ADISENSE_CORE_COMMAND_LOAD_CONFIG_4 0x0000001E /* Special_Command: Load Registers with Configuration#4 from FLASH */ +#define ENUM_ADISENSE_CORE_COMMAND_SAVE_CONFIG_4 0x0000001F /* Special_Command: Store Current Registers to FLASH Configuration#4 */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_MODE Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_MODE_EXT_FLASH_STORE 7 /* Indicates If Measurement Data Should Be Stored in Flash */ +#define BITP_ADISENSE_CORE_MODE_FFT_MODE 5 /* Indicates Single or Multiple Sequence of FFTs */ +#define BITP_ADISENSE_CORE_MODE_CALIBRATION_METHOD 4 /* Indicates If Calibration is Required on 'Latch' Command */ #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_EXT_FLASH_STORE 0x00000080 /* Indicates If Measurement Data Should Be Stored in Flash */ +#define BITM_ADISENSE_CORE_MODE_FFT_MODE 0x00000020 /* Indicates Single or Multiple Sequence of FFTs */ +#define BITM_ADISENSE_CORE_MODE_CALIBRATION_METHOD 0x00000010 /* Indicates If Calibration is Required on 'Latch' Command */ #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_EXT_FLASH_NOT_USED 0x00000000 /* Ext_Flash_Store: Do Not Use External Flash */ +#define ENUM_ADISENSE_CORE_MODE_EXT_FLASH_USED 0x00000080 /* Ext_Flash_Store: Use External Flash */ +#define ENUM_ADISENSE_CORE_MODE_FFT_MODE_SINGLE 0x00000000 /* FFT_Mode: Perform Single Sequence of FFT(s) on Selected Channel(s) */ +#define ENUM_ADISENSE_CORE_MODE_FFT_MODE_CONTINUOUS 0x00000020 /* FFT_Mode: Perform Continuous Sequence of FFTs on Selected Channel(s) */ +#define ENUM_ADISENSE_CORE_MODE_NO_CAL 0x00000000 /* Calibration_Method: No Calibration Performed */ +#define ENUM_ADISENSE_CORE_MODE_DO_CAL 0x00000010 /* Calibration_Method: Calibration Performed */ #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 */ @@ -1037,8 +1476,10 @@ 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 */ @@ -1048,12 +1489,16 @@ 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_TYPE 12 /* Type of Measurement Cycle */ #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_TYPE 0x00001000 /* Type of Measurement Cycle */ #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_CYCLE_TYPE_SWITCH 0x00000000 /* Cycle_Type: Switch Channels After Every Conversion */ +#define ENUM_ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TYPE_FULL 0x00001000 /* Cycle_Type: Perform Full Number Of Conversions On A Channel Consecutively */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_FIFO_NUM_CYCLES Pos/Masks Description @@ -1108,6 +1553,9 @@ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_CHANNEL_ALERT_STATUS Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH15 15 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH14 14 /* Indicates Channel Alert is Active */ +#define BITP_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH13 13 /* Indicates Channel Alert is Active */ #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 */ @@ -1121,6 +1569,9 @@ #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_CH15 0x00008000 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH14 0x00004000 /* Indicates Channel Alert is Active */ +#define BITM_ADISENSE_CORE_CHANNEL_ALERT_STATUS_ALERT_CH13 0x00002000 /* 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 */ @@ -1154,6 +1605,7 @@ #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_CALIBRATION_INVALID 7 /* Indicates Problem During Calibration of 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 */ @@ -1169,6 +1621,7 @@ #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_CALIBRATION_INVALID 0x00000080 /* Indicates Problem During Calibration of 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 */ @@ -1218,20 +1671,41 @@ /* ------------------------------------------------------------------------------------------------------------------------- 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 */ +#define BITP_ADISENSE_CORE_DATA_FIFO_DATA_FIFO 0 /* Fifo Buffer of Sensor Results */ +#define BITM_ADISENSE_CORE_DATA_FIFO_DATA_FIFO 0x000000FF /* Fifo Buffer of Sensor Results */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_FFT_CONFIG Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_FFT_CONFIG_FFT_NUM_CHANNELS 6 /* Indicates Number of Channels for FFT */ +#define BITP_ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT 4 /* Indicates FFT Output Format */ +#define BITP_ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW 2 /* Indicates Window Type for FFT */ +#define BITP_ADISENSE_CORE_FFT_CONFIG_FFT_NUM_BINS 0 /* Indicates Number of Bins in FFT */ +#define BITM_ADISENSE_CORE_FFT_CONFIG_FFT_NUM_CHANNELS 0x000000C0 /* Indicates Number of Channels for FFT */ +#define BITM_ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT 0x00000030 /* Indicates FFT Output Format */ +#define BITM_ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW 0x0000000C /* Indicates Window Type for FFT */ +#define BITM_ADISENSE_CORE_FFT_CONFIG_FFT_NUM_BINS 0x00000003 /* Indicates Number of Bins in FFT */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_1 0x00000000 /* FFT_Num_Channels: One FFT Channel */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_2 0x00000040 /* FFT_Num_Channels: Two FFT Channels */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_3 0x00000080 /* FFT_Num_Channels: Three FFT Channels */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_4 0x000000C0 /* FFT_Num_Channels: Four FFT Channels */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL 0x00000000 /* FFT_Output: N/2-Term Amplitude Response */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_MAX16 0x00000010 /* FFT_Output: Bin-Number and Amplitude of 16 Highest Peaks of Amplitude Response */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL_WITH_RAW 0x00000020 /* FFT_Output: N/2-Term Amplitude Response Plus N Raw ADC Samples */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_NONE 0x00000000 /* FFT_Window: No Window */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_HANN 0x00000004 /* FFT_Window: Hann Window */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_BLACKMANN_HARRIS 0x00000008 /* FFT_Window: Blackman-Harris-Nuttall Window */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_TBD 0x0000000C /* FFT_Window: Reserved */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_BINS_256 0x00000000 /* FFT_Num_Bins: FFT Size 256 */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_BINS_512 0x00000001 /* FFT_Num_Bins: FFT Size 512 */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_BINS_1024 0x00000002 /* FFT_Num_Bins: FFT Size 1024 */ +#define ENUM_ADISENSE_CORE_FFT_CONFIG_FFT_BINS_2048 0x00000003 /* FFT_Num_Bins: FFT Size 2048 */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_ADVANCED_SENSOR_ACCESS Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_ADVANCED_SENSOR_ACCESS_ADVANCED_SENSOR_ACCESS 0 /* Write Specific Key Value to Access Advanced Sensors */ +#define BITM_ADISENSE_CORE_ADVANCED_SENSOR_ACCESS_ADVANCED_SENSOR_ACCESS 0x0000FFFF /* Write Specific Key Value to Access Advanced Sensors */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_LUT_SELECT Pos/Masks Description @@ -1254,6 +1728,24 @@ #define BITM_ADISENSE_CORE_LUT_DATA_LUT_DATA 0x000000FF /* Data Byte to Write to / Read from Look-Up-Table */ /* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_EXT_FLASH_INDEX Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_EXT_FLASH_INDEX_EXT_FLASH_INDEX 0 /* Start Position (Sample No.) for Retrieval of Ext. Flash Data */ +#define BITM_ADISENSE_CORE_EXT_FLASH_INDEX_EXT_FLASH_INDEX 0xFFFFFFFF /* Start Position (Sample No.) for Retrieval of Ext. Flash Data */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_EXT_FLASH_SAMPLE_COUNT Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_EXT_FLASH_SAMPLE_COUNT_EXT_FLASH_SAMPLE_COUNT 0 /* Indicates How Many Samples Stored in External Flash */ +#define BITM_ADISENSE_CORE_EXT_FLASH_SAMPLE_COUNT_EXT_FLASH_SAMPLE_COUNT 0xFFFFFFFF /* Indicates How Many Samples Stored in External Flash */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_EXT_FLASH_DATA Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_EXT_FLASH_DATA_EXT_FLASH_DATA 0 /* Data Read Back from External Flash */ +#define BITM_ADISENSE_CORE_EXT_FLASH_DATA_EXT_FLASH_DATA 0x000000FF /* Data Read Back from External Flash */ + +/* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_REVISION Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ #define BITP_ADISENSE_CORE_REVISION_COMMS_PROTOCOL 16 /* ID Info */ @@ -1272,6 +1764,16 @@ #define BITM_ADISENSE_CORE_CHANNEL_COUNT_CHANNEL_COUNT 0x0000007F /* How Many Times Channel Should Appear in One Cycle */ /* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CHANNEL_OPTIONS[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CHANNEL_OPTIONS_FFT_ENABLE_CH 7 /* Indicates Channel to Be Used for FFT */ +#define BITP_ADISENSE_CORE_CHANNEL_OPTIONS_CHANNEL_PRIORITY 0 /* Indicates Priority or Position of This Channel in Sequence */ +#define BITM_ADISENSE_CORE_CHANNEL_OPTIONS_FFT_ENABLE_CH 0x00000080 /* Indicates Channel to Be Used for FFT */ +#define BITM_ADISENSE_CORE_CHANNEL_OPTIONS_CHANNEL_PRIORITY 0x0000000F /* Indicates Priority or Position of This Channel in Sequence */ +#define ENUM_ADISENSE_CORE_CHANNEL_OPTIONS_NO_FFT 0x00000000 /* FFT_Enable_Ch: FFT Will not be Performed on This Channel */ +#define ENUM_ADISENSE_CORE_CHANNEL_OPTIONS_DO_FFT 0x00000080 /* FFT_Enable_Ch: FFT Will be Performed on This Channel */ + +/* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_SENSOR_TYPE[n] Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ #define BITP_ADISENSE_CORE_SENSOR_TYPE_SENSOR_TYPE 0 /* Sensor Type */ @@ -1308,7 +1810,6 @@ #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 */ @@ -1354,35 +1855,60 @@ #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_SENSOR_DIODE_2C_TYPEA_DEF_L1 0x000000E0 /* Sensor_Type: Diode 2 Current Type A Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_TYPEA_DEF_L1 0x000000E1 /* Sensor_Type: Diode 3 Current Type A Sensor Defined Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_2C_1_DEF_L2 0x000000EE /* Sensor_Type: Diode 2 Current Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_1_DEF_L2 0x000000EF /* Sensor_Type: Diode 3 Current Sensor 1 Defined Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_2C_TYPEA_ADV_L1 0x000000F0 /* Sensor_Type: Diode 2 Current Type A Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_TYPEA_ADV_L1 0x000000F1 /* Sensor_Type: Diode 3 Current Type A Sensor Advanced Level 1 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_2C_1_ADV_L2 0x000000FE /* Sensor_Type: Diode 2 Current Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_1_ADV_L2 0x000000FF /* Sensor_Type: Diode 3 Current Sensor 1 Advanced Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_MICROPHONE_A_DEF_L1 0x00000100 /* Sensor_Type: Microphone With No External Amplifier */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_MICROPHONE_B_DEF_L1 0x00000101 /* Sensor_Type: Microphone With External Amplifier */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE 0x00000200 /* Sensor_Type: Voltage Input */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY 0x00000210 /* Sensor_Type: Voltage Output Pressure Sensor A */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X 0x00000211 /* Sensor_Type: Voltage Output Pressure Sensor B */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_1_DEF_L2 0x00000218 /* Sensor_Type: Voltage Output Pressure Sensor 1 Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_2_DEF_L2 0x00000219 /* Sensor_Type: Voltage Output Pressure Sensor 2 Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT 0x00000300 /* Sensor_Type: Current Input */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2 0x00000310 /* Sensor_Type: Current Output Pressure Sensor A */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_1_DEF_L2 0x00000318 /* Sensor_Type: Current Output Pressure Sensor 1 Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_2_DEF_L2 0x00000319 /* Sensor_Type: Current Output Pressure Sensor 2 Level 2 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_CUSTOM1 0x00000400 /* 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_I2C_AMBIENTLIGHT_1 0x00000880 /* Sensor_Type: I2C Ambient Light Sensor 1 */ #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_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 */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_UART_CO2_A 0x00000E00 /* Sensor_Type: UART CO2 Sensor A */ +#define ENUM_ADISENSE_CORE_SENSOR_TYPE_SENSOR_UART_CO2_B 0x00000E01 /* Sensor_Type: UART CO2 Sensor B */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_SENSOR_DETAILS[n] Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SENSOR_DETAILS_COMPENSATION_DISABLE 31 /* Indicates Compensation Data Should Not Be Used */ +#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_UNITY_LUT_SELECT 16 /* Selects Unity Transfer Function Instead of Sensor Default */ #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_COMPENSATION_DISABLE 0x80000000 /* Indicates Compensation Data Should Not Be Used */ +#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_UNITY_LUT_SELECT 0x00010000 /* Selects Unity Transfer Function Instead of Sensor Default */ #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 */ @@ -1408,8 +1934,14 @@ /* ------------------------------------------------------------------------------------------------------------------------- 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_DIODE_RATIO 5 /* Modify Current Ratios Used for Diode Sensor */ #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_DIODE_RATIO 0x00000020 /* Modify Current Ratios Used for Diode Sensor */ #define BITM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_EXCITATION_CURRENT 0x00000007 /* Current Source Value */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_DIODE_DEFAULT 0x00000000 /* IOUT_Diode_Ratio: Default Excitation Current Ratios */ +#define ENUM_ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_DIODE_MAX 0x00000020 /* IOUT_Diode_Ratio: Higher Excitation Current Ratios */ #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 */ @@ -1421,8 +1953,13 @@ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_SETTLING_TIME[n] Pos/Masks Description ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SETTLING_TIME_SETTLING_TIME_UNITS 14 /* Units for Settling Time */ #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 */ +#define BITM_ADISENSE_CORE_SETTLING_TIME_SETTLING_TIME_UNITS 0x0000C000 /* Units for Settling Time */ +#define BITM_ADISENSE_CORE_SETTLING_TIME_SETTLING_TIME 0x00003FFF /* Settling Time to Allow When Switching to Channel */ +#define ENUM_ADISENSE_CORE_SETTLING_TIME_MICROSECONDS 0x00000000 /* Settling_Time_Units: Micro-Seconds */ +#define ENUM_ADISENSE_CORE_SETTLING_TIME_MILLISECONDS 0x00004000 /* Settling_Time_Units: Milli-Seconds */ +#define ENUM_ADISENSE_CORE_SETTLING_TIME_SECONDS 0x00008000 /* Settling_Time_Units: Seconds */ /* ------------------------------------------------------------------------------------------------------------------------- ADISENSE_CORE_FILTER_SELECT[n] Pos/Masks Description @@ -1467,6 +2004,18 @@ #define BITM_ADISENSE_CORE_ALERT_CODE_CH_ALERT_CODE_CH 0x0000FFFF /* Per-Channel Code Indicating Type of Alert */ /* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_CHANNEL_SKIP[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_CHANNEL_SKIP_CHANNEL_SKIP 0 /* Indicates If Channel Will Skip Some Measurement Cycles */ +#define BITM_ADISENSE_CORE_CHANNEL_SKIP_CHANNEL_SKIP 0x000000FF /* Indicates If Channel Will Skip Some Measurement Cycles */ + +/* ------------------------------------------------------------------------------------------------------------------------- + ADISENSE_CORE_SENSOR_PARAMETER[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_SENSOR_PARAMETER_SENSOR_PARAMETER 0 /* Sensor Parameter Adjustment */ +#define BITM_ADISENSE_CORE_SENSOR_PARAMETER_SENSOR_PARAMETER 0xFFFFFFFF /* Sensor Parameter Adjustment */ + +/* ------------------------------------------------------------------------------------------------------------------------- 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 */ @@ -1501,6 +2050,14 @@ #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_COMMS[n] Pos/Masks Description + ------------------------------------------------------------------------------------------------------------------------- */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMS_DIGITAL_SENSOR_COMMS_CONFIG 4 /* Controls SPI or UART Communications */ +#define BITP_ADISENSE_CORE_DIGITAL_SENSOR_COMMS_DIGITAL_SENSOR_CLOCK 0 /* Controls SPI or UART Communications Frequency */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMS_DIGITAL_SENSOR_COMMS_CONFIG 0x00000FF0 /* Controls SPI or UART Communications */ +#define BITM_ADISENSE_CORE_DIGITAL_SENSOR_COMMS_DIGITAL_SENSOR_CLOCK 0x0000000F /* Controls SPI or UART Communications Frequency */ + +/* ------------------------------------------------------------------------------------------------------------------------- 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 */ @@ -1586,4 +2143,3 @@ #endif /* end ifndef _DEF_ADISENSE1000_REGISTERS_H */ -
--- a/src/adi_sense_1000/ADISENSE1000_REGISTERS_typedefs.h Mon Mar 26 14:50:05 2018 +0000 +++ b/src/adi_sense_1000/ADISENSE1000_REGISTERS_typedefs.h Mon Mar 26 20:28:05 2018 +0100 @@ -4,7 +4,7 @@ File : ADISENSE1000_REGISTERS_typedefs.h Description : C Register Structures - Date : Feb 27, 2018 + Date : Mar 16, 2018 Copyright (c) 2018 Analog Devices, Inc. All Rights Reserved. This software is proprietary and confidential to Analog Devices, Inc. and @@ -447,17 +447,28 @@ * ========================================================================= */ 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_LUT = 9, /**< Save LUT to FLASH */ - ADISENSE_CORE_COMMAND_SYSTEM_CHECK = 10 /**< Full Suite of Measurement Diagnostics */ + 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_NO_LONGER_USED = 5, /**< Now 4 New Commands. Load Registers with Configuration from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_CONFIG_NO_LONGER_USED = 6, /**< Now 4 New Commands. 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_LUT = 9, /**< Save LUT to FLASH */ + ADISENSE_CORE_COMMAND_SYSTEM_CHECK = 10, /**< Full Suite of Measurement Diagnostics */ + ADISENSE_CORE_COMMAND_CONVERT_FFT = 11, /**< Perform FFTs on Selected Channel(s) */ + ADISENSE_CORE_COMMAND_ERASE_EXTERNAL_FLASH = 16, /**< Erase Contents of External Flash */ + ADISENSE_CORE_COMMAND_POWER_DOWN = 20, /**< Enter Low Power State */ + ADISENSE_CORE_COMMAND_LOAD_CONFIG_1 = 24, /**< Load Registers with Configuration#1 from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_CONFIG_1 = 25, /**< Store Current Registers to FLASH Configuration#1 */ + ADISENSE_CORE_COMMAND_LOAD_CONFIG_2 = 26, /**< Load Registers with Configuration#2 from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_CONFIG_2 = 27, /**< Store Current Registers to FLASH Configuration#2 */ + ADISENSE_CORE_COMMAND_LOAD_CONFIG_3 = 28, /**< Load Registers with Configuration#3 from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_CONFIG_3 = 29, /**< Store Current Registers to FLASH Configuration#3 */ + ADISENSE_CORE_COMMAND_LOAD_CONFIG_4 = 30, /**< Load Registers with Configuration#4 from FLASH */ + ADISENSE_CORE_COMMAND_SAVE_CONFIG_4 = 31 /**< Store Current Registers to FLASH Configuration#4 */ } ADI_ADISENSE_CORE_Command_Special_Command; @@ -505,6 +516,39 @@ } ADI_ADISENSE_CORE_Mode_Drdy_Mode; +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Mode_Calibration_Method + *! \brief Indicates If Calibration is Required on 'Latch' Command (Calibration_Method) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_MODE_NO_CAL = 0, /**< No Calibration Performed */ + ADISENSE_CORE_MODE_DO_CAL = 1 /**< Calibration Performed */ +} ADI_ADISENSE_CORE_Mode_Calibration_Method; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Mode_FFT_Mode + *! \brief Indicates Single or Multiple Sequence of FFTs (FFT_Mode) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_MODE_FFT_MODE_SINGLE = 0, /**< Perform Single Sequence of FFT(s) on Selected Channel(s) */ + ADISENSE_CORE_MODE_FFT_MODE_CONTINUOUS = 1 /**< Perform Continuous Sequence of FFTs on Selected Channel(s) */ +} ADI_ADISENSE_CORE_Mode_FFT_Mode; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Mode_Ext_Flash_Store + *! \brief Indicates If Measurement Data Should Be Stored in Flash (Ext_Flash_Store) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_MODE_EXT_FLASH_NOT_USED = 0, /**< Do Not Use External Flash */ + ADISENSE_CORE_MODE_EXT_FLASH_USED = 1 /**< Use External Flash */ +} ADI_ADISENSE_CORE_Mode_Ext_Flash_Store; + + /* ========================================================================== *! \struct ADI_ADISENSE_CORE_Mode_Struct *! \brief Operating Mode and DRDY Control Register bit field structure @@ -514,7 +558,10 @@ 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 Calibration_Method : 1; /**< Indicates If Calibration is Required on 'Latch' Command */ + uint8_t FFT_Mode : 1; /**< Indicates Single or Multiple Sequence of FFTs */ + uint8_t reserved6 : 1; + uint8_t Ext_Flash_Store : 1; /**< Indicates If Measurement Data Should Be Stored in Flash */ }; uint8_t VALUE8; }; @@ -547,7 +594,7 @@ union { struct { uint8_t Power_Mode_ADC : 2; /**< ADC Power Mode */ - uint8_t reserved2 : 2; + uint8_t Power_Mode_MCU : 2; /**< MCU Power Mode */ uint8_t Stdby_En : 1; /**< Standby */ uint8_t reserved5 : 3; }; @@ -563,6 +610,17 @@ */ /* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Cycle_Control_Cycle_Type + *! \brief Type of Measurement Cycle (Cycle_Type) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TYPE_SWITCH = 0, /**< Switch Channels After Every Conversion */ + ADISENSE_CORE_CYCLE_CONTROL_CYCLE_TYPE_FULL = 1 /**< Perform Full Number Of Conversions On A Channel Consecutively */ +} ADI_ADISENSE_CORE_Cycle_Control_Cycle_Type; + + +/* ========================================================================= *! \enum ADI_ADISENSE_CORE_Cycle_Control_Cycle_Time_Units *! \brief Units for Cycle Time (Cycle_Time_Units) Enumerations * ========================================================================= */ @@ -582,7 +640,8 @@ union { struct { uint16_t Cycle_Time : 12; /**< Duration of a Full Measurement Cycle */ - uint16_t reserved12 : 2; + uint16_t Cycle_Type : 1; /**< Type of Measurement Cycle */ + uint16_t reserved13 : 1; uint16_t Cycle_Time_Units : 2; /**< Units for Cycle Time */ }; uint16_t VALUE16; @@ -714,7 +773,9 @@ 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 Alert_Ch13 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch14 : 1; /**< Indicates Channel Alert is Active */ + uint16_t Alert_Ch15 : 1; /**< Indicates Channel Alert is Active */ }; uint16_t VALUE16; }; @@ -764,11 +825,11 @@ 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 Calibration_Invalid : 1; /**< Indicates Problem During Calibration of Channel */ + 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 */ @@ -896,32 +957,121 @@ /*@}*/ -/** @defgroup Data_FIFO FIFO of Sensor Results (Data_FIFO) Register - * FIFO of Sensor Results (Data_FIFO) Register. +/** @defgroup Data_FIFO FIFO Buffer of Sensor Results (Data_FIFO) Register + * FIFO Buffer of Sensor Results (Data_FIFO) Register. * @{ */ /* ========================================================================== *! \struct ADI_ADISENSE_CORE_Data_FIFO_Struct - *! \brief FIFO of Sensor Results Register bit field structure + *! \brief FIFO Buffer 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 */ + uint8_t Data_Fifo : 8; /**< Fifo Buffer of Sensor Results */ }; - uint64_t VALUE64; + uint8_t VALUE8; }; } ADI_ADISENSE_CORE_Data_FIFO_t; /*@}*/ +/** @defgroup FFT_Config FFT Configuration (FFT_Config) Register + * FFT Configuration (FFT_Config) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_FFT_Config_FFT_Num_Bins + *! \brief Indicates Number of Bins in FFT (FFT_Num_Bins) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_FFT_CONFIG_FFT_BINS_256 = 0, /**< FFT Size 256 */ + ADISENSE_CORE_FFT_CONFIG_FFT_BINS_512 = 1, /**< FFT Size 512 */ + ADISENSE_CORE_FFT_CONFIG_FFT_BINS_1024 = 2, /**< FFT Size 1024 */ + ADISENSE_CORE_FFT_CONFIG_FFT_BINS_2048 = 3 /**< FFT Size 2048 */ +} ADI_ADISENSE_CORE_FFT_Config_FFT_Num_Bins; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_FFT_Config_FFT_Window + *! \brief Indicates Window Type for FFT (FFT_Window) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_NONE = 0, /**< No Window */ + ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_HANN = 1, /**< Hann Window */ + ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_BLACKMANN_HARRIS = 2, /**< Blackman-Harris-Nuttall Window */ + ADISENSE_CORE_FFT_CONFIG_FFT_WINDOW_TBD = 3 /**< Reserved */ +} ADI_ADISENSE_CORE_FFT_Config_FFT_Window; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_FFT_Config_FFT_Output + *! \brief Indicates FFT Output Format (FFT_Output) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL = 0, /**< N/2-Term Amplitude Response */ + ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_MAX16 = 1, /**< Bin-Number and Amplitude of 16 Highest Peaks of Amplitude Response */ + ADISENSE_CORE_FFT_CONFIG_FFT_OUTPUT_FULL_WITH_RAW = 2 /**< N/2-Term Amplitude Response Plus N Raw ADC Samples */ +} ADI_ADISENSE_CORE_FFT_Config_FFT_Output; + + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_FFT_Config_FFT_Num_Channels + *! \brief Indicates Number of Channels for FFT (FFT_Num_Channels) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_1 = 0, /**< One FFT Channel */ + ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_2 = 1, /**< Two FFT Channels */ + ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_3 = 2, /**< Three FFT Channels */ + ADISENSE_CORE_FFT_CONFIG_FFT_CHANS_4 = 3 /**< Four FFT Channels */ +} ADI_ADISENSE_CORE_FFT_Config_FFT_Num_Channels; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_FFT_Config_Struct + *! \brief FFT Configuration Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_FFT_Config_t { + union { + struct { + uint32_t FFT_Num_Bins : 2; /**< Indicates Number of Bins in FFT */ + uint32_t FFT_Window : 2; /**< Indicates Window Type for FFT */ + uint32_t FFT_Output : 2; /**< Indicates FFT Output Format */ + uint32_t FFT_Num_Channels : 2; /**< Indicates Number of Channels for FFT */ + uint32_t reserved8 : 24; + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_FFT_Config_t; + +/*@}*/ + +/** @defgroup Advanced_Sensor_Access Enables Access to Advanced Sensor Configuration (Advanced_Sensor_Access) Register + * Enables Access to Advanced Sensor Configuration (Advanced_Sensor_Access) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Advanced_Sensor_Access_Struct + *! \brief Enables Access to Advanced Sensor Configuration Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Advanced_Sensor_Access_t { + union { + struct { + uint16_t Advanced_Sensor_Access : 16; /**< Write Specific Key Value to Access Advanced Sensors */ + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Advanced_Sensor_Access_t; + +/*@}*/ + /** @defgroup LUT_Select Read/Write Strobe (LUT_Select) Register * Read/Write Strobe (LUT_Select) Register. * @{ @@ -995,6 +1145,67 @@ /*@}*/ +/** @defgroup Ext_Flash_Index Start Position (Sample No.) for Retrieval of Ext. Flash Data (Ext_Flash_Index) Register + * Start Position (Sample No.) for Retrieval of Ext. Flash Data (Ext_Flash_Index) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Ext_Flash_Index_Struct + *! \brief Start Position (Sample No.) for Retrieval of Ext. Flash Data Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Ext_Flash_Index_t { + union { + struct { + uint32_t Ext_Flash_Index : 32; /**< Start Position (Sample No.) for Retrieval of Ext. Flash Data */ + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Ext_Flash_Index_t; + +/*@}*/ + +/** @defgroup Ext_Flash_Sample_Count Indicates How Many Samples Stored in External Flash (Ext_Flash_Sample_Count) Register + * Indicates How Many Samples Stored in External Flash (Ext_Flash_Sample_Count) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Ext_Flash_Sample_Count_Struct + *! \brief Indicates How Many Samples Stored in External Flash Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Ext_Flash_Sample_Count_t { + union { + struct { + uint32_t Ext_Flash_Sample_Count : 32; /**< Indicates How Many Samples Stored in External Flash */ + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Ext_Flash_Sample_Count_t; + +/*@}*/ + +/** @defgroup Ext_Flash_Data Data Read Back from External Flash (Ext_Flash_Data) Register + * Data Read Back from External Flash (Ext_Flash_Data) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Ext_Flash_Data_Struct + *! \brief Data Read Back from External Flash Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Ext_Flash_Data_t { + union { + struct { + uint32_t Ext_Flash_Data : 8; /**< Data Read Back from External Flash */ + uint32_t reserved8 : 24; + }; + uint32_t VALUE32; + }; +} ADI_ADISENSE_CORE_Ext_Flash_Data_t; + +/*@}*/ + /** @defgroup Revision Hardware, Firmware Revision (Revision) Register * Hardware, Firmware Revision (Revision) Register. * @{ @@ -1039,6 +1250,39 @@ /*@}*/ +/** @defgroup Channel_Options Position of Channel Within Sequence and Enable for FFT (Channel_Options) Register + * Position of Channel Within Sequence and Enable for FFT (Channel_Options) Register. + * @{ + */ + +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Channel_Options_FFT_Enable_Ch + *! \brief Indicates Channel to Be Used for FFT (FFT_Enable_Ch) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_CHANNEL_OPTIONS_NO_FFT = 0, /**< FFT Will not be Performed on This Channel */ + ADISENSE_CORE_CHANNEL_OPTIONS_DO_FFT = 1 /**< FFT Will be Performed on This Channel */ +} ADI_ADISENSE_CORE_Channel_Options_FFT_Enable_Ch; + + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Channel_Options_Struct + *! \brief Position of Channel Within Sequence and Enable for FFT Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Channel_Options_t { + union { + struct { + uint8_t Channel_Priority : 4; /**< Indicates Priority or Position of This Channel in Sequence */ + uint8_t reserved4 : 3; + uint8_t FFT_Enable_Ch : 1; /**< Indicates Channel to Be Used for FFT */ + }; + uint8_t VALUE8; + }; +} ADI_ADISENSE_CORE_Channel_Options_t; + +/*@}*/ + /** @defgroup Sensor_Type Sensor Select (Sensor_Type) Register * Sensor Select (Sensor_Type) Register. * @{ @@ -1082,7 +1326,6 @@ 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 */ @@ -1128,19 +1371,38 @@ 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_SENSOR_DIODE_2C_TYPEA_DEF_L1 = 224, /**< Diode 2 Current Type A Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_TYPEA_DEF_L1 = 225, /**< Diode 3 Current Type A Sensor Defined Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_2C_1_DEF_L2 = 238, /**< Diode 2 Current Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_1_DEF_L2 = 239, /**< Diode 3 Current Sensor 1 Defined Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_2C_TYPEA_ADV_L1 = 240, /**< Diode 2 Current Type A Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_TYPEA_ADV_L1 = 241, /**< Diode 3 Current Type A Sensor Advanced Level 1 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_2C_1_ADV_L2 = 254, /**< Diode 2 Current Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_DIODE_3C_1_ADV_L2 = 255, /**< Diode 3 Current Sensor 1 Advanced Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_MICROPHONE_A_DEF_L1 = 256, /**< Microphone With No External Amplifier */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_MICROPHONE_B_DEF_L1 = 257, /**< Microphone With External Amplifier */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE = 512, /**< Voltage Input */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_HONEYWELL_TRUSTABILITY = 528, /**< Voltage Output Pressure Sensor A */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_AMPHENOL_NPA300X = 529, /**< Voltage Output Pressure Sensor B */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_1_DEF_L2 = 536, /**< Voltage Output Pressure Sensor 1 Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_VOLTAGE_PRESSURE_2_DEF_L2 = 537, /**< Voltage Output Pressure Sensor 2 Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT = 768, /**< Current Input */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_HONEYWELL_PX2 = 784, /**< Current Output Pressure Sensor A */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_1_DEF_L2 = 792, /**< Current Output Pressure Sensor 1 Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CURRENT_PRESSURE_2_DEF_L2 = 793, /**< Current Output Pressure Sensor 2 Level 2 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_CUSTOM1 = 1024, /**< 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_I2C_AMBIENTLIGHT_1 = 2176, /**< I2C Ambient Light Sensor 1 */ ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_PRESSURE_HONEYWELL_TRUSTABILITY = 3072, /**< SPI Pressure Sensor 1 */ ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_HUMIDITY_1 = 3136, /**< SPI Humidity Sensor Type 1 */ - ADISENSE_CORE_SENSOR_TYPE_SENSOR_SPI_ACCELEROMETER_1 = 3200 /**< SPI Accelerometer Sensor Type 1 3-Axis */ + 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 */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_UART_CO2_A = 3584, /**< UART CO2 Sensor A */ + ADISENSE_CORE_SENSOR_TYPE_SENSOR_UART_CO2_B = 3585 /**< UART CO2 Sensor B */ } ADI_ADISENSE_CORE_Sensor_Type_Sensor_Type; @@ -1220,13 +1482,16 @@ 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 reserved8 : 9; + uint32_t reserved8 : 8; + uint32_t Unity_LUT_Select : 1; /**< Selects Unity Transfer Function Instead of Sensor Default */ 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 : 5; + uint32_t reserved27 : 1; + uint32_t Averaging : 3; /**< Number of ADC Results to Average */ + uint32_t Compensation_Disable : 1; /**< Indicates Compensation Data Should Not Be Used */ }; uint32_t VALUE32; }; @@ -1255,6 +1520,17 @@ } ADI_ADISENSE_CORE_Channel_Excitation_IOUT_Excitation_Current; +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Channel_Excitation_IOUT_Diode_Ratio + *! \brief Modify Current Ratios Used for Diode Sensor (IOUT_Diode_Ratio) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_DIODE_DEFAULT = 0, /**< Default Excitation Current Ratios */ + ADISENSE_CORE_CHANNEL_EXCITATION_IOUT_DIODE_MAX = 1 /**< Higher Excitation Current Ratios */ +} ADI_ADISENSE_CORE_Channel_Excitation_IOUT_Diode_Ratio; + + /* ========================================================================== *! \struct ADI_ADISENSE_CORE_Channel_Excitation_Struct *! \brief Excitation Current Register bit field structure @@ -1263,7 +1539,10 @@ union { struct { uint8_t IOUT_Excitation_Current : 3; /**< Current Source Value */ - uint8_t reserved3 : 5; + uint8_t reserved3 : 2; + uint8_t IOUT_Diode_Ratio : 1; /**< Modify Current Ratios Used for Diode Sensor */ + uint8_t reserved6 : 1; + uint8_t IOUT_Dont_Swap_3Wire : 1; /**< Indicates 3-Wire Excitation Currents Should Not Be Swapped */ }; uint8_t VALUE8; }; @@ -1276,6 +1555,18 @@ * @{ */ +/* ========================================================================= + *! \enum ADI_ADISENSE_CORE_Settling_Time_Settling_Time_Units + *! \brief Units for Settling Time (Settling_Time_Units) Enumerations + * ========================================================================= */ +typedef enum +{ + ADISENSE_CORE_SETTLING_TIME_MICROSECONDS = 0, /**< Micro-Seconds */ + ADISENSE_CORE_SETTLING_TIME_MILLISECONDS = 1, /**< Milli-Seconds */ + ADISENSE_CORE_SETTLING_TIME_SECONDS = 2 /**< Seconds */ +} ADI_ADISENSE_CORE_Settling_Time_Settling_Time_Units; + + /* ========================================================================== *! \struct ADI_ADISENSE_CORE_Settling_Time_Struct *! \brief Settling Time Register bit field structure @@ -1283,7 +1574,8 @@ 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 Settling_Time : 14; /**< Settling Time to Allow When Switching to Channel */ + uint16_t Settling_Time_Units : 2; /**< Units for Settling Time */ }; uint16_t VALUE16; }; @@ -1426,6 +1718,47 @@ /*@}*/ +/** @defgroup Channel_Skip Indicates If Channel Will Skip Some Measurement Cycles (Channel_Skip) Register + * Indicates If Channel Will Skip Some Measurement Cycles (Channel_Skip) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Channel_Skip_Struct + *! \brief Indicates If Channel Will Skip Some Measurement Cycles Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Channel_Skip_t { + union { + struct { + uint16_t Channel_Skip : 8; /**< Indicates If Channel Will Skip Some Measurement Cycles */ + uint16_t reserved8 : 8; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Channel_Skip_t; + +/*@}*/ + +/** @defgroup Sensor_Parameter Sensor Parameter Adjustment (Sensor_Parameter) Register + * Sensor Parameter Adjustment (Sensor_Parameter) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Sensor_Parameter_Struct + *! \brief Sensor Parameter Adjustment Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Sensor_Parameter_t { + union { + struct { + float Sensor_Parameter; /**< Sensor Parameter Adjustment */ + }; + float VALUE32; + }; +} ADI_ADISENSE_CORE_Sensor_Parameter_t; + +/*@}*/ + /** @defgroup Digital_Sensor_Config Digital Sensor Data Coding (Digital_Sensor_Config) Register * Digital Sensor Data Coding (Digital_Sensor_Config) Register. * @{ @@ -1507,6 +1840,28 @@ /*@}*/ +/** @defgroup Digital_Sensor_Comms Digital Sensor Communication Clock Configuration (Digital_Sensor_Comms) Register + * Digital Sensor Communication Clock Configuration (Digital_Sensor_Comms) Register. + * @{ + */ + +/* ========================================================================== + *! \struct ADI_ADISENSE_CORE_Digital_Sensor_Comms_Struct + *! \brief Digital Sensor Communication Clock Configuration Register bit field structure + * ========================================================================== */ +typedef struct _ADI_ADISENSE_CORE_Digital_Sensor_Comms_t { + union { + struct { + uint16_t Digital_Sensor_Clock : 4; /**< Controls SPI or UART Communications Frequency */ + uint16_t Digital_Sensor_Comms_Config : 8; /**< Controls SPI or UART Communications */ + uint16_t reserved12 : 4; + }; + uint16_t VALUE16; + }; +} ADI_ADISENSE_CORE_Digital_Sensor_Comms_t; + +/*@}*/ + /** @defgroup Digital_Sensor_Command1 Sensor Configuration Command1 (Digital_Sensor_Command1) Register * Sensor Configuration Command1 (Digital_Sensor_Command1) Register. * @{ @@ -1790,7 +2145,6 @@ #if defined (__CC_ARM) #pragma pop -#endif +#endif #endif -
--- a/src/crc16.c Mon Mar 26 14:50:05 2018 +0000 +++ b/src/crc16.c Mon Mar 26 20:28:05 2018 +0100 @@ -73,4 +73,3 @@ crc = (crc<<8) ^ crc16tab[((crc>>8) ^ *(char *)pBuf++)&0x00FF]; return crc; } -
--- a/src/crc16.h Mon Mar 26 14:50:05 2018 +0000 +++ b/src/crc16.h Mon Mar 26 20:28:05 2018 +0100 @@ -31,4 +31,3 @@ unsigned short crc16_ccitt(const void *buf, int len); #endif /* _CRC16_H_ */ -
--- a/src/mbed/adi_sense_gpio.cpp Mon Mar 26 14:50:05 2018 +0000 +++ b/src/mbed/adi_sense_gpio.cpp Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_gpio.cpp - * @brief: ADISENSE OS-dependent wrapper layer for GPIO interface - *----------------------------------------------------------------------------- - */ - /****************************************************************************** Copyright 2017 (c) Analog Devices, Inc. @@ -41,6 +34,13 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: ADISENSE OS-dependent wrapper layer for GPIO interface + *----------------------------------------------------------------------------- + */ + #include <mbed.h> #include "inc/adi_sense_gpio.h" @@ -287,4 +287,3 @@ #ifdef __cplusplus } #endif -
--- a/src/mbed/adi_sense_log.cpp Mon Mar 26 14:50:05 2018 +0000 +++ b/src/mbed/adi_sense_log.cpp Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_log.cpp - * @brief: ADISENSE OS-dependent wrapper layer for log functions - *----------------------------------------------------------------------------- - */ - /****************************************************************************** Copyright 2017 (c) Analog Devices, Inc. @@ -41,6 +34,13 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: ADISENSE OS-dependent wrapper layer for log functions + *----------------------------------------------------------------------------- + */ + #include <mbed.h> #include "inc/adi_sense_log.h" @@ -109,4 +109,3 @@ #ifdef __cplusplus } #endif -
--- a/src/mbed/adi_sense_spi.cpp Mon Mar 26 14:50:05 2018 +0000 +++ b/src/mbed/adi_sense_spi.cpp Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_spi.cpp - * @brief: ADISENSE OS-dependent wrapper layer for SPI interface - *----------------------------------------------------------------------------- - */ - /****************************************************************************** Copyright 2017 (c) Analog Devices, Inc. @@ -41,6 +34,13 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: ADISENSE OS-dependent wrapper layer for SPI interface + *----------------------------------------------------------------------------- + */ + #include <mbed.h> #include "inc/adi_sense_spi.h" @@ -132,7 +132,7 @@ { _cs = 1; return rc; - } + } rc = _waitForCallback(); if ((rc < 0) || !bCsHold) @@ -207,4 +207,3 @@ /*! * @} */ -
--- a/src/mbed/adi_sense_time.cpp Mon Mar 26 14:50:05 2018 +0000 +++ b/src/mbed/adi_sense_time.cpp Mon Mar 26 20:28:05 2018 +0100 @@ -1,10 +1,3 @@ -/*! - ****************************************************************************** - * @file: adi_sense_time.cpp - * @brief: ADISENSE OS-dependent wrapper layer for time functions - *----------------------------------------------------------------------------- - */ - /****************************************************************************** Copyright 2017 (c) Analog Devices, Inc. @@ -41,6 +34,13 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: ADISENSE OS-dependent wrapper layer for time functions + *----------------------------------------------------------------------------- + */ + #include <mbed.h> #include "inc/adi_sense_time.h" @@ -61,4 +61,3 @@ #ifdef __cplusplus } #endif -
--- a/voltage_honeywellPressure_config.c Mon Mar 26 14:50:05 2018 +0000 +++ b/voltage_honeywellPressure_config.c Mon Mar 26 20:28:05 2018 +0100 @@ -1,9 +1,4 @@ -/*! - ****************************************************************************** - * @file: voltage_honeywellPressure_config.cpp - * @brief: - *----------------------------------------------------------------------------- - * +/* Copyright 2017 (c) Analog Devices, Inc. All rights reserved. @@ -39,6 +34,12 @@ * *****************************************************************************/ +/*! + ****************************************************************************** + * @file: + * @brief: + *----------------------------------------------------------------------------- + */ #include "inc/adi_sense_config_types.h" ADI_SENSE_CONFIG voltage_honeywellPressure_config = { @@ -111,4 +112,3 @@ }, }, }; -