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