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