![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ADISense1000 Version 2.1 code base
Fork of AdiSense1000_V21 by
inc/adi_sense_api.h@12:97457cf77bcb, 2017-11-27 (annotated)
- Committer:
- kevin1990
- Date:
- Mon Nov 27 13:10:11 2017 +0000
- Revision:
- 12:97457cf77bcb
v1.0 release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevin1990 | 12:97457cf77bcb | 1 | /*! |
kevin1990 | 12:97457cf77bcb | 2 | ****************************************************************************** |
kevin1990 | 12:97457cf77bcb | 3 | * @file: adi_sense_api.h |
kevin1990 | 12:97457cf77bcb | 4 | * @brief: ADI Sense Host Library Application Programming Interface (API) |
kevin1990 | 12:97457cf77bcb | 5 | *----------------------------------------------------------------------------- |
kevin1990 | 12:97457cf77bcb | 6 | */ |
kevin1990 | 12:97457cf77bcb | 7 | |
kevin1990 | 12:97457cf77bcb | 8 | /* |
kevin1990 | 12:97457cf77bcb | 9 | Copyright (c) 2017 Emutex Ltd. / Analog Devices, Inc. |
kevin1990 | 12:97457cf77bcb | 10 | |
kevin1990 | 12:97457cf77bcb | 11 | All rights reserved. |
kevin1990 | 12:97457cf77bcb | 12 | |
kevin1990 | 12:97457cf77bcb | 13 | Redistribution and use in source and binary forms, with or without modification, |
kevin1990 | 12:97457cf77bcb | 14 | are permitted provided that the following conditions are met: |
kevin1990 | 12:97457cf77bcb | 15 | - Redistributions of source code must retain the above copyright notice, |
kevin1990 | 12:97457cf77bcb | 16 | this list of conditions and the following disclaimer. |
kevin1990 | 12:97457cf77bcb | 17 | - Redistributions in binary form must reproduce the above copyright notice, |
kevin1990 | 12:97457cf77bcb | 18 | this list of conditions and the following disclaimer in the documentation |
kevin1990 | 12:97457cf77bcb | 19 | and/or other materials provided with the distribution. |
kevin1990 | 12:97457cf77bcb | 20 | - Modified versions of the software must be conspicuously marked as such. |
kevin1990 | 12:97457cf77bcb | 21 | - This software is licensed solely and exclusively for use with processors |
kevin1990 | 12:97457cf77bcb | 22 | manufactured by or for Analog Devices, Inc. |
kevin1990 | 12:97457cf77bcb | 23 | - This software may not be combined or merged with other code in any manner |
kevin1990 | 12:97457cf77bcb | 24 | that would cause the software to become subject to terms and conditions |
kevin1990 | 12:97457cf77bcb | 25 | which differ from those listed here. |
kevin1990 | 12:97457cf77bcb | 26 | - Neither the name of Analog Devices, Inc. nor the names of its |
kevin1990 | 12:97457cf77bcb | 27 | contributors may be used to endorse or promote products derived |
kevin1990 | 12:97457cf77bcb | 28 | from this software without specific prior written permission. |
kevin1990 | 12:97457cf77bcb | 29 | - The use of this software may or may not infringe the patent rights of one |
kevin1990 | 12:97457cf77bcb | 30 | or more patent holders. This license does not release you from the |
kevin1990 | 12:97457cf77bcb | 31 | requirement that you obtain separate licenses from these patent holders |
kevin1990 | 12:97457cf77bcb | 32 | to use this software. |
kevin1990 | 12:97457cf77bcb | 33 | |
kevin1990 | 12:97457cf77bcb | 34 | THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY |
kevin1990 | 12:97457cf77bcb | 35 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
kevin1990 | 12:97457cf77bcb | 36 | TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
kevin1990 | 12:97457cf77bcb | 37 | NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
kevin1990 | 12:97457cf77bcb | 38 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES |
kevin1990 | 12:97457cf77bcb | 39 | (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL |
kevin1990 | 12:97457cf77bcb | 40 | PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
kevin1990 | 12:97457cf77bcb | 41 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
kevin1990 | 12:97457cf77bcb | 42 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
kevin1990 | 12:97457cf77bcb | 43 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
kevin1990 | 12:97457cf77bcb | 44 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
kevin1990 | 12:97457cf77bcb | 45 | */ |
kevin1990 | 12:97457cf77bcb | 46 | |
kevin1990 | 12:97457cf77bcb | 47 | #ifndef __ADI_SENSE_API_H__ |
kevin1990 | 12:97457cf77bcb | 48 | #define __ADI_SENSE_API_H__ |
kevin1990 | 12:97457cf77bcb | 49 | |
kevin1990 | 12:97457cf77bcb | 50 | #include "inc/adi_sense_types.h" |
kevin1990 | 12:97457cf77bcb | 51 | #include "inc/adi_sense_config_types.h" |
kevin1990 | 12:97457cf77bcb | 52 | #include "inc/adi_sense_platform.h" |
kevin1990 | 12:97457cf77bcb | 53 | #include "inc/adi_sense_gpio.h" |
kevin1990 | 12:97457cf77bcb | 54 | #include "inc/adi_sense_spi.h" |
kevin1990 | 12:97457cf77bcb | 55 | #include "inc/adi_sense_log.h" |
kevin1990 | 12:97457cf77bcb | 56 | #include "inc/adi_sense_time.h" |
kevin1990 | 12:97457cf77bcb | 57 | |
kevin1990 | 12:97457cf77bcb | 58 | /*! @addtogroup ADI_Sense_Api ADI Sense Host Library API |
kevin1990 | 12:97457cf77bcb | 59 | * @{ |
kevin1990 | 12:97457cf77bcb | 60 | */ |
kevin1990 | 12:97457cf77bcb | 61 | |
kevin1990 | 12:97457cf77bcb | 62 | #ifdef __cplusplus |
kevin1990 | 12:97457cf77bcb | 63 | extern "C" { |
kevin1990 | 12:97457cf77bcb | 64 | #endif |
kevin1990 | 12:97457cf77bcb | 65 | |
kevin1990 | 12:97457cf77bcb | 66 | /*! The maximum number of channels supported by this API |
kevin1990 | 12:97457cf77bcb | 67 | * @note Specific ADI Sense products may implement a lower number of channels */ |
kevin1990 | 12:97457cf77bcb | 68 | #define ADI_SENSE_MAX_CHANNELS 16 |
kevin1990 | 12:97457cf77bcb | 69 | |
kevin1990 | 12:97457cf77bcb | 70 | /*! A handle used in all API functions to identify the ADI Sense device. */ |
kevin1990 | 12:97457cf77bcb | 71 | typedef void* ADI_SENSE_DEVICE_HANDLE; |
kevin1990 | 12:97457cf77bcb | 72 | |
kevin1990 | 12:97457cf77bcb | 73 | /*! Supported connection types for communication with the ADI Sense device. */ |
kevin1990 | 12:97457cf77bcb | 74 | typedef enum { |
kevin1990 | 12:97457cf77bcb | 75 | ADI_SENSE_CONNECTION_TYPE_SPI = 1, |
kevin1990 | 12:97457cf77bcb | 76 | /*!< Serial Peripheral Interface (SPI) connection type */ |
kevin1990 | 12:97457cf77bcb | 77 | } ADI_SENSE_CONNECTION_TYPE; |
kevin1990 | 12:97457cf77bcb | 78 | |
kevin1990 | 12:97457cf77bcb | 79 | /*! Connection details for communication with a ADI Sense device instance. */ |
kevin1990 | 12:97457cf77bcb | 80 | typedef struct { |
kevin1990 | 12:97457cf77bcb | 81 | ADI_SENSE_CONNECTION_TYPE type; |
kevin1990 | 12:97457cf77bcb | 82 | /*!< Connection type selection */ |
kevin1990 | 12:97457cf77bcb | 83 | ADI_SENSE_PLATFORM_SPI_CONFIG spi; |
kevin1990 | 12:97457cf77bcb | 84 | /*!< SPI connection parameters, required if SPI connection type is used */ |
kevin1990 | 12:97457cf77bcb | 85 | ADI_SENSE_PLATFORM_GPIO_CONFIG gpio; |
kevin1990 | 12:97457cf77bcb | 86 | /*!< GPIO connection parameters, for device reset and status I/O signals */ |
kevin1990 | 12:97457cf77bcb | 87 | } ADI_SENSE_CONNECTION; |
kevin1990 | 12:97457cf77bcb | 88 | |
kevin1990 | 12:97457cf77bcb | 89 | /*! Bit masks (flags) for the different device status indicators. */ |
kevin1990 | 12:97457cf77bcb | 90 | typedef enum { |
kevin1990 | 12:97457cf77bcb | 91 | ADI_SENSE_DEVICE_STATUS_BUSY = (1 << 0), |
kevin1990 | 12:97457cf77bcb | 92 | /*!< Indicates that a command is currently running on the device */ |
kevin1990 | 12:97457cf77bcb | 93 | ADI_SENSE_DEVICE_STATUS_DATAREADY = (1 << 1), |
kevin1990 | 12:97457cf77bcb | 94 | /*!< Indicates the availability of measurement data for retrieval */ |
kevin1990 | 12:97457cf77bcb | 95 | ADI_SENSE_DEVICE_STATUS_ERROR = (1 << 2), |
kevin1990 | 12:97457cf77bcb | 96 | /*!< Indicates that an error condition has been detected by the device */ |
kevin1990 | 12:97457cf77bcb | 97 | ADI_SENSE_DEVICE_STATUS_ALERT = (1 << 3), |
kevin1990 | 12:97457cf77bcb | 98 | /*!< Indicates that an alert condition has been detected by the device */ |
kevin1990 | 12:97457cf77bcb | 99 | ADI_SENSE_DEVICE_STATUS_FIFO_ERROR = (1 << 4), |
kevin1990 | 12:97457cf77bcb | 100 | /*!< Indicates that a FIFO error condition has been detected by the device */ |
kevin1990 | 12:97457cf77bcb | 101 | ADI_SENSE_DEVICE_STATUS_CONFIG_ERROR = (1 << 5), |
kevin1990 | 12:97457cf77bcb | 102 | /*!< Indicates that a configuration error condition has been detected by the device */ |
kevin1990 | 12:97457cf77bcb | 103 | ADI_SENSE_DEVICE_STATUS_LUT_ERROR = (1 << 6), |
kevin1990 | 12:97457cf77bcb | 104 | /*!< Indicates that a look-up table error condition has been detected by the device */ |
kevin1990 | 12:97457cf77bcb | 105 | } ADI_SENSE_DEVICE_STATUS_FLAGS; |
kevin1990 | 12:97457cf77bcb | 106 | |
kevin1990 | 12:97457cf77bcb | 107 | /*! Bit masks (flags) for the different diagnostics status indicators. */ |
kevin1990 | 12:97457cf77bcb | 108 | typedef enum { |
kevin1990 | 12:97457cf77bcb | 109 | ADI_SENSE_DIAGNOSTICS_STATUS_CHECKSUM_ERROR = (1 << 0), |
kevin1990 | 12:97457cf77bcb | 110 | /*!< Indicates Error on Internal Checksum Calculations */ |
kevin1990 | 12:97457cf77bcb | 111 | ADI_SENSE_DIAGNOSTICS_STATUS_COMMS_ERROR = (1 << 1), |
kevin1990 | 12:97457cf77bcb | 112 | /*!< Indicates Error on Internal Device Communications */ |
kevin1990 | 12:97457cf77bcb | 113 | ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_MONITOR_ERROR = (1 << 2), |
kevin1990 | 12:97457cf77bcb | 114 | /*!< Indicates Low Voltage on Internal Supply Voltages */ |
kevin1990 | 12:97457cf77bcb | 115 | ADI_SENSE_DIAGNOSTICS_STATUS_SUPPLY_CAP_ERROR = (1 << 3), |
kevin1990 | 12:97457cf77bcb | 116 | /*!< Indicates Fault on Internal Supply Regulator Capacitor */ |
kevin1990 | 12:97457cf77bcb | 117 | ADI_SENSE_DIAGNOSTICS_STATUS_AINM_UV_ERROR = (1 << 4), |
kevin1990 | 12:97457cf77bcb | 118 | /*!< Indicates Under-Voltage Error on Negative Analog Input */ |
kevin1990 | 12:97457cf77bcb | 119 | ADI_SENSE_DIAGNOSTICS_STATUS_AINM_OV_ERROR = (1 << 5), |
kevin1990 | 12:97457cf77bcb | 120 | /*!< Indicates Over-Voltage Error on Negative Analog Input */ |
kevin1990 | 12:97457cf77bcb | 121 | ADI_SENSE_DIAGNOSTICS_STATUS_AINP_UV_ERROR = (1 << 6), |
kevin1990 | 12:97457cf77bcb | 122 | /*!< Indicates Under-Voltage Error on Positive Analog Input */ |
kevin1990 | 12:97457cf77bcb | 123 | ADI_SENSE_DIAGNOSTICS_STATUS_AINP_OV_ERROR = (1 << 7), |
kevin1990 | 12:97457cf77bcb | 124 | /*!< Indicates Over-Voltage Error on Positive Analog Input */ |
kevin1990 | 12:97457cf77bcb | 125 | ADI_SENSE_DIAGNOSTICS_STATUS_CONVERSION_ERROR = (1 << 8), |
kevin1990 | 12:97457cf77bcb | 126 | /*!< Indicates Error During Internal ADC Conversions */ |
kevin1990 | 12:97457cf77bcb | 127 | ADI_SENSE_DIAGNOSTICS_STATUS_CALIBRATION_ERROR = (1 << 9), |
kevin1990 | 12:97457cf77bcb | 128 | /*!< Indicates Error During Internal Device Calibrations */ |
kevin1990 | 12:97457cf77bcb | 129 | } ADI_SENSE_DIAGNOSTICS_STATUS_FLAGS; |
kevin1990 | 12:97457cf77bcb | 130 | |
kevin1990 | 12:97457cf77bcb | 131 | /*! Bit masks (flags) for the different channel alert indicators. */ |
kevin1990 | 12:97457cf77bcb | 132 | typedef enum { |
kevin1990 | 12:97457cf77bcb | 133 | ADI_SENSE_CHANNEL_ALERT_TIMEOUT = (1 << 0), |
kevin1990 | 12:97457cf77bcb | 134 | /*!< Indicates timeout condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 135 | ADI_SENSE_CHANNEL_ALERT_UNDER_RANGE = (1 << 1), |
kevin1990 | 12:97457cf77bcb | 136 | /*!< Indicates raw sample under valid input range, possibly clamped */ |
kevin1990 | 12:97457cf77bcb | 137 | ADI_SENSE_CHANNEL_ALERT_OVER_RANGE = (1 << 2), |
kevin1990 | 12:97457cf77bcb | 138 | /*!< Indicates raw sample over valid input range, possibly clamped */ |
kevin1990 | 12:97457cf77bcb | 139 | ADI_SENSE_CHANNEL_ALERT_LOW_LIMIT = (1 << 3), |
kevin1990 | 12:97457cf77bcb | 140 | /*!< Indicates measurement result was below configured minimum threshold */ |
kevin1990 | 12:97457cf77bcb | 141 | ADI_SENSE_CHANNEL_ALERT_HIGH_LIMIT = (1 << 4), |
kevin1990 | 12:97457cf77bcb | 142 | /*!< Indicates measurement result was above configured maximum threshold */ |
kevin1990 | 12:97457cf77bcb | 143 | ADI_SENSE_CHANNEL_ALERT_SENSOR_OPEN = (1 << 5), |
kevin1990 | 12:97457cf77bcb | 144 | /*!< Indicates open circuit or mis-wire condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 145 | ADI_SENSE_CHANNEL_ALERT_REF_DETECT = (1 << 6), |
kevin1990 | 12:97457cf77bcb | 146 | /*!< Indicates reference-detect error condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 147 | ADI_SENSE_CHANNEL_ALERT_CONFIG_ERR = (1 << 7), |
kevin1990 | 12:97457cf77bcb | 148 | /*!< Indicates configuration error condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 149 | ADI_SENSE_CHANNEL_ALERT_LUT_ERR = (1 << 8), |
kevin1990 | 12:97457cf77bcb | 150 | /*!< Indicates look-up table error condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 151 | ADI_SENSE_CHANNEL_ALERT_SENSOR_NOT_READY = (1 << 9), |
kevin1990 | 12:97457cf77bcb | 152 | /*!< Indicates digital sensor not-ready error condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 153 | ADI_SENSE_CHANNEL_ALERT_COMP_NOT_READY = (1 << 10), |
kevin1990 | 12:97457cf77bcb | 154 | /*!< Indicates compensation channel not-ready error condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 155 | ADI_SENSE_CHANNEL_ALERT_UNDER_VOLTAGE = (1 << 11), |
kevin1990 | 12:97457cf77bcb | 156 | /*!< Indicates under-voltage condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 157 | ADI_SENSE_CHANNEL_ALERT_OVER_VOLTAGE = (1 << 12), |
kevin1990 | 12:97457cf77bcb | 158 | /*!< Indicates over-voltage condition detected on the channel */ |
kevin1990 | 12:97457cf77bcb | 159 | ADI_SENSE_CHANNEL_ALERT_LUT_UNDER_RANGE = (1 << 13), |
kevin1990 | 12:97457cf77bcb | 160 | /*!< Indicates raw sample was under the available LUT/equation range */ |
kevin1990 | 12:97457cf77bcb | 161 | ADI_SENSE_CHANNEL_ALERT_LUT_OVER_RANGE = (1 << 14), |
kevin1990 | 12:97457cf77bcb | 162 | /*!< Indicates raw sample was over the available LUT/equation range */ |
kevin1990 | 12:97457cf77bcb | 163 | } ADI_SENSE_CHANNEL_ALERT_FLAGS; |
kevin1990 | 12:97457cf77bcb | 164 | |
kevin1990 | 12:97457cf77bcb | 165 | /*! Status details retreived from the ADI Sense device. */ |
kevin1990 | 12:97457cf77bcb | 166 | typedef struct { |
kevin1990 | 12:97457cf77bcb | 167 | ADI_SENSE_DEVICE_STATUS_FLAGS deviceStatus; |
kevin1990 | 12:97457cf77bcb | 168 | /*!< General summary status information from the device */ |
kevin1990 | 12:97457cf77bcb | 169 | ADI_SENSE_DIAGNOSTICS_STATUS_FLAGS diagnosticsStatus; |
kevin1990 | 12:97457cf77bcb | 170 | /*!< Diagnostic error status information from the device */ |
kevin1990 | 12:97457cf77bcb | 171 | ADI_SENSE_CHANNEL_ALERT_FLAGS channelAlerts[ADI_SENSE_MAX_CHANNELS]; |
kevin1990 | 12:97457cf77bcb | 172 | /*!< Per-channel alert status information from the device */ |
kevin1990 | 12:97457cf77bcb | 173 | uint32_t errorCode; |
kevin1990 | 12:97457cf77bcb | 174 | /*!< Code identifying the last error signalled by the device */ |
kevin1990 | 12:97457cf77bcb | 175 | uint32_t alertCode; |
kevin1990 | 12:97457cf77bcb | 176 | /*!< Code identifying the last alert signalled by the device */ |
kevin1990 | 12:97457cf77bcb | 177 | uint32_t channelAlertCodes[ADI_SENSE_MAX_CHANNELS]; |
kevin1990 | 12:97457cf77bcb | 178 | /*!< Per-channel code identifying the last alert signalled for each channel */ |
kevin1990 | 12:97457cf77bcb | 179 | } ADI_SENSE_STATUS; |
kevin1990 | 12:97457cf77bcb | 180 | |
kevin1990 | 12:97457cf77bcb | 181 | /*! Data sample details retreived from the ADI Sense device. */ |
kevin1990 | 12:97457cf77bcb | 182 | typedef struct { |
kevin1990 | 12:97457cf77bcb | 183 | ADI_SENSE_DEVICE_STATUS_FLAGS status; |
kevin1990 | 12:97457cf77bcb | 184 | /*!< Device summary status snapshot when the sample was recorded */ |
kevin1990 | 12:97457cf77bcb | 185 | uint32_t channelId; |
kevin1990 | 12:97457cf77bcb | 186 | /*!< The measurement channel from which this sample was obtained */ |
kevin1990 | 12:97457cf77bcb | 187 | uint32_t rawValue; |
kevin1990 | 12:97457cf77bcb | 188 | /*!< The raw (unprocessed) value obtained directly from the measurement |
kevin1990 | 12:97457cf77bcb | 189 | * channel, if available |
kevin1990 | 12:97457cf77bcb | 190 | */ |
kevin1990 | 12:97457cf77bcb | 191 | float32_t processedValue; |
kevin1990 | 12:97457cf77bcb | 192 | /*!< The processed value obtained from the measurement channel, as a final |
kevin1990 | 12:97457cf77bcb | 193 | * measurement value, following calibration and linearisation correction, |
kevin1990 | 12:97457cf77bcb | 194 | * and conversion into an appropriate unit of measurement. |
kevin1990 | 12:97457cf77bcb | 195 | */ |
kevin1990 | 12:97457cf77bcb | 196 | } ADI_SENSE_DATA_SAMPLE; |
kevin1990 | 12:97457cf77bcb | 197 | |
kevin1990 | 12:97457cf77bcb | 198 | |
kevin1990 | 12:97457cf77bcb | 199 | /****************************************************************************** |
kevin1990 | 12:97457cf77bcb | 200 | * ADI Sense High-Level API function prototypes |
kevin1990 | 12:97457cf77bcb | 201 | *****************************************************************************/ |
kevin1990 | 12:97457cf77bcb | 202 | |
kevin1990 | 12:97457cf77bcb | 203 | /*! |
kevin1990 | 12:97457cf77bcb | 204 | * @brief Open ADI Sense device handle and set up communication interface. |
kevin1990 | 12:97457cf77bcb | 205 | * |
kevin1990 | 12:97457cf77bcb | 206 | * @param[in] nDeviceIndex Zero-based index number identifying this device |
kevin1990 | 12:97457cf77bcb | 207 | * instance. Note that this will be used to |
kevin1990 | 12:97457cf77bcb | 208 | * retrieve a specific device configuration for |
kevin1990 | 12:97457cf77bcb | 209 | * this device (see @ref adi_sense_SetConfig |
kevin1990 | 12:97457cf77bcb | 210 | * and @ref ADI_SENSE_CONFIG) |
kevin1990 | 12:97457cf77bcb | 211 | * @param[in] pConnectionInfo Host-specific connection details (e.g. SPI, GPIO) |
kevin1990 | 12:97457cf77bcb | 212 | * @param[out] phDevice Pointer to return an ADI Sense device handle |
kevin1990 | 12:97457cf77bcb | 213 | * |
kevin1990 | 12:97457cf77bcb | 214 | * @return Status |
kevin1990 | 12:97457cf77bcb | 215 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 216 | * - #ADI_SENSE_NO_MEM Failed to allocate memory resources. |
kevin1990 | 12:97457cf77bcb | 217 | * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid device index specified |
kevin1990 | 12:97457cf77bcb | 218 | * |
kevin1990 | 12:97457cf77bcb | 219 | * @details Configure and initialise the Log interface and the SPI/GPIO |
kevin1990 | 12:97457cf77bcb | 220 | * communication interface to the ADISense module. |
kevin1990 | 12:97457cf77bcb | 221 | */ |
kevin1990 | 12:97457cf77bcb | 222 | ADI_SENSE_RESULT adi_sense_Open( |
kevin1990 | 12:97457cf77bcb | 223 | unsigned const nDeviceIndex, |
kevin1990 | 12:97457cf77bcb | 224 | ADI_SENSE_CONNECTION * const pConnectionInfo, |
kevin1990 | 12:97457cf77bcb | 225 | ADI_SENSE_DEVICE_HANDLE * const phDevice); |
kevin1990 | 12:97457cf77bcb | 226 | |
kevin1990 | 12:97457cf77bcb | 227 | /*! |
kevin1990 | 12:97457cf77bcb | 228 | * @brief Close ADI Sense device context and free resources. |
kevin1990 | 12:97457cf77bcb | 229 | * |
kevin1990 | 12:97457cf77bcb | 230 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 231 | * |
kevin1990 | 12:97457cf77bcb | 232 | * @return Status |
kevin1990 | 12:97457cf77bcb | 233 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 234 | */ |
kevin1990 | 12:97457cf77bcb | 235 | ADI_SENSE_RESULT adi_sense_Close( |
kevin1990 | 12:97457cf77bcb | 236 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 237 | |
kevin1990 | 12:97457cf77bcb | 238 | /*! |
kevin1990 | 12:97457cf77bcb | 239 | * @brief Get the current state of the specified GPIO input signal. |
kevin1990 | 12:97457cf77bcb | 240 | * |
kevin1990 | 12:97457cf77bcb | 241 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 242 | * @param[in] ePin GPIO pin to query |
kevin1990 | 12:97457cf77bcb | 243 | * @param[out] pbError Pointer to return the state of the status signal GPIO pin |
kevin1990 | 12:97457cf77bcb | 244 | * |
kevin1990 | 12:97457cf77bcb | 245 | * @return Status |
kevin1990 | 12:97457cf77bcb | 246 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 247 | * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified. |
kevin1990 | 12:97457cf77bcb | 248 | * |
kevin1990 | 12:97457cf77bcb | 249 | * @details Sets *pbAsserted to true if the status signal is asserted, or false |
kevin1990 | 12:97457cf77bcb | 250 | * otherwise. |
kevin1990 | 12:97457cf77bcb | 251 | */ |
kevin1990 | 12:97457cf77bcb | 252 | ADI_SENSE_RESULT adi_sense_GetGpioState( |
kevin1990 | 12:97457cf77bcb | 253 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 254 | ADI_SENSE_GPIO_PIN const ePinId, |
kevin1990 | 12:97457cf77bcb | 255 | bool_t * const pbAsserted); |
kevin1990 | 12:97457cf77bcb | 256 | |
kevin1990 | 12:97457cf77bcb | 257 | /*! |
kevin1990 | 12:97457cf77bcb | 258 | * @brief Register an application-defined callback function for GPIO interrupts |
kevin1990 | 12:97457cf77bcb | 259 | * |
kevin1990 | 12:97457cf77bcb | 260 | * @param[in] hDevice ADI Sense context handle (@ref adi_sense_Open) |
kevin1990 | 12:97457cf77bcb | 261 | * @param[in] ePin GPIO pin on which to enable/disable interrupts |
kevin1990 | 12:97457cf77bcb | 262 | * @param[in] callbackFunction Function to be called when an interrupt occurs. |
kevin1990 | 12:97457cf77bcb | 263 | * Specify NULL here to disable interrupts. |
kevin1990 | 12:97457cf77bcb | 264 | * @param[in] pCallbackParam Optional opaque parameter passed to the callback |
kevin1990 | 12:97457cf77bcb | 265 | * |
kevin1990 | 12:97457cf77bcb | 266 | * @return Status |
kevin1990 | 12:97457cf77bcb | 267 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 268 | * - #ADI_SENSE_INVALID_DEVICE_NUM Invalid GPIO pin specified. |
kevin1990 | 12:97457cf77bcb | 269 | */ |
kevin1990 | 12:97457cf77bcb | 270 | ADI_SENSE_RESULT adi_sense_RegisterGpioCallback( |
kevin1990 | 12:97457cf77bcb | 271 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 272 | ADI_SENSE_GPIO_PIN const ePinId, |
kevin1990 | 12:97457cf77bcb | 273 | ADI_SENSE_GPIO_CALLBACK const callbackFunction, |
kevin1990 | 12:97457cf77bcb | 274 | void * const pCallbackParam); |
kevin1990 | 12:97457cf77bcb | 275 | |
kevin1990 | 12:97457cf77bcb | 276 | /*! |
kevin1990 | 12:97457cf77bcb | 277 | * @brief Reset the ADI Sense device. |
kevin1990 | 12:97457cf77bcb | 278 | * |
kevin1990 | 12:97457cf77bcb | 279 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 280 | * |
kevin1990 | 12:97457cf77bcb | 281 | * @return Status |
kevin1990 | 12:97457cf77bcb | 282 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 283 | * |
kevin1990 | 12:97457cf77bcb | 284 | * @details Trigger a hardware-reset of the ADI Sense device. |
kevin1990 | 12:97457cf77bcb | 285 | * |
kevin1990 | 12:97457cf77bcb | 286 | * @note The device may require several seconds before it is ready for use |
kevin1990 | 12:97457cf77bcb | 287 | * again. @ref adi_sense_GetDeviceReadyState may be used to check if |
kevin1990 | 12:97457cf77bcb | 288 | * the device is ready. |
kevin1990 | 12:97457cf77bcb | 289 | */ |
kevin1990 | 12:97457cf77bcb | 290 | ADI_SENSE_RESULT adi_sense_Reset( |
kevin1990 | 12:97457cf77bcb | 291 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 292 | |
kevin1990 | 12:97457cf77bcb | 293 | /*! |
kevin1990 | 12:97457cf77bcb | 294 | * @brief Check if the device is ready, following power-up or a reset. |
kevin1990 | 12:97457cf77bcb | 295 | * |
kevin1990 | 12:97457cf77bcb | 296 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 297 | * @param[out] pbReady Pointer to return true if the device is ready, or false |
kevin1990 | 12:97457cf77bcb | 298 | * otherwise |
kevin1990 | 12:97457cf77bcb | 299 | * |
kevin1990 | 12:97457cf77bcb | 300 | * @return Status |
kevin1990 | 12:97457cf77bcb | 301 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 302 | * |
kevin1990 | 12:97457cf77bcb | 303 | * @details This function attempts to read a fixed-value device register via |
kevin1990 | 12:97457cf77bcb | 304 | * the communication interface. |
kevin1990 | 12:97457cf77bcb | 305 | */ |
kevin1990 | 12:97457cf77bcb | 306 | ADI_SENSE_RESULT adi_sense_GetDeviceReadyState( |
kevin1990 | 12:97457cf77bcb | 307 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 308 | bool_t * const pbReady); |
kevin1990 | 12:97457cf77bcb | 309 | |
kevin1990 | 12:97457cf77bcb | 310 | /*! |
kevin1990 | 12:97457cf77bcb | 311 | * @brief Obtain the product ID from the device. |
kevin1990 | 12:97457cf77bcb | 312 | * |
kevin1990 | 12:97457cf77bcb | 313 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 314 | * @param[out] pProductId Pointer to return the product ID value |
kevin1990 | 12:97457cf77bcb | 315 | * |
kevin1990 | 12:97457cf77bcb | 316 | * @return Status |
kevin1990 | 12:97457cf77bcb | 317 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 318 | * |
kevin1990 | 12:97457cf77bcb | 319 | * @details Reads the product ID registers on the device and returns the value. |
kevin1990 | 12:97457cf77bcb | 320 | */ |
kevin1990 | 12:97457cf77bcb | 321 | ADI_SENSE_RESULT adi_sense_GetProductID( |
kevin1990 | 12:97457cf77bcb | 322 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 323 | ADI_SENSE_PRODUCT_ID * const pProductId); |
kevin1990 | 12:97457cf77bcb | 324 | |
kevin1990 | 12:97457cf77bcb | 325 | /*! |
kevin1990 | 12:97457cf77bcb | 326 | * @brief Write full configuration settings to the device registers. |
kevin1990 | 12:97457cf77bcb | 327 | * |
kevin1990 | 12:97457cf77bcb | 328 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 329 | * @param[out] pConfig Pointer to the configuration data structure |
kevin1990 | 12:97457cf77bcb | 330 | * |
kevin1990 | 12:97457cf77bcb | 331 | * @return Status |
kevin1990 | 12:97457cf77bcb | 332 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 333 | * |
kevin1990 | 12:97457cf77bcb | 334 | * @details Translates configuration details provided into device-specific |
kevin1990 | 12:97457cf77bcb | 335 | * register settings and updates device configuration registers. |
kevin1990 | 12:97457cf77bcb | 336 | * |
kevin1990 | 12:97457cf77bcb | 337 | * @note Settings are not applied until adi_sense_ApplyConfigUpdates() is called |
kevin1990 | 12:97457cf77bcb | 338 | */ |
kevin1990 | 12:97457cf77bcb | 339 | ADI_SENSE_RESULT adi_sense_SetConfig( |
kevin1990 | 12:97457cf77bcb | 340 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 341 | ADI_SENSE_CONFIG * const pConfig); |
kevin1990 | 12:97457cf77bcb | 342 | |
kevin1990 | 12:97457cf77bcb | 343 | /*! |
kevin1990 | 12:97457cf77bcb | 344 | * @brief Apply the configuration settings currently stored in device registers |
kevin1990 | 12:97457cf77bcb | 345 | * |
kevin1990 | 12:97457cf77bcb | 346 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 347 | * |
kevin1990 | 12:97457cf77bcb | 348 | * @return Status |
kevin1990 | 12:97457cf77bcb | 349 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 350 | * |
kevin1990 | 12:97457cf77bcb | 351 | * @details Instructs the ADI Sense device to reload and apply configuration |
kevin1990 | 12:97457cf77bcb | 352 | * from the device configuration registers. Changes to configuration |
kevin1990 | 12:97457cf77bcb | 353 | * registers are ignored by the device until this function is called. |
kevin1990 | 12:97457cf77bcb | 354 | * |
kevin1990 | 12:97457cf77bcb | 355 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 356 | */ |
kevin1990 | 12:97457cf77bcb | 357 | ADI_SENSE_RESULT adi_sense_ApplyConfigUpdates( |
kevin1990 | 12:97457cf77bcb | 358 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 359 | |
kevin1990 | 12:97457cf77bcb | 360 | /*! |
kevin1990 | 12:97457cf77bcb | 361 | * @brief Store the configuration settings to persistent memory on the device. |
kevin1990 | 12:97457cf77bcb | 362 | * |
kevin1990 | 12:97457cf77bcb | 363 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 364 | * |
kevin1990 | 12:97457cf77bcb | 365 | * @return Status |
kevin1990 | 12:97457cf77bcb | 366 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 367 | * |
kevin1990 | 12:97457cf77bcb | 368 | * @details Instructs the ADI Sense device to save the current contents of its |
kevin1990 | 12:97457cf77bcb | 369 | * device configuration registers to non-volatile memory. |
kevin1990 | 12:97457cf77bcb | 370 | * |
kevin1990 | 12:97457cf77bcb | 371 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 372 | * @note Do not power down the device while this command is running. |
kevin1990 | 12:97457cf77bcb | 373 | */ |
kevin1990 | 12:97457cf77bcb | 374 | ADI_SENSE_RESULT adi_sense_SaveConfig( |
kevin1990 | 12:97457cf77bcb | 375 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 376 | |
kevin1990 | 12:97457cf77bcb | 377 | /*! |
kevin1990 | 12:97457cf77bcb | 378 | * @brief Restore configuration settings from persistent memory on the device. |
kevin1990 | 12:97457cf77bcb | 379 | * |
kevin1990 | 12:97457cf77bcb | 380 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 381 | * |
kevin1990 | 12:97457cf77bcb | 382 | * @return Status |
kevin1990 | 12:97457cf77bcb | 383 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 384 | * |
kevin1990 | 12:97457cf77bcb | 385 | * @details Instructs the ADI Sense device to restore the contents of its |
kevin1990 | 12:97457cf77bcb | 386 | * device configuration registers from non-volatile memory. |
kevin1990 | 12:97457cf77bcb | 387 | * |
kevin1990 | 12:97457cf77bcb | 388 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 389 | */ |
kevin1990 | 12:97457cf77bcb | 390 | ADI_SENSE_RESULT adi_sense_RestoreConfig( |
kevin1990 | 12:97457cf77bcb | 391 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 392 | |
kevin1990 | 12:97457cf77bcb | 393 | /*! |
kevin1990 | 12:97457cf77bcb | 394 | * @brief Store the LUT data to persistent memory on the device. |
kevin1990 | 12:97457cf77bcb | 395 | * |
kevin1990 | 12:97457cf77bcb | 396 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 397 | * |
kevin1990 | 12:97457cf77bcb | 398 | * @return Status |
kevin1990 | 12:97457cf77bcb | 399 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 400 | * |
kevin1990 | 12:97457cf77bcb | 401 | * @details Instructs the ADI Sense device to save the current contents of its |
kevin1990 | 12:97457cf77bcb | 402 | * LUT data buffer, set using @ref adi_sense_SetLutData(), to |
kevin1990 | 12:97457cf77bcb | 403 | * non-volatile memory. |
kevin1990 | 12:97457cf77bcb | 404 | * |
kevin1990 | 12:97457cf77bcb | 405 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 406 | * @note Do not power down the device while this command is running. |
kevin1990 | 12:97457cf77bcb | 407 | */ |
kevin1990 | 12:97457cf77bcb | 408 | ADI_SENSE_RESULT adi_sense_SaveLutData( |
kevin1990 | 12:97457cf77bcb | 409 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 410 | |
kevin1990 | 12:97457cf77bcb | 411 | /*! |
kevin1990 | 12:97457cf77bcb | 412 | * @brief Restore LUT data from persistent memory on the device. |
kevin1990 | 12:97457cf77bcb | 413 | * |
kevin1990 | 12:97457cf77bcb | 414 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 415 | * |
kevin1990 | 12:97457cf77bcb | 416 | * @return Status |
kevin1990 | 12:97457cf77bcb | 417 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 418 | * |
kevin1990 | 12:97457cf77bcb | 419 | * @details Instructs the ADI Sense device to restore the contents of its |
kevin1990 | 12:97457cf77bcb | 420 | * LUT data, previously stored with @ref adi_sense_SaveLutData, from |
kevin1990 | 12:97457cf77bcb | 421 | * non-volatile memory. |
kevin1990 | 12:97457cf77bcb | 422 | * |
kevin1990 | 12:97457cf77bcb | 423 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 424 | */ |
kevin1990 | 12:97457cf77bcb | 425 | ADI_SENSE_RESULT adi_sense_RestoreLutData( |
kevin1990 | 12:97457cf77bcb | 426 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 427 | |
kevin1990 | 12:97457cf77bcb | 428 | /*! |
kevin1990 | 12:97457cf77bcb | 429 | * @brief Start the measurement cycles on the device. |
kevin1990 | 12:97457cf77bcb | 430 | * |
kevin1990 | 12:97457cf77bcb | 431 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 432 | * @param[in] bHealthCheckMode If true, runs a special health-check measurement |
kevin1990 | 12:97457cf77bcb | 433 | * cycle, carrying out a single conversion per |
kevin1990 | 12:97457cf77bcb | 434 | * channel with measurement diagnostics enabled, |
kevin1990 | 12:97457cf77bcb | 435 | * intended for use as a system health check. |
kevin1990 | 12:97457cf77bcb | 436 | * |
kevin1990 | 12:97457cf77bcb | 437 | * @return Status |
kevin1990 | 12:97457cf77bcb | 438 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 439 | * |
kevin1990 | 12:97457cf77bcb | 440 | * @details Instructs the ADI Sense device to start executing measurement cycles |
kevin1990 | 12:97457cf77bcb | 441 | * according to the current applied configuration settings. The |
kevin1990 | 12:97457cf77bcb | 442 | * DATAREADY status signal will be asserted whenever new measurement |
kevin1990 | 12:97457cf77bcb | 443 | * data is published, according to selected settings. |
kevin1990 | 12:97457cf77bcb | 444 | * Measurement cycles may be stopped by calling @ref |
kevin1990 | 12:97457cf77bcb | 445 | * adi_sense_StopMeasurement. |
kevin1990 | 12:97457cf77bcb | 446 | * |
kevin1990 | 12:97457cf77bcb | 447 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 448 | */ |
kevin1990 | 12:97457cf77bcb | 449 | ADI_SENSE_RESULT adi_sense_StartMeasurement( |
kevin1990 | 12:97457cf77bcb | 450 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 451 | bool_t const bHealthCheckMode); |
kevin1990 | 12:97457cf77bcb | 452 | |
kevin1990 | 12:97457cf77bcb | 453 | /*! |
kevin1990 | 12:97457cf77bcb | 454 | * @brief Stop the measurement cycles on the device. |
kevin1990 | 12:97457cf77bcb | 455 | * |
kevin1990 | 12:97457cf77bcb | 456 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 457 | * |
kevin1990 | 12:97457cf77bcb | 458 | * @return Status |
kevin1990 | 12:97457cf77bcb | 459 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 460 | * |
kevin1990 | 12:97457cf77bcb | 461 | * @details Instructs the ADI Sense device to stop executing measurement cycles. |
kevin1990 | 12:97457cf77bcb | 462 | * The command may be delayed until the current conversion, if any, has |
kevin1990 | 12:97457cf77bcb | 463 | * been completed and published. |
kevin1990 | 12:97457cf77bcb | 464 | * |
kevin1990 | 12:97457cf77bcb | 465 | * @note To be used only if a measurement command is currently running. |
kevin1990 | 12:97457cf77bcb | 466 | */ |
kevin1990 | 12:97457cf77bcb | 467 | ADI_SENSE_RESULT adi_sense_StopMeasurement( |
kevin1990 | 12:97457cf77bcb | 468 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 469 | |
kevin1990 | 12:97457cf77bcb | 470 | /*! |
kevin1990 | 12:97457cf77bcb | 471 | * @brief Run built-in diagnostic checks on the device. |
kevin1990 | 12:97457cf77bcb | 472 | * |
kevin1990 | 12:97457cf77bcb | 473 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 474 | * |
kevin1990 | 12:97457cf77bcb | 475 | * @return Status |
kevin1990 | 12:97457cf77bcb | 476 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 477 | * |
kevin1990 | 12:97457cf77bcb | 478 | * @details Instructs the ADI Sense device to execute its built-in diagnostic |
kevin1990 | 12:97457cf77bcb | 479 | * tests, on any enabled measurement channels, according to the current |
kevin1990 | 12:97457cf77bcb | 480 | * applied configuration settings. Device status registers will be |
kevin1990 | 12:97457cf77bcb | 481 | * updated to indicate if any errors were detected by the diagnostics. |
kevin1990 | 12:97457cf77bcb | 482 | * |
kevin1990 | 12:97457cf77bcb | 483 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 484 | */ |
kevin1990 | 12:97457cf77bcb | 485 | ADI_SENSE_RESULT adi_sense_RunDiagnostics( |
kevin1990 | 12:97457cf77bcb | 486 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 487 | |
kevin1990 | 12:97457cf77bcb | 488 | /*! |
kevin1990 | 12:97457cf77bcb | 489 | * @brief Run built-in calibration on the device. |
kevin1990 | 12:97457cf77bcb | 490 | * |
kevin1990 | 12:97457cf77bcb | 491 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 492 | * |
kevin1990 | 12:97457cf77bcb | 493 | * @return Status |
kevin1990 | 12:97457cf77bcb | 494 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 495 | * |
kevin1990 | 12:97457cf77bcb | 496 | * @details Instructs the ADI Sense device to execute its self-calibration |
kevin1990 | 12:97457cf77bcb | 497 | * routines, on any enabled measurement channels, according to the |
kevin1990 | 12:97457cf77bcb | 498 | * current applied configuration settings. Device status registers |
kevin1990 | 12:97457cf77bcb | 499 | * will be updated to indicate if any errors were detected. |
kevin1990 | 12:97457cf77bcb | 500 | * |
kevin1990 | 12:97457cf77bcb | 501 | * @note No other command must be running when this is called. |
kevin1990 | 12:97457cf77bcb | 502 | */ |
kevin1990 | 12:97457cf77bcb | 503 | ADI_SENSE_RESULT adi_sense_RunCalibration( |
kevin1990 | 12:97457cf77bcb | 504 | ADI_SENSE_DEVICE_HANDLE const hDevice); |
kevin1990 | 12:97457cf77bcb | 505 | |
kevin1990 | 12:97457cf77bcb | 506 | /*! |
kevin1990 | 12:97457cf77bcb | 507 | * @brief Read the current status from the device registers. |
kevin1990 | 12:97457cf77bcb | 508 | * |
kevin1990 | 12:97457cf77bcb | 509 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 510 | * @param[out] pStatus Pointer to return the status summary obtained from the |
kevin1990 | 12:97457cf77bcb | 511 | * device. |
kevin1990 | 12:97457cf77bcb | 512 | * |
kevin1990 | 12:97457cf77bcb | 513 | * @return Status |
kevin1990 | 12:97457cf77bcb | 514 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 515 | * |
kevin1990 | 12:97457cf77bcb | 516 | * @details Reads the status registers and extracts the relevant information |
kevin1990 | 12:97457cf77bcb | 517 | * to return to the caller. |
kevin1990 | 12:97457cf77bcb | 518 | * |
kevin1990 | 12:97457cf77bcb | 519 | * @note This may be called at any time, assuming the device is ready. |
kevin1990 | 12:97457cf77bcb | 520 | */ |
kevin1990 | 12:97457cf77bcb | 521 | ADI_SENSE_RESULT adi_sense_GetStatus( |
kevin1990 | 12:97457cf77bcb | 522 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 523 | ADI_SENSE_STATUS * const pStatus); |
kevin1990 | 12:97457cf77bcb | 524 | |
kevin1990 | 12:97457cf77bcb | 525 | /*! |
kevin1990 | 12:97457cf77bcb | 526 | * @brief Read measurement data samples from the device registers. |
kevin1990 | 12:97457cf77bcb | 527 | * |
kevin1990 | 12:97457cf77bcb | 528 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 529 | * @param[out] pSamples Pointer to return a set of requested data samples. |
kevin1990 | 12:97457cf77bcb | 530 | * @param[in] nRequested Number of requested data samples. |
kevin1990 | 12:97457cf77bcb | 531 | * @param[out] pnReturned Number of valid data samples successfully retrieved. |
kevin1990 | 12:97457cf77bcb | 532 | * |
kevin1990 | 12:97457cf77bcb | 533 | * @return Status |
kevin1990 | 12:97457cf77bcb | 534 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 535 | * |
kevin1990 | 12:97457cf77bcb | 536 | * @details Reads the status registers and extracts the relevant information |
kevin1990 | 12:97457cf77bcb | 537 | * to return to the caller. |
kevin1990 | 12:97457cf77bcb | 538 | * |
kevin1990 | 12:97457cf77bcb | 539 | * @note This is intended to be called only when the DATAREADY status signal |
kevin1990 | 12:97457cf77bcb | 540 | * is asserted. |
kevin1990 | 12:97457cf77bcb | 541 | */ |
kevin1990 | 12:97457cf77bcb | 542 | ADI_SENSE_RESULT adi_sense_GetData( |
kevin1990 | 12:97457cf77bcb | 543 | ADI_SENSE_DEVICE_HANDLE const hDevice, |
kevin1990 | 12:97457cf77bcb | 544 | ADI_SENSE_DATA_SAMPLE * const pSamples, |
kevin1990 | 12:97457cf77bcb | 545 | uint32_t const nRequested, |
kevin1990 | 12:97457cf77bcb | 546 | uint32_t * const pnReturned); |
kevin1990 | 12:97457cf77bcb | 547 | |
kevin1990 | 12:97457cf77bcb | 548 | /*! |
kevin1990 | 12:97457cf77bcb | 549 | * @brief Check if a command is currently running on the device. |
kevin1990 | 12:97457cf77bcb | 550 | * |
kevin1990 | 12:97457cf77bcb | 551 | * @param[in] hDevice ADI Sense device context handle |
kevin1990 | 12:97457cf77bcb | 552 | * @param[out] pbCommandRunning Pointer to return the command running status |
kevin1990 | 12:97457cf77bcb | 553 | * |
kevin1990 | 12:97457cf77bcb | 554 | * @return Status |
kevin1990 | 12:97457cf77bcb | 555 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
kevin1990 | 12:97457cf77bcb | 556 | * |
kevin1990 | 12:97457cf77bcb | 557 | * @details Reads the device status register to check if a command is running. |
kevin1990 | 12:97457cf77bcb | 558 | */ |
kevin1990 | 12:97457cf77bcb | 559 | ADI_SENSE_RESULT adi_sense_GetCommandRunningState( |
kevin1990 | 12:97457cf77bcb | 560 | ADI_SENSE_DEVICE_HANDLE hDevice, |
kevin1990 | 12:97457cf77bcb | 561 | bool_t *pbCommandRunning); |
kevin1990 | 12:97457cf77bcb | 562 | |
kevin1990 | 12:97457cf77bcb | 563 | #ifdef __cplusplus |
kevin1990 | 12:97457cf77bcb | 564 | } |
kevin1990 | 12:97457cf77bcb | 565 | #endif |
kevin1990 | 12:97457cf77bcb | 566 | |
kevin1990 | 12:97457cf77bcb | 567 | /*! |
kevin1990 | 12:97457cf77bcb | 568 | * @} |
kevin1990 | 12:97457cf77bcb | 569 | */ |
kevin1990 | 12:97457cf77bcb | 570 | |
kevin1990 | 12:97457cf77bcb | 571 | #endif /* __ADI_SENSE_API_H__ */ |
kevin1990 | 12:97457cf77bcb | 572 |