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