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