(Working) Code to interface 3 LoadCells to ADISense1000 and display values using the Labview code.

Fork of 4Bridge_ADISense1000_Example_copy by CAC_smartcushion

Committer:
seanwilson10
Date:
Thu Jan 25 16:00:23 2018 +0000
Revision:
0:76fed7dd9235
initial;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
seanwilson10 0:76fed7dd9235 1 /*!
seanwilson10 0:76fed7dd9235 2 ******************************************************************************
seanwilson10 0:76fed7dd9235 3 * @file: adi_sense_api.h
seanwilson10 0:76fed7dd9235 4 * @brief: ADI Sense Host Library Application Programming Interface (API)
seanwilson10 0:76fed7dd9235 5 *-----------------------------------------------------------------------------
seanwilson10 0:76fed7dd9235 6 */
seanwilson10 0:76fed7dd9235 7
seanwilson10 0:76fed7dd9235 8 /*
seanwilson10 0:76fed7dd9235 9 Copyright 2017 (c) Analog Devices, Inc.
seanwilson10 0:76fed7dd9235 10
seanwilson10 0:76fed7dd9235 11 All rights reserved.
seanwilson10 0:76fed7dd9235 12
seanwilson10 0:76fed7dd9235 13 Redistribution and use in source and binary forms, with or without
seanwilson10 0:76fed7dd9235 14 modification, are permitted provided that the following conditions are met:
seanwilson10 0:76fed7dd9235 15 - Redistributions of source code must retain the above copyright
seanwilson10 0:76fed7dd9235 16 notice, this list of conditions and the following disclaimer.
seanwilson10 0:76fed7dd9235 17 - Redistributions in binary form must reproduce the above copyright
seanwilson10 0:76fed7dd9235 18 notice, this list of conditions and the following disclaimer in
seanwilson10 0:76fed7dd9235 19 the documentation and/or other materials provided with the
seanwilson10 0:76fed7dd9235 20 distribution.
seanwilson10 0:76fed7dd9235 21 - Neither the name of Analog Devices, Inc. nor the names of its
seanwilson10 0:76fed7dd9235 22 contributors may be used to endorse or promote products derived
seanwilson10 0:76fed7dd9235 23 from this software without specific prior written permission.
seanwilson10 0:76fed7dd9235 24 - The use of this software may or may not infringe the patent rights
seanwilson10 0:76fed7dd9235 25 of one or more patent holders. This license does not release you
seanwilson10 0:76fed7dd9235 26 from the requirement that you obtain separate licenses from these
seanwilson10 0:76fed7dd9235 27 patent holders to use this software.
seanwilson10 0:76fed7dd9235 28 - Use of the software either in source or binary form, must be run
seanwilson10 0:76fed7dd9235 29 on or directly connected to an Analog Devices Inc. component.
seanwilson10 0:76fed7dd9235 30
seanwilson10 0:76fed7dd9235 31 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
seanwilson10 0:76fed7dd9235 32 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
seanwilson10 0:76fed7dd9235 33 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
seanwilson10 0:76fed7dd9235 34 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
seanwilson10 0:76fed7dd9235 35 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
seanwilson10 0:76fed7dd9235 36 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
seanwilson10 0:76fed7dd9235 37 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
seanwilson10 0:76fed7dd9235 38 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
seanwilson10 0:76fed7dd9235 39 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
seanwilson10 0:76fed7dd9235 40 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
seanwilson10 0:76fed7dd9235 41 */
seanwilson10 0:76fed7dd9235 42
seanwilson10 0:76fed7dd9235 43 #ifndef __ADI_SENSE_1000_API_H__
seanwilson10 0:76fed7dd9235 44 #define __ADI_SENSE_1000_API_H__
seanwilson10 0:76fed7dd9235 45
seanwilson10 0:76fed7dd9235 46 #include "inc/adi_sense_types.h"
seanwilson10 0:76fed7dd9235 47 #include "inc/adi_sense_config_types.h"
seanwilson10 0:76fed7dd9235 48 #include "inc/adi_sense_platform.h"
seanwilson10 0:76fed7dd9235 49 #include "adi_sense_1000_config.h"
seanwilson10 0:76fed7dd9235 50 #include "adi_sense_1000_lut_data.h"
seanwilson10 0:76fed7dd9235 51
seanwilson10 0:76fed7dd9235 52 /*! @ingroup ADI_Sense_Api */
seanwilson10 0:76fed7dd9235 53
seanwilson10 0:76fed7dd9235 54 /*! @defgroup ADI_Sense_1000_Api ADI Sense 1000 Host Library API
seanwilson10 0:76fed7dd9235 55 * ADI Sense 1000 device-specific API function prototypes.
seanwilson10 0:76fed7dd9235 56 * These are supplementary to the common ADI Sense Host Library API.
seanwilson10 0:76fed7dd9235 57 * @{
seanwilson10 0:76fed7dd9235 58 */
seanwilson10 0:76fed7dd9235 59
seanwilson10 0:76fed7dd9235 60 #ifdef __cplusplus
seanwilson10 0:76fed7dd9235 61 extern "C" {
seanwilson10 0:76fed7dd9235 62 #endif
seanwilson10 0:76fed7dd9235 63
seanwilson10 0:76fed7dd9235 64 /*!
seanwilson10 0:76fed7dd9235 65 * @brief Read one or more device registers at the specified register address.
seanwilson10 0:76fed7dd9235 66 *
seanwilson10 0:76fed7dd9235 67 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 68 * @param[in] nAddress Register map address to read from
seanwilson10 0:76fed7dd9235 69 * @param[out] pData Pointer to return the register map data
seanwilson10 0:76fed7dd9235 70 * @param[in] nLength Number of bytes of data to read from the register map
seanwilson10 0:76fed7dd9235 71 *
seanwilson10 0:76fed7dd9235 72 * @return Status
seanwilson10 0:76fed7dd9235 73 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 74 *
seanwilson10 0:76fed7dd9235 75 * @details Provides direct byte-level read access to the device register map.
seanwilson10 0:76fed7dd9235 76 * The size and format of the register(s) must be known.
seanwilson10 0:76fed7dd9235 77 *
seanwilson10 0:76fed7dd9235 78 * @note Reads from special "keyhole" or "FIFO" registers will be handled
seanwilson10 0:76fed7dd9235 79 * according to documentation for those registers.
seanwilson10 0:76fed7dd9235 80 */
seanwilson10 0:76fed7dd9235 81 ADI_SENSE_RESULT adi_sense_1000_ReadRegister(
seanwilson10 0:76fed7dd9235 82 ADI_SENSE_DEVICE_HANDLE const hDevice,
seanwilson10 0:76fed7dd9235 83 uint16_t const nAddress,
seanwilson10 0:76fed7dd9235 84 void * const pData,
seanwilson10 0:76fed7dd9235 85 unsigned const nLength);
seanwilson10 0:76fed7dd9235 86
seanwilson10 0:76fed7dd9235 87 /*!
seanwilson10 0:76fed7dd9235 88 * @brief Write one or more device registers at the specified register address.
seanwilson10 0:76fed7dd9235 89 *
seanwilson10 0:76fed7dd9235 90 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 91 * @param[in] nAddress Register map address to read from
seanwilson10 0:76fed7dd9235 92 * @param[out] pData Pointer to return the register map data
seanwilson10 0:76fed7dd9235 93 * @param[in] nLength Number of bytes of data to read from the register map
seanwilson10 0:76fed7dd9235 94 *
seanwilson10 0:76fed7dd9235 95 * @return Status
seanwilson10 0:76fed7dd9235 96 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 97 *
seanwilson10 0:76fed7dd9235 98 * @details Provides direct byte-level write access to the device register map.
seanwilson10 0:76fed7dd9235 99 * The size and format of the register(s) must be known.
seanwilson10 0:76fed7dd9235 100 *
seanwilson10 0:76fed7dd9235 101 * @note Writes to read-only registers will be ignored by the device.
seanwilson10 0:76fed7dd9235 102 * @note Writes to special "keyhole" registers will be handled according to
seanwilson10 0:76fed7dd9235 103 * documentation for those registers.
seanwilson10 0:76fed7dd9235 104 */
seanwilson10 0:76fed7dd9235 105 ADI_SENSE_RESULT adi_sense_1000_WriteRegister(
seanwilson10 0:76fed7dd9235 106 ADI_SENSE_DEVICE_HANDLE const hDevice,
seanwilson10 0:76fed7dd9235 107 uint16_t const nAddress,
seanwilson10 0:76fed7dd9235 108 void * const pData,
seanwilson10 0:76fed7dd9235 109 unsigned const nLength);
seanwilson10 0:76fed7dd9235 110
seanwilson10 0:76fed7dd9235 111 /*!
seanwilson10 0:76fed7dd9235 112 * @brief Update power configuration settings on the device.
seanwilson10 0:76fed7dd9235 113 *
seanwilson10 0:76fed7dd9235 114 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 115 * @param[in] pPowerConfig Power configuration details
seanwilson10 0:76fed7dd9235 116 *
seanwilson10 0:76fed7dd9235 117 * @return Status
seanwilson10 0:76fed7dd9235 118 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 119 *
seanwilson10 0:76fed7dd9235 120 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 121 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 122 *
seanwilson10 0:76fed7dd9235 123 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 124 */
seanwilson10 0:76fed7dd9235 125 ADI_SENSE_RESULT adi_sense_1000_SetPowerConfig(
seanwilson10 0:76fed7dd9235 126 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 127 ADI_SENSE_1000_POWER_CONFIG *pPowerConfig);
seanwilson10 0:76fed7dd9235 128
seanwilson10 0:76fed7dd9235 129 /*!
seanwilson10 0:76fed7dd9235 130 * @brief Update measurement configuration settings on the device.
seanwilson10 0:76fed7dd9235 131 *
seanwilson10 0:76fed7dd9235 132 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 133 * @param[in] pMeasurementConfig Measurement configuration details
seanwilson10 0:76fed7dd9235 134 *
seanwilson10 0:76fed7dd9235 135 * @return Status
seanwilson10 0:76fed7dd9235 136 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 137 *
seanwilson10 0:76fed7dd9235 138 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 139 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 140 *
seanwilson10 0:76fed7dd9235 141 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 142 */
seanwilson10 0:76fed7dd9235 143 ADI_SENSE_RESULT adi_sense_1000_SetMeasurementConfig(
seanwilson10 0:76fed7dd9235 144 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 145 ADI_SENSE_1000_MEASUREMENT_CONFIG *pMeasurementConfig);
seanwilson10 0:76fed7dd9235 146
seanwilson10 0:76fed7dd9235 147 /*!
seanwilson10 0:76fed7dd9235 148 * @brief Update diagnostics configuration settings on the device.
seanwilson10 0:76fed7dd9235 149 *
seanwilson10 0:76fed7dd9235 150 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 151 * @param[in] pDiagnosticsConfig Diagnostics configuration details
seanwilson10 0:76fed7dd9235 152 *
seanwilson10 0:76fed7dd9235 153 * @return Status
seanwilson10 0:76fed7dd9235 154 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 155 *
seanwilson10 0:76fed7dd9235 156 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 157 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 158 *
seanwilson10 0:76fed7dd9235 159 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 160 */
seanwilson10 0:76fed7dd9235 161 ADI_SENSE_RESULT adi_sense_1000_SetDiagnosticsConfig(
seanwilson10 0:76fed7dd9235 162 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 163 ADI_SENSE_1000_DIAGNOSTICS_CONFIG *pDiagnosticsConfig);
seanwilson10 0:76fed7dd9235 164
seanwilson10 0:76fed7dd9235 165 /*!
seanwilson10 0:76fed7dd9235 166 * @brief Update channel configuration settings for a specific channel.
seanwilson10 0:76fed7dd9235 167 *
seanwilson10 0:76fed7dd9235 168 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 169 * @param[in] eChannelId Selects the channel to be updated
seanwilson10 0:76fed7dd9235 170 * @param[in] pChannelConfig Channel configuration details
seanwilson10 0:76fed7dd9235 171 *
seanwilson10 0:76fed7dd9235 172 * @return Status
seanwilson10 0:76fed7dd9235 173 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 174 *
seanwilson10 0:76fed7dd9235 175 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 176 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 177 * Allows individual channel configuration details to be dynamically
seanwilson10 0:76fed7dd9235 178 * adjusted without rewriting the full device configuration.
seanwilson10 0:76fed7dd9235 179 *
seanwilson10 0:76fed7dd9235 180 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 181 */
seanwilson10 0:76fed7dd9235 182 ADI_SENSE_RESULT adi_sense_1000_SetChannelConfig(
seanwilson10 0:76fed7dd9235 183 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 184 ADI_SENSE_1000_CHANNEL_ID eChannelId,
seanwilson10 0:76fed7dd9235 185 ADI_SENSE_1000_CHANNEL_CONFIG *pChannelConfig);
seanwilson10 0:76fed7dd9235 186
seanwilson10 0:76fed7dd9235 187 /*!
seanwilson10 0:76fed7dd9235 188 * @brief Update number of measurements-per-cycle for a specific channel.
seanwilson10 0:76fed7dd9235 189 *
seanwilson10 0:76fed7dd9235 190 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 191 * @param[in] eChannelId Selects the channel to be updated
seanwilson10 0:76fed7dd9235 192 * @param[in] nMeasurementsPerCycle Specifies the number of measurements to be
seanwilson10 0:76fed7dd9235 193 * obtained from this channel in each
seanwilson10 0:76fed7dd9235 194 * measurement cycle. Set as 0 to disable the
seanwilson10 0:76fed7dd9235 195 * channel (omit from measurement cycle).
seanwilson10 0:76fed7dd9235 196 *
seanwilson10 0:76fed7dd9235 197 * @return Status
seanwilson10 0:76fed7dd9235 198 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 199 *
seanwilson10 0:76fed7dd9235 200 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 201 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 202 * Allows individual channels to be dynamically enabled/disabled, and
seanwilson10 0:76fed7dd9235 203 * measurements-per-cycle to be adjusted.
seanwilson10 0:76fed7dd9235 204 *
seanwilson10 0:76fed7dd9235 205 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 206 */
seanwilson10 0:76fed7dd9235 207 ADI_SENSE_RESULT adi_sense_1000_SetChannelCount(
seanwilson10 0:76fed7dd9235 208 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 209 ADI_SENSE_1000_CHANNEL_ID eChannelId,
seanwilson10 0:76fed7dd9235 210 uint32_t nMeasurementsPerCycle);
seanwilson10 0:76fed7dd9235 211
seanwilson10 0:76fed7dd9235 212 /*!
seanwilson10 0:76fed7dd9235 213 * @brief Update the measurement threshold limits for a specified channel.
seanwilson10 0:76fed7dd9235 214 *
seanwilson10 0:76fed7dd9235 215 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 216 * @param[in] eChannelId Selects the channel to be updated
seanwilson10 0:76fed7dd9235 217 * @param[in] fHighThresholdLimit Optional maximum threshold value for each
seanwilson10 0:76fed7dd9235 218 * processed sample, to be checked prior to
seanwilson10 0:76fed7dd9235 219 * publishing. A channel ALERT condition is
seanwilson10 0:76fed7dd9235 220 * raised if the processed value is higher than
seanwilson10 0:76fed7dd9235 221 * this threshold. Set to NaN if not required.
seanwilson10 0:76fed7dd9235 222 * @param[in] fLowThresholdLimit Optional minimum threshold value for each
seanwilson10 0:76fed7dd9235 223 * processed sample, to be checked prior to
seanwilson10 0:76fed7dd9235 224 * publishing. A channel ALERT condition is
seanwilson10 0:76fed7dd9235 225 * raised if the processed value is lower than
seanwilson10 0:76fed7dd9235 226 * this threshold. Set to NaN if not required.
seanwilson10 0:76fed7dd9235 227 *
seanwilson10 0:76fed7dd9235 228 * @return Status
seanwilson10 0:76fed7dd9235 229 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 230 *
seanwilson10 0:76fed7dd9235 231 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 232 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 233 * Allows individual channel thresholds to be dynamically adjusted.
seanwilson10 0:76fed7dd9235 234 *
seanwilson10 0:76fed7dd9235 235 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 236 */
seanwilson10 0:76fed7dd9235 237 ADI_SENSE_RESULT adi_sense_1000_SetChannelThresholdLimits(
seanwilson10 0:76fed7dd9235 238 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 239 ADI_SENSE_1000_CHANNEL_ID eChannelId,
seanwilson10 0:76fed7dd9235 240 float32_t fHighThresholdLimit,
seanwilson10 0:76fed7dd9235 241 float32_t fLowThresholdLimit);
seanwilson10 0:76fed7dd9235 242
seanwilson10 0:76fed7dd9235 243 /*!
seanwilson10 0:76fed7dd9235 244 * @brief Update the extra settling time for a specified channel.
seanwilson10 0:76fed7dd9235 245 *
seanwilson10 0:76fed7dd9235 246 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 247 * @param[in] eChannelId Selects the channel to be updated
seanwilson10 0:76fed7dd9235 248 * @param[in] nSettlingTime A minimum settling time is applied internally for
seanwilson10 0:76fed7dd9235 249 * each channel, based on the sensor type. However,
seanwilson10 0:76fed7dd9235 250 * additional settling time (microseconds) can
seanwilson10 0:76fed7dd9235 251 * optionally be specified here. Set to 0 if not
seanwilson10 0:76fed7dd9235 252 * required.
seanwilson10 0:76fed7dd9235 253 *
seanwilson10 0:76fed7dd9235 254 * @return Status
seanwilson10 0:76fed7dd9235 255 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 256 *
seanwilson10 0:76fed7dd9235 257 * @details Translates configuration details provided into device-specific
seanwilson10 0:76fed7dd9235 258 * register settings and updates device configuration registers.
seanwilson10 0:76fed7dd9235 259 * Allows individual channel settling times to be dynamically adjusted.
seanwilson10 0:76fed7dd9235 260 *
seanwilson10 0:76fed7dd9235 261 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 262 */
seanwilson10 0:76fed7dd9235 263 ADI_SENSE_RESULT adi_sense_1000_SetChannelSettlingTime(
seanwilson10 0:76fed7dd9235 264 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 265 ADI_SENSE_1000_CHANNEL_ID eChannelId,
seanwilson10 0:76fed7dd9235 266 uint32_t nSettlingTime);
seanwilson10 0:76fed7dd9235 267
seanwilson10 0:76fed7dd9235 268 /*!
seanwilson10 0:76fed7dd9235 269 * @brief Assemble a list of separate Look-Up Tables into a single buffer
seanwilson10 0:76fed7dd9235 270 *
seanwilson10 0:76fed7dd9235 271 * @param[out] pLutBuffer Pointer to the Look-Up Table data buffer where
seanwilson10 0:76fed7dd9235 272 * the assembled Look-Up Table data will be placed
seanwilson10 0:76fed7dd9235 273 * @param[in] nLutBufferSize Allocated size, in bytes, of the output data buffer
seanwilson10 0:76fed7dd9235 274 * @param[in] nNumTables Number of tables to add to the Look-Up Table buffer
seanwilson10 0:76fed7dd9235 275 * @param[in] ppDesc Array of pointers to the table descriptors to be added
seanwilson10 0:76fed7dd9235 276 * @param[in] ppData Array of pointers to the table data to be added
seanwilson10 0:76fed7dd9235 277 *
seanwilson10 0:76fed7dd9235 278 * @return Status
seanwilson10 0:76fed7dd9235 279 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 280 *
seanwilson10 0:76fed7dd9235 281 * @details This utiliity function fills the Look-up Table header fields; then
seanwilson10 0:76fed7dd9235 282 * walks through the array of individual table descriptor and data
seanwilson10 0:76fed7dd9235 283 * pointers provided, appending (copying) each one to the Look-Up Table
seanwilson10 0:76fed7dd9235 284 * data buffer. The length and crc16 fields of each table descriptor
seanwilson10 0:76fed7dd9235 285 * will be calculated and filled by this function, but other fields in
seanwilson10 0:76fed7dd9235 286 * the descriptor structure must be filled by the caller beforehand.
seanwilson10 0:76fed7dd9235 287 *
seanwilson10 0:76fed7dd9235 288 * @note The assembled LUT data buffer filled by this function can then be
seanwilson10 0:76fed7dd9235 289 * written to the device memory using @adi_sense_1000_SetLutData.
seanwilson10 0:76fed7dd9235 290 */
seanwilson10 0:76fed7dd9235 291 ADI_SENSE_RESULT adi_sense_1000_AssembleLutData(
seanwilson10 0:76fed7dd9235 292 ADI_SENSE_1000_LUT * pLutBuffer,
seanwilson10 0:76fed7dd9235 293 unsigned nLutBufferSize,
seanwilson10 0:76fed7dd9235 294 unsigned const nNumTables,
seanwilson10 0:76fed7dd9235 295 ADI_SENSE_1000_LUT_DESCRIPTOR * const ppDesc[],
seanwilson10 0:76fed7dd9235 296 ADI_SENSE_1000_LUT_TABLE_DATA * const ppData[]);
seanwilson10 0:76fed7dd9235 297
seanwilson10 0:76fed7dd9235 298 /*!
seanwilson10 0:76fed7dd9235 299 * @brief Write Look-Up Table data to the device memory
seanwilson10 0:76fed7dd9235 300 *
seanwilson10 0:76fed7dd9235 301 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 302 * @param[out] pLutData Pointer to the Look-Up Table data structure
seanwilson10 0:76fed7dd9235 303 *
seanwilson10 0:76fed7dd9235 304 * @return Status
seanwilson10 0:76fed7dd9235 305 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 306 *
seanwilson10 0:76fed7dd9235 307 * @details Validates the Look-Up Table data format and loads it into
seanwilson10 0:76fed7dd9235 308 * device memory via dedicated keyhole registers.
seanwilson10 0:76fed7dd9235 309 *
seanwilson10 0:76fed7dd9235 310 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 311 */
seanwilson10 0:76fed7dd9235 312 ADI_SENSE_RESULT adi_sense_1000_SetLutData(
seanwilson10 0:76fed7dd9235 313 ADI_SENSE_DEVICE_HANDLE const hDevice,
seanwilson10 0:76fed7dd9235 314 ADI_SENSE_1000_LUT * const pLutData);
seanwilson10 0:76fed7dd9235 315
seanwilson10 0:76fed7dd9235 316 /*!
seanwilson10 0:76fed7dd9235 317 * @brief Write Look-Up Table raw data to the device memory
seanwilson10 0:76fed7dd9235 318 *
seanwilson10 0:76fed7dd9235 319 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 320 * @param[out] pLutData Pointer to the Look-Up Table raw data structure
seanwilson10 0:76fed7dd9235 321 *
seanwilson10 0:76fed7dd9235 322 * @return Status
seanwilson10 0:76fed7dd9235 323 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 324 *
seanwilson10 0:76fed7dd9235 325 * @details This can be used instead of @adi_sense_1000_SetLutData for
seanwilson10 0:76fed7dd9235 326 * loading LUT data from the alternative raw data format. See
seanwilson10 0:76fed7dd9235 327 * @adi_sense_1000_SetLutData for more information.
seanwilson10 0:76fed7dd9235 328 *
seanwilson10 0:76fed7dd9235 329 * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called
seanwilson10 0:76fed7dd9235 330 */
seanwilson10 0:76fed7dd9235 331 ADI_SENSE_RESULT adi_sense_1000_SetLutDataRaw(
seanwilson10 0:76fed7dd9235 332 ADI_SENSE_DEVICE_HANDLE const hDevice,
seanwilson10 0:76fed7dd9235 333 ADI_SENSE_1000_LUT_RAW * const pLutData);
seanwilson10 0:76fed7dd9235 334
seanwilson10 0:76fed7dd9235 335 /*!
seanwilson10 0:76fed7dd9235 336 * @brief Get the number of samples available when DATAREADY status is asserted.
seanwilson10 0:76fed7dd9235 337 *
seanwilson10 0:76fed7dd9235 338 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 339 * @param[in] bMeasurementMode Must be set to the same value used for @ref
seanwilson10 0:76fed7dd9235 340 * adi_sense_StartMeasurement().
seanwilson10 0:76fed7dd9235 341 * @param[out] peOperatingMode Pointer to return the configured operating mode
seanwilson10 0:76fed7dd9235 342 * @param[out] peDataReadMode Pointer to return the configured data publishing mode
seanwilson10 0:76fed7dd9235 343 * @param[out] pnSamplesPerDataready Pointer to return the calculated number of samples
seanwilson10 0:76fed7dd9235 344 * available when DATAREADY is asserted
seanwilson10 0:76fed7dd9235 345 * @param[out] pnSamplesPerCycle Pointer to return the calculated number of samples
seanwilson10 0:76fed7dd9235 346 * produced per measurement cycle
seanwilson10 0:76fed7dd9235 347 *
seanwilson10 0:76fed7dd9235 348 * @return Status
seanwilson10 0:76fed7dd9235 349 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 350 *
seanwilson10 0:76fed7dd9235 351 * @details Examines the current configuration settings in the device registers
seanwilson10 0:76fed7dd9235 352 * to calculate the number of samples available whenever the DATAREADY
seanwilson10 0:76fed7dd9235 353 * signal is asserted, along with other related information. This may
seanwilson10 0:76fed7dd9235 354 * be used to allocate buffers to store samples and to determine how
seanwilson10 0:76fed7dd9235 355 * many samples to retrieve whenever the DATAREADY status is asserted.
seanwilson10 0:76fed7dd9235 356 */
seanwilson10 0:76fed7dd9235 357 ADI_SENSE_RESULT adi_sense_1000_GetDataReadyModeInfo(
seanwilson10 0:76fed7dd9235 358 ADI_SENSE_DEVICE_HANDLE const hDevice,
seanwilson10 0:76fed7dd9235 359 ADI_SENSE_MEASUREMENT_MODE const eMeasurementMode,
seanwilson10 0:76fed7dd9235 360 ADI_SENSE_1000_OPERATING_MODE * const peOperatingMode,
seanwilson10 0:76fed7dd9235 361 ADI_SENSE_1000_DATAREADY_MODE * const peDataReadyMode,
seanwilson10 0:76fed7dd9235 362 uint32_t * const pnSamplesPerDataready,
seanwilson10 0:76fed7dd9235 363 uint32_t * const pnSamplesPerCycle);
seanwilson10 0:76fed7dd9235 364
seanwilson10 0:76fed7dd9235 365 /*!
seanwilson10 0:76fed7dd9235 366 * @brief Read the contents of the ADI Sense internal factory calibration table
seanwilson10 0:76fed7dd9235 367 *
seanwilson10 0:76fed7dd9235 368 * Calibration coefficients/gains/offsets are stored internally in a 2D table of
seanwilson10 0:76fed7dd9235 369 * 32-bit floating point values. Refer to product documentation for details of
seanwilson10 0:76fed7dd9235 370 * the rows and columns.
seanwilson10 0:76fed7dd9235 371 *
seanwilson10 0:76fed7dd9235 372 * @param[in] hDevice ADI Sense device context handle
seanwilson10 0:76fed7dd9235 373 * @param[in] pfBuffer Pointer to destination buffer for the calibration data
seanwilson10 0:76fed7dd9235 374 * @param[in] nMaxLen The buffer capacity in bytes (e.g. 672 for 56x3 table)
seanwilson10 0:76fed7dd9235 375 * @param[out] pnDataLen The number of bytes written to the buffer
seanwilson10 0:76fed7dd9235 376 * @param[out] pnRows Pointer to return the number of table rows (e.g. 56)
seanwilson10 0:76fed7dd9235 377 * @param[out] pnColumns Pointer to return the number of table columns (e.g. 3)
seanwilson10 0:76fed7dd9235 378 *
seanwilson10 0:76fed7dd9235 379 * @return Status
seanwilson10 0:76fed7dd9235 380 * - #ADI_SENSE_SUCCESS Call completed successfully.
seanwilson10 0:76fed7dd9235 381 * - #ADI_SENSE_FAILURE
seanwilson10 0:76fed7dd9235 382 * - #ADI_SENSE_INVALID_OPERATION Invalid register identifier.
seanwilson10 0:76fed7dd9235 383 */
seanwilson10 0:76fed7dd9235 384 ADI_SENSE_RESULT adi_sense_1000_ReadCalTable(
seanwilson10 0:76fed7dd9235 385 ADI_SENSE_DEVICE_HANDLE hDevice,
seanwilson10 0:76fed7dd9235 386 float *pfBuffer,
seanwilson10 0:76fed7dd9235 387 unsigned nMaxLen,
seanwilson10 0:76fed7dd9235 388 unsigned *pnDataLen,
seanwilson10 0:76fed7dd9235 389 unsigned *pnRows,
seanwilson10 0:76fed7dd9235 390 unsigned *pnColumns);
seanwilson10 0:76fed7dd9235 391
seanwilson10 0:76fed7dd9235 392 #ifdef __cplusplus
seanwilson10 0:76fed7dd9235 393 }
seanwilson10 0:76fed7dd9235 394 #endif
seanwilson10 0:76fed7dd9235 395
seanwilson10 0:76fed7dd9235 396 /*!
seanwilson10 0:76fed7dd9235 397 * @}
seanwilson10 0:76fed7dd9235 398 */
seanwilson10 0:76fed7dd9235 399
seanwilson10 0:76fed7dd9235 400 #endif /* __ADI_SENSE_1000_API_H__ */
seanwilson10 0:76fed7dd9235 401