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