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