Mbed Development branch for MeasrueWare

Committer:
Vkadaba
Date:
Thu Jul 25 06:38:45 2019 +0000
Revision:
13:97cb32670539
Parent:
6:9d393a9677f4
Child:
14:266ab283b086
admw1001.c file is updated ; ; config version changed to 2.0 from 1.7

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ADIJake 0:85855ecd3257 1 /*
Vkadaba 6:9d393a9677f4 2 Copyright 2019 (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
Vkadaba 6:9d393a9677f4 36 /*!
ADIJake 0:85855ecd3257 37 ******************************************************************************
Vkadaba 5:0728bde67bdb 38 * @file: admw_api.h
Vkadaba 5:0728bde67bdb 39 * @brief: ADMW Host Library Application Programming Interface (API)
ADIJake 0:85855ecd3257 40 *-----------------------------------------------------------------------------
ADIJake 0:85855ecd3257 41 */
ADIJake 0:85855ecd3257 42
Vkadaba 6:9d393a9677f4 43 #ifndef _ADMW_API_H__
Vkadaba 6:9d393a9677f4 44 #define _ADMW_API_H__
ADIJake 0:85855ecd3257 45
Vkadaba 5:0728bde67bdb 46 #include "inc/admw_types.h"
Vkadaba 5:0728bde67bdb 47 #include "inc/admw_config_types.h"
Vkadaba 5:0728bde67bdb 48 #include "inc/admw_platform.h"
Vkadaba 5:0728bde67bdb 49 #include "inc/admw_gpio.h"
Vkadaba 5:0728bde67bdb 50 #include "inc/admw_spi.h"
Vkadaba 5:0728bde67bdb 51 #include "inc/admw_log.h"
Vkadaba 5:0728bde67bdb 52 #include "inc/admw_time.h"
ADIJake 0:85855ecd3257 53
Vkadaba 5:0728bde67bdb 54 /*! @defgroup ADMW_Api ADMW Host Library API
Vkadaba 5:0728bde67bdb 55 * Host library API common to the ADMW 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
Vkadaba 5:0728bde67bdb 64 * @note Specific ADMW products may implement a lower number of channels */
Vkadaba 5:0728bde67bdb 65 #define ADMW_MAX_CHANNELS 16
ADIJake 0:85855ecd3257 66
Vkadaba 5:0728bde67bdb 67 /*! A handle used in all API functions to identify the ADMW device. */
Vkadaba 13:97cb32670539 68
Vkadaba 5:0728bde67bdb 69 typedef void* ADMW_DEVICE_HANDLE;
Vkadaba 13:97cb32670539 70 #define SPI_BUFFER_SIZE 100u
Vkadaba 13:97cb32670539 71
Vkadaba 13:97cb32670539 72 #define SFL_READ_STATUS_HDR_SIZE 14u
Vkadaba 13:97cb32670539 73
Vkadaba 13:97cb32670539 74 #define SFL_READ_STATUS_RESPONSE_SIZE 42u
ADIJake 0:85855ecd3257 75
Vkadaba 5:0728bde67bdb 76 /*! Supported connection types for communication with the ADMW device. */
ADIJake 0:85855ecd3257 77 typedef enum {
Vkadaba 5:0728bde67bdb 78 ADMW_CONNECTION_TYPE_SPI = 1,
ADIJake 0:85855ecd3257 79 /*!< Serial Peripheral Interface (SPI) connection type */
Vkadaba 5:0728bde67bdb 80 } ADMW_CONNECTION_TYPE;
ADIJake 0:85855ecd3257 81
Vkadaba 5:0728bde67bdb 82 /*! Connection details for communication with a ADMW device instance. */
ADIJake 0:85855ecd3257 83 typedef struct {
Vkadaba 5:0728bde67bdb 84 ADMW_CONNECTION_TYPE type;
ADIJake 0:85855ecd3257 85 /*!< Connection type selection */
Vkadaba 5:0728bde67bdb 86 ADMW_PLATFORM_SPI_CONFIG spi;
ADIJake 0:85855ecd3257 87 /*!< SPI connection parameters, required if SPI connection type is used */
Vkadaba 5:0728bde67bdb 88 ADMW_PLATFORM_GPIO_CONFIG gpio;
ADIJake 0:85855ecd3257 89 /*!< GPIO connection parameters, for device reset and status I/O signals */
Vkadaba 5:0728bde67bdb 90 ADMW_PLATFORM_LOG_CONFIG log;
ADIJake 0:85855ecd3257 91 /*!< Log interface connection parameters, for display/routing of log messages */
Vkadaba 5:0728bde67bdb 92 } ADMW_CONNECTION;
ADIJake 0:85855ecd3257 93
ADIJake 0:85855ecd3257 94 /*! Bit masks (flags) for the different device status indicators. */
ADIJake 0:85855ecd3257 95 typedef enum {
Vkadaba 5:0728bde67bdb 96 ADMW_DEVICE_STATUS_BUSY = (1 << 0),
ADIJake 0:85855ecd3257 97 /*!< Indicates that a command is currently running on the device */
Vkadaba 5:0728bde67bdb 98 ADMW_DEVICE_STATUS_DATAREADY = (1 << 1),
ADIJake 0:85855ecd3257 99 /*!< Indicates the availability of measurement data for retrieval */
Vkadaba 5:0728bde67bdb 100 ADMW_DEVICE_STATUS_ERROR = (1 << 2),
ADIJake 0:85855ecd3257 101 /*!< Indicates that an error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 102 ADMW_DEVICE_STATUS_ALERT = (1 << 3),
ADIJake 0:85855ecd3257 103 /*!< Indicates that an alert condition has been detected by the device */
Vkadaba 5:0728bde67bdb 104 ADMW_DEVICE_STATUS_FIFO_ERROR = (1 << 4),
ADIJake 0:85855ecd3257 105 /*!< Indicates that a FIFO error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 106 ADMW_DEVICE_STATUS_CONFIG_ERROR = (1 << 5),
ADIJake 0:85855ecd3257 107 /*!< Indicates that a configuration error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 108 ADMW_DEVICE_STATUS_LUT_ERROR = (1 << 6),
ADIJake 0:85855ecd3257 109 /*!< Indicates that a look-up table error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 110 } ADMW_DEVICE_STATUS_FLAGS;
ADIJake 0:85855ecd3257 111
ADIJake 0:85855ecd3257 112 /*! Bit masks (flags) for the different diagnostics status indicators. */
ADIJake 0:85855ecd3257 113 typedef enum {
Vkadaba 5:0728bde67bdb 114 ADMW_DIAGNOSTICS_STATUS_CHECKSUM_ERROR = (1 << 0),
ADIJake 0:85855ecd3257 115 /*!< Indicates Error on Internal Checksum Calculations */
Vkadaba 5:0728bde67bdb 116 ADMW_DIAGNOSTICS_STATUS_CONVERSION_ERROR = (1 << 8),
ADIJake 0:85855ecd3257 117 /*!< Indicates Error During Internal ADC Conversions */
Vkadaba 5:0728bde67bdb 118 ADMW_DIAGNOSTICS_STATUS_CALIBRATION_ERROR = (1 << 9),
ADIJake 0:85855ecd3257 119 /*!< Indicates Error During Internal Device Calibrations */
Vkadaba 5:0728bde67bdb 120 } ADMW_DIAGNOSTICS_STATUS_FLAGS;
ADIJake 0:85855ecd3257 121
ADIJake 0:85855ecd3257 122 /*! Bit masks (flags) for the different channel alert indicators. */
ADIJake 0:85855ecd3257 123 typedef enum {
Vkadaba 5:0728bde67bdb 124 ADMW_CHANNEL_ALERT_TIMEOUT = (1 << 0),
ADIJake 0:85855ecd3257 125 /*!< Indicates timeout condition detected on the channel */
Vkadaba 5:0728bde67bdb 126 ADMW_CHANNEL_ALERT_UNDER_RANGE = (1 << 1),
ADIJake 0:85855ecd3257 127 /*!< Indicates raw sample under valid input range, possibly clamped */
Vkadaba 5:0728bde67bdb 128 ADMW_CHANNEL_ALERT_OVER_RANGE = (1 << 2),
ADIJake 0:85855ecd3257 129 /*!< Indicates raw sample over valid input range, possibly clamped */
Vkadaba 5:0728bde67bdb 130 ADMW_CHANNEL_ALERT_LOW_LIMIT = (1 << 3),
ADIJake 0:85855ecd3257 131 /*!< Indicates measurement result was below configured minimum threshold */
Vkadaba 5:0728bde67bdb 132 ADMW_CHANNEL_ALERT_HIGH_LIMIT = (1 << 4),
ADIJake 0:85855ecd3257 133 /*!< Indicates measurement result was above configured maximum threshold */
Vkadaba 5:0728bde67bdb 134 ADMW_CHANNEL_ALERT_SENSOR_OPEN = (1 << 5),
ADIJake 0:85855ecd3257 135 /*!< Indicates open circuit or mis-wire condition detected on the channel */
Vkadaba 5:0728bde67bdb 136 ADMW_CHANNEL_ALERT_REF_DETECT = (1 << 6),
ADIJake 0:85855ecd3257 137 /*!< Indicates reference-detect error condition detected on the channel */
Vkadaba 5:0728bde67bdb 138 ADMW_CHANNEL_ALERT_CONFIG_ERR = (1 << 7),
ADIJake 0:85855ecd3257 139 /*!< Indicates configuration error condition detected on the channel */
Vkadaba 5:0728bde67bdb 140 ADMW_CHANNEL_ALERT_LUT_ERR = (1 << 8),
ADIJake 0:85855ecd3257 141 /*!< Indicates look-up table error condition detected on the channel */
Vkadaba 5:0728bde67bdb 142 ADMW_CHANNEL_ALERT_SENSOR_NOT_READY = (1 << 9),
ADIJake 0:85855ecd3257 143 /*!< Indicates digital sensor not-ready error condition detected on the channel */
Vkadaba 5:0728bde67bdb 144 ADMW_CHANNEL_ALERT_COMP_NOT_READY = (1 << 10),
ADIJake 0:85855ecd3257 145 /*!< Indicates compensation channel not-ready error condition detected on the channel */
Vkadaba 5:0728bde67bdb 146 ADMW_CHANNEL_ALERT_LUT_UNDER_RANGE = (1 << 13),
ADIJake 0:85855ecd3257 147 /*!< Indicates raw sample was under the available LUT/equation range */
Vkadaba 5:0728bde67bdb 148 ADMW_CHANNEL_ALERT_LUT_OVER_RANGE = (1 << 14),
ADIJake 0:85855ecd3257 149 /*!< Indicates raw sample was over the available LUT/equation range */
Vkadaba 5:0728bde67bdb 150 } ADMW_CHANNEL_ALERT_FLAGS;
ADIJake 0:85855ecd3257 151
Vkadaba 5:0728bde67bdb 152 /*! Status details retreived from the ADMW device. */
ADIJake 0:85855ecd3257 153 typedef struct {
Vkadaba 5:0728bde67bdb 154 ADMW_DEVICE_STATUS_FLAGS deviceStatus;
ADIJake 0:85855ecd3257 155 /*!< General summary status information from the device */
Vkadaba 5:0728bde67bdb 156 ADMW_DIAGNOSTICS_STATUS_FLAGS diagnosticsStatus;
ADIJake 0:85855ecd3257 157 /*!< Diagnostic error status information from the device */
Vkadaba 5:0728bde67bdb 158 ADMW_CHANNEL_ALERT_FLAGS channelAlerts[ADMW_MAX_CHANNELS];
ADIJake 0:85855ecd3257 159 /*!< Per-channel alert status information from the device */
ADIJake 0:85855ecd3257 160 uint32_t errorCode;
ADIJake 0:85855ecd3257 161 /*!< Code identifying the last error signalled by the device */
ADIJake 0:85855ecd3257 162 uint32_t alertCode;
ADIJake 0:85855ecd3257 163 /*!< Code identifying the last alert signalled by the device */
ADIJake 0:85855ecd3257 164 uint32_t debugCode;
ADIJake 0:85855ecd3257 165 /*!< Supplementary code related to the last error/alert */
Vkadaba 5:0728bde67bdb 166 uint32_t channelAlertCodes[ADMW_MAX_CHANNELS];
ADIJake 0:85855ecd3257 167 /*!< Per-channel code identifying the last alert signalled for each channel */
Vkadaba 5:0728bde67bdb 168 } ADMW_STATUS;
ADIJake 0:85855ecd3257 169
Vkadaba 5:0728bde67bdb 170 /*! Data sample details retreived from the ADMW device. */
ADIJake 0:85855ecd3257 171 typedef struct {
Vkadaba 5:0728bde67bdb 172 ADMW_DEVICE_STATUS_FLAGS status;
ADIJake 0:85855ecd3257 173 /*!< Device summary status snapshot when the sample was recorded */
ADIJake 0:85855ecd3257 174 uint32_t channelId;
ADIJake 0:85855ecd3257 175 /*!< The measurement channel from which this sample was obtained */
Vkadaba 6:9d393a9677f4 176 uint32_t rawValue;
ADIJake 0:85855ecd3257 177 /*!< The raw (unprocessed) value obtained directly from the measurement
ADIJake 0:85855ecd3257 178 * channel, if available
ADIJake 0:85855ecd3257 179 */
ADIJake 0:85855ecd3257 180 float32_t processedValue;
ADIJake 0:85855ecd3257 181 /*!< The processed value obtained from the measurement channel, as a final
ADIJake 0:85855ecd3257 182 * measurement value, following calibration and linearisation correction,
ADIJake 0:85855ecd3257 183 * and conversion into an appropriate unit of measurement.
ADIJake 0:85855ecd3257 184 */
Vkadaba 5:0728bde67bdb 185 } ADMW_DATA_SAMPLE;
ADIJake 0:85855ecd3257 186
Vkadaba 5:0728bde67bdb 187 /*! Measurement mode options for the ADMW device.
Vkadaba 5:0728bde67bdb 188 * @ref admw_StartMeasurement
ADIJake 0:85855ecd3257 189 */
ADIJake 0:85855ecd3257 190 typedef enum {
Vkadaba 6:9d393a9677f4 191 ADMW_MEASUREMENT_MODE_NORMAL = 0,
ADIJake 0:85855ecd3257 192 /*!< In this mode, normal measurement cycle(s) are executed and data samples
ADIJake 0:85855ecd3257 193 * are returned with raw measurement values included. */
Vkadaba 5:0728bde67bdb 194 ADMW_MEASUREMENT_MODE_OMIT_RAW,
ADIJake 0:85855ecd3257 195 /*!< In this mode, normal measurement cycle(s) are executed and data samples
ADIJake 0:85855ecd3257 196 * are returned with raw measurement values omitted for efficiency. */
Vkadaba 5:0728bde67bdb 197 } ADMW_MEASUREMENT_MODE;
ADIJake 0:85855ecd3257 198
ADIJake 0:85855ecd3257 199 /*! Identifiers for the user configuration slots in persistent memory. */
ADIJake 0:85855ecd3257 200 typedef enum {
Vkadaba 5:0728bde67bdb 201 ADMW_FLASH_CONFIG_1,
Vkadaba 5:0728bde67bdb 202 } ADMW_USER_CONFIG_SLOT;
ADIJake 0:85855ecd3257 203
ADIJake 0:85855ecd3257 204
ADIJake 0:85855ecd3257 205 /******************************************************************************
Vkadaba 5:0728bde67bdb 206 * ADMW High-Level API function prototypes
ADIJake 0:85855ecd3257 207 *****************************************************************************/
ADIJake 0:85855ecd3257 208
ADIJake 0:85855ecd3257 209 /*!
Vkadaba 5:0728bde67bdb 210 * @brief Open ADMW device handle and set up communication interface.
ADIJake 0:85855ecd3257 211 *
ADIJake 0:85855ecd3257 212 * @param[in] nDeviceIndex Zero-based index number identifying this device
ADIJake 0:85855ecd3257 213 * instance. Note that this will be used to
ADIJake 0:85855ecd3257 214 * retrieve a specific device configuration for
Vkadaba 5:0728bde67bdb 215 * this device (see @ref admw_SetConfig
Vkadaba 5:0728bde67bdb 216 * and @ref ADMW_CONFIG)
ADIJake 0:85855ecd3257 217 * @param[in] pConnectionInfo Host-specific connection details (e.g. SPI, GPIO)
Vkadaba 5:0728bde67bdb 218 * @param[out] phDevice Pointer to return an ADMW device handle
ADIJake 0:85855ecd3257 219 *
ADIJake 0:85855ecd3257 220 * @return Status
Vkadaba 5:0728bde67bdb 221 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 222 * - #ADMW_NO_MEM Failed to allocate memory resources.
Vkadaba 5:0728bde67bdb 223 * - #ADMW_INVALID_DEVICE_NUM Invalid device index specified
ADIJake 0:85855ecd3257 224 *
ADIJake 0:85855ecd3257 225 * @details Configure and initialise the Log interface and the SPI/GPIO
Vkadaba 6:9d393a9677f4 226 * communication interface to the ADISense module.
ADIJake 0:85855ecd3257 227 */
Vkadaba 5:0728bde67bdb 228 ADMW_RESULT admw_Open(
ADIJake 0:85855ecd3257 229 unsigned const nDeviceIndex,
Vkadaba 5:0728bde67bdb 230 ADMW_CONNECTION * const pConnectionInfo,
Vkadaba 5:0728bde67bdb 231 ADMW_DEVICE_HANDLE * const phDevice);
ADIJake 0:85855ecd3257 232
ADIJake 0:85855ecd3257 233 /*!
Vkadaba 5:0728bde67bdb 234 * @brief Close ADMW device context and free resources.
ADIJake 0:85855ecd3257 235 *
Vkadaba 5:0728bde67bdb 236 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 237 *
ADIJake 0:85855ecd3257 238 * @return Status
Vkadaba 5:0728bde67bdb 239 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 240 */
Vkadaba 5:0728bde67bdb 241 ADMW_RESULT admw_Close(
Vkadaba 5:0728bde67bdb 242 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 243
ADIJake 0:85855ecd3257 244 /*!
ADIJake 0:85855ecd3257 245 * @brief Get the current state of the specified GPIO input signal.
ADIJake 0:85855ecd3257 246 *
Vkadaba 5:0728bde67bdb 247 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 248 * @param[in] ePinId GPIO pin to query
ADIJake 0:85855ecd3257 249 * @param[out] pbAsserted Pointer to return the state of the status signal GPIO pin
ADIJake 0:85855ecd3257 250 *
ADIJake 0:85855ecd3257 251 * @return Status
Vkadaba 5:0728bde67bdb 252 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 253 * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified.
ADIJake 0:85855ecd3257 254 *
ADIJake 0:85855ecd3257 255 * @details Sets *pbAsserted to true if the status signal is asserted, or false
ADIJake 0:85855ecd3257 256 * otherwise.
ADIJake 0:85855ecd3257 257 */
Vkadaba 5:0728bde67bdb 258 ADMW_RESULT admw_GetGpioState(
Vkadaba 5:0728bde67bdb 259 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 260 ADMW_GPIO_PIN const ePinId,
ADIJake 0:85855ecd3257 261 bool * const pbAsserted);
ADIJake 0:85855ecd3257 262
ADIJake 0:85855ecd3257 263 /*!
ADIJake 0:85855ecd3257 264 * @brief Register an application-defined callback function for GPIO interrupts
ADIJake 0:85855ecd3257 265 *
Vkadaba 5:0728bde67bdb 266 * @param[in] hDevice ADMW context handle (@ref admw_Open)
ADIJake 0:85855ecd3257 267 * @param[in] ePinId GPIO pin on which to enable/disable interrupts
ADIJake 0:85855ecd3257 268 * @param[in] callbackFunction Function to be called when an interrupt occurs.
ADIJake 0:85855ecd3257 269 * Specify NULL here to disable interrupts.
ADIJake 0:85855ecd3257 270 * @param[in] pCallbackParam Optional opaque parameter passed to the callback
ADIJake 0:85855ecd3257 271 *
ADIJake 0:85855ecd3257 272 * @return Status
Vkadaba 5:0728bde67bdb 273 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 274 * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified.
ADIJake 0:85855ecd3257 275 */
Vkadaba 5:0728bde67bdb 276 ADMW_RESULT admw_RegisterGpioCallback(
Vkadaba 5:0728bde67bdb 277 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 278 ADMW_GPIO_PIN const ePinId,
Vkadaba 5:0728bde67bdb 279 ADMW_GPIO_CALLBACK const callbackFunction,
ADIJake 0:85855ecd3257 280 void * const pCallbackParam);
ADIJake 0:85855ecd3257 281
ADIJake 0:85855ecd3257 282 /*!
ADIJake 0:85855ecd3257 283 * @brief Trigger a shut down of the device.
ADIJake 0:85855ecd3257 284 *
Vkadaba 5:0728bde67bdb 285 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 286 *
ADIJake 0:85855ecd3257 287 * @return Status
Vkadaba 5:0728bde67bdb 288 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 289 *
Vkadaba 5:0728bde67bdb 290 * @details Instructs the ADMW device to initiate a shut down,
ADIJake 0:85855ecd3257 291 * typically used to conserve power when the device is not
ADIJake 0:85855ecd3257 292 * in use. The device may be restarted by calling
Vkadaba 5:0728bde67bdb 293 * @ref admw_Reset(). Note that active configuration
ADIJake 0:85855ecd3257 294 * settings are not preserved during shutdown and must be
ADIJake 0:85855ecd3257 295 * reloaded after the device has become ready again.
ADIJake 0:85855ecd3257 296 *
ADIJake 0:85855ecd3257 297 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 298 */
Vkadaba 5:0728bde67bdb 299 ADMW_RESULT admw_Shutdown(
Vkadaba 5:0728bde67bdb 300 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 301
ADIJake 0:85855ecd3257 302 /*!
Vkadaba 5:0728bde67bdb 303 * @brief Reset the ADMW device.
ADIJake 0:85855ecd3257 304 *
Vkadaba 5:0728bde67bdb 305 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 306 *
ADIJake 0:85855ecd3257 307 * @return Status
Vkadaba 5:0728bde67bdb 308 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 309 *
Vkadaba 5:0728bde67bdb 310 * @details Trigger a hardware-reset of the ADMW device.
ADIJake 0:85855ecd3257 311 *
ADIJake 0:85855ecd3257 312 * @note The device may require several seconds before it is ready for use
Vkadaba 5:0728bde67bdb 313 * again. @ref admw_GetDeviceReadyState may be used to check if
ADIJake 0:85855ecd3257 314 * the device is ready.
ADIJake 0:85855ecd3257 315 */
Vkadaba 5:0728bde67bdb 316 ADMW_RESULT admw_Reset(
Vkadaba 5:0728bde67bdb 317 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 318
ADIJake 0:85855ecd3257 319 /*!
ADIJake 0:85855ecd3257 320 * @brief Check if the device is ready, following power-up or a reset.
ADIJake 0:85855ecd3257 321 *
Vkadaba 5:0728bde67bdb 322 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 323 * @param[out] pbReady Pointer to return true if the device is ready, or false
ADIJake 0:85855ecd3257 324 * otherwise
ADIJake 0:85855ecd3257 325 *
ADIJake 0:85855ecd3257 326 * @return Status
Vkadaba 5:0728bde67bdb 327 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 328 *
ADIJake 0:85855ecd3257 329 * @details This function attempts to read a fixed-value device register via
ADIJake 0:85855ecd3257 330 * the communication interface.
ADIJake 0:85855ecd3257 331 */
Vkadaba 5:0728bde67bdb 332 ADMW_RESULT admw_GetDeviceReadyState(
Vkadaba 5:0728bde67bdb 333 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 334 bool * const pbReady);
ADIJake 0:85855ecd3257 335
ADIJake 0:85855ecd3257 336 /*!
ADIJake 0:85855ecd3257 337 * @brief Obtain the product ID from the device.
ADIJake 0:85855ecd3257 338 *
Vkadaba 5:0728bde67bdb 339 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 340 * @param[out] pProductId Pointer to return the product ID value
ADIJake 0:85855ecd3257 341 *
ADIJake 0:85855ecd3257 342 * @return Status
Vkadaba 5:0728bde67bdb 343 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 344 *
ADIJake 0:85855ecd3257 345 * @details Reads the product ID registers on the device and returns the value.
ADIJake 0:85855ecd3257 346 */
Vkadaba 5:0728bde67bdb 347 ADMW_RESULT admw_GetProductID(
Vkadaba 5:0728bde67bdb 348 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 349 ADMW_PRODUCT_ID * const pProductId);
ADIJake 0:85855ecd3257 350
ADIJake 0:85855ecd3257 351 /*!
ADIJake 0:85855ecd3257 352 * @brief Write full configuration settings to the device registers.
ADIJake 0:85855ecd3257 353 *
Vkadaba 5:0728bde67bdb 354 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 355 * @param[out] pConfig Pointer to the configuration data structure
ADIJake 0:85855ecd3257 356 *
ADIJake 0:85855ecd3257 357 * @return Status
Vkadaba 5:0728bde67bdb 358 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 359 *
ADIJake 0:85855ecd3257 360 * @details Translates configuration details provided into device-specific
ADIJake 0:85855ecd3257 361 * register settings and updates device configuration registers.
ADIJake 0:85855ecd3257 362 *
Vkadaba 5:0728bde67bdb 363 * @note Settings are not applied until admw_ApplyConfigUpdates() is called
ADIJake 0:85855ecd3257 364 */
Vkadaba 5:0728bde67bdb 365 ADMW_RESULT admw_SetConfig(
Vkadaba 5:0728bde67bdb 366 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 367 ADMW_CONFIG * const pConfig);
ADIJake 0:85855ecd3257 368
ADIJake 0:85855ecd3257 369 /*!
ADIJake 0:85855ecd3257 370 * @brief Apply the configuration settings currently stored in device registers
ADIJake 0:85855ecd3257 371 *
Vkadaba 5:0728bde67bdb 372 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 373 *
ADIJake 0:85855ecd3257 374 * @return Status
Vkadaba 5:0728bde67bdb 375 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 376 *
Vkadaba 5:0728bde67bdb 377 * @details Instructs the ADMW device to reload and apply configuration
ADIJake 0:85855ecd3257 378 * from the device configuration registers. Changes to configuration
ADIJake 0:85855ecd3257 379 * registers are ignored by the device until this function is called.
ADIJake 0:85855ecd3257 380 *
ADIJake 0:85855ecd3257 381 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 382 */
Vkadaba 5:0728bde67bdb 383 ADMW_RESULT admw_ApplyConfigUpdates(
Vkadaba 5:0728bde67bdb 384 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 385
ADIJake 0:85855ecd3257 386 /*!
ADIJake 0:85855ecd3257 387 * @brief Store the configuration settings to persistent memory on the device.
ADIJake 0:85855ecd3257 388 *
Vkadaba 5:0728bde67bdb 389 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 390 * @param[in] eSlotId User configuration slot in persistent memory
ADIJake 0:85855ecd3257 391 *
ADIJake 0:85855ecd3257 392 * @return Status
Vkadaba 5:0728bde67bdb 393 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 394 *
Vkadaba 5:0728bde67bdb 395 * @details Instructs the ADMW device to save the current contents of its
ADIJake 0:85855ecd3257 396 * device configuration registers to non-volatile memory.
ADIJake 0:85855ecd3257 397 *
ADIJake 0:85855ecd3257 398 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 399 * @note Do not power down the device while this command is running.
ADIJake 0:85855ecd3257 400 */
Vkadaba 5:0728bde67bdb 401 ADMW_RESULT admw_SaveConfig(
Vkadaba 5:0728bde67bdb 402 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 403 ADMW_USER_CONFIG_SLOT const eSlotId);
ADIJake 0:85855ecd3257 404
ADIJake 0:85855ecd3257 405 /*!
ADIJake 0:85855ecd3257 406 * @brief Restore configuration settings from persistent memory on the device.
ADIJake 0:85855ecd3257 407 *
Vkadaba 5:0728bde67bdb 408 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 409 * @param[in] eSlotId User configuration slot in persistent memory
ADIJake 0:85855ecd3257 410 *
ADIJake 0:85855ecd3257 411 * @return Status
Vkadaba 5:0728bde67bdb 412 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 413 *
Vkadaba 5:0728bde67bdb 414 * @details Instructs the ADMW device to restore the contents of its
ADIJake 0:85855ecd3257 415 * device configuration registers from non-volatile memory.
ADIJake 0:85855ecd3257 416 *
ADIJake 0:85855ecd3257 417 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 418 */
Vkadaba 5:0728bde67bdb 419 ADMW_RESULT admw_RestoreConfig(
Vkadaba 5:0728bde67bdb 420 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 421 ADMW_USER_CONFIG_SLOT const eSlotId);
ADIJake 0:85855ecd3257 422
ADIJake 0:85855ecd3257 423 /*!
ADIJake 0:85855ecd3257 424 * @brief Erases the external flash memory.
ADIJake 0:85855ecd3257 425 *
Vkadaba 5:0728bde67bdb 426 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 427 *
ADIJake 0:85855ecd3257 428 * @return Status
Vkadaba 5:0728bde67bdb 429 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 430 *
ADIJake 0:85855ecd3257 431 * @details Sends the bulk erase instruction to the external flash
ADIJake 0:85855ecd3257 432 * device. All stored samples are deleted.
ADIJake 0:85855ecd3257 433 * It is a blocking operation and takes tens of seconds to
ADIJake 0:85855ecd3257 434 * complete.
ADIJake 0:85855ecd3257 435 *
ADIJake 0:85855ecd3257 436 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 437 */
Vkadaba 5:0728bde67bdb 438 ADMW_RESULT admw_EraseExternalFlash(
Vkadaba 5:0728bde67bdb 439 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 440
ADIJake 0:85855ecd3257 441 /*!
ADIJake 0:85855ecd3257 442 * @brief Gets the number of samples stored in the external flash
ADIJake 0:85855ecd3257 443 * memory.
ADIJake 0:85855ecd3257 444 *
Vkadaba 5:0728bde67bdb 445 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 446 * @param[in] pSampleCount Address of the return value.
ADIJake 0:85855ecd3257 447 *
ADIJake 0:85855ecd3257 448 * @return Status
Vkadaba 5:0728bde67bdb 449 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 450 *
ADIJake 0:85855ecd3257 451 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 452 */
Vkadaba 5:0728bde67bdb 453 ADMW_RESULT admw_GetExternalFlashSampleCount(
Vkadaba 5:0728bde67bdb 454 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 455 uint32_t * nSampleCount);
ADIJake 0:85855ecd3257 456
ADIJake 0:85855ecd3257 457 // DEBUG - TO BE DELETED
Vkadaba 5:0728bde67bdb 458 ADMW_RESULT admw_SetExternalFlashIndex(
Vkadaba 5:0728bde67bdb 459 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 460 uint32_t nStartIndex);
ADIJake 0:85855ecd3257 461
ADIJake 0:85855ecd3257 462 /*!
ADIJake 0:85855ecd3257 463 * @brief Read measurement samples stored in the the external flash memory.
ADIJake 0:85855ecd3257 464 *
Vkadaba 5:0728bde67bdb 465 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 466 * @param[out] pSamples Pointer to return a set of requested data
ADIJake 0:85855ecd3257 467 * samples.
ADIJake 0:85855ecd3257 468 * @param[in] nStartIndex Index of first sample to retrieve.
ADIJake 0:85855ecd3257 469 * @param[in] nBytesPerSample The size, in bytes, of each sample.
ADIJake 0:85855ecd3257 470 * @param[in] nRequested Number of requested data samples.
ADIJake 0:85855ecd3257 471 * @param[out] pnReturned Number of valid data samples successfully
ADIJake 0:85855ecd3257 472 * retrieved.
ADIJake 0:85855ecd3257 473 *
ADIJake 0:85855ecd3257 474 * @return Status
Vkadaba 5:0728bde67bdb 475 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 476 *
ADIJake 0:85855ecd3257 477 * @details Reads the status registers and extracts the relevant information
ADIJake 0:85855ecd3257 478 * to return to the caller.
ADIJake 0:85855ecd3257 479 *
ADIJake 0:85855ecd3257 480 */
Vkadaba 5:0728bde67bdb 481 ADMW_RESULT admw_GetExternalFlashData(
Vkadaba 5:0728bde67bdb 482 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 483 ADMW_DATA_SAMPLE * const pSamples,
ADIJake 0:85855ecd3257 484 uint32_t const nIndex,
ADIJake 0:85855ecd3257 485 uint32_t const nRequested,
ADIJake 0:85855ecd3257 486 uint32_t * const pnReturned);
ADIJake 0:85855ecd3257 487
ADIJake 0:85855ecd3257 488 /*!
ADIJake 0:85855ecd3257 489 * @brief Store the LUT data to persistent memory on the device.
ADIJake 0:85855ecd3257 490 *
Vkadaba 5:0728bde67bdb 491 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 492 *
ADIJake 0:85855ecd3257 493 * @return Status
Vkadaba 5:0728bde67bdb 494 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 495 *
Vkadaba 5:0728bde67bdb 496 * @details Instructs the ADMW device to save the current contents of its
Vkadaba 5:0728bde67bdb 497 * LUT data buffer, set using @ref admw_SetLutData, to
ADIJake 0:85855ecd3257 498 * non-volatile memory.
ADIJake 0:85855ecd3257 499 *
ADIJake 0:85855ecd3257 500 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 501 * @note Do not power down the device while this command is running.
ADIJake 0:85855ecd3257 502 */
Vkadaba 5:0728bde67bdb 503 ADMW_RESULT admw_SaveLutData(
Vkadaba 5:0728bde67bdb 504 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 505
ADIJake 0:85855ecd3257 506 /*!
ADIJake 0:85855ecd3257 507 * @brief Restore LUT data from persistent memory on the device.
ADIJake 0:85855ecd3257 508 *
Vkadaba 5:0728bde67bdb 509 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 510 *
ADIJake 0:85855ecd3257 511 * @return Status
Vkadaba 5:0728bde67bdb 512 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 513 *
Vkadaba 5:0728bde67bdb 514 * @details Instructs the ADMW device to restore the contents of its
Vkadaba 5:0728bde67bdb 515 * LUT data, previously stored with @ref admw_SaveLutData, from
ADIJake 0:85855ecd3257 516 * non-volatile memory.
ADIJake 0:85855ecd3257 517 *
ADIJake 0:85855ecd3257 518 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 519 */
Vkadaba 5:0728bde67bdb 520 ADMW_RESULT admw_RestoreLutData(
Vkadaba 5:0728bde67bdb 521 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 522
ADIJake 0:85855ecd3257 523 /*!
ADIJake 0:85855ecd3257 524 * @brief Start the measurement cycles on the device.
ADIJake 0:85855ecd3257 525 *
Vkadaba 5:0728bde67bdb 526 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 527 * @param[in] eMeasurementMode Allows a choice of special modes for the
Vkadaba 5:0728bde67bdb 528 * measurement. See @ref ADMW_MEASUREMENT_MODE
ADIJake 0:85855ecd3257 529 * for further information.
ADIJake 0:85855ecd3257 530 *
ADIJake 0:85855ecd3257 531 * @return Status
Vkadaba 5:0728bde67bdb 532 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 533 *
Vkadaba 5:0728bde67bdb 534 * @details Instructs the ADMW device to start executing measurement cycles
ADIJake 0:85855ecd3257 535 * according to the current applied configuration settings. The
ADIJake 0:85855ecd3257 536 * DATAREADY status signal will be asserted whenever new measurement
ADIJake 0:85855ecd3257 537 * data is published, according to selected settings.
ADIJake 0:85855ecd3257 538 * Measurement cycles may be stopped by calling @ref
Vkadaba 5:0728bde67bdb 539 * admw_StopMeasurement.
ADIJake 0:85855ecd3257 540 *
ADIJake 0:85855ecd3257 541 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 542 */
Vkadaba 5:0728bde67bdb 543 ADMW_RESULT admw_StartMeasurement(
Vkadaba 5:0728bde67bdb 544 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 545 ADMW_MEASUREMENT_MODE const eMeasurementMode);
ADIJake 0:85855ecd3257 546
ADIJake 0:85855ecd3257 547 /*!
ADIJake 0:85855ecd3257 548 * @brief Stop the measurement cycles on the device.
ADIJake 0:85855ecd3257 549 *
Vkadaba 5:0728bde67bdb 550 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 551 *
ADIJake 0:85855ecd3257 552 * @return Status
Vkadaba 5:0728bde67bdb 553 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 554 *
Vkadaba 5:0728bde67bdb 555 * @details Instructs the ADMW device to stop executing measurement cycles.
ADIJake 0:85855ecd3257 556 * The command may be delayed until the current conversion, if any, has
ADIJake 0:85855ecd3257 557 * been completed and published.
ADIJake 0:85855ecd3257 558 *
ADIJake 0:85855ecd3257 559 * @note To be used only if a measurement command is currently running.
ADIJake 0:85855ecd3257 560 */
Vkadaba 5:0728bde67bdb 561 ADMW_RESULT admw_StopMeasurement(
Vkadaba 5:0728bde67bdb 562 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 563
ADIJake 0:85855ecd3257 564 /*!
ADIJake 0:85855ecd3257 565 * @brief Run built-in diagnostic checks on the device.
ADIJake 0:85855ecd3257 566 *
Vkadaba 5:0728bde67bdb 567 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 568 *
ADIJake 0:85855ecd3257 569 * @return Status
Vkadaba 5:0728bde67bdb 570 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 571 *
Vkadaba 5:0728bde67bdb 572 * @details Instructs the ADMW device to execute its built-in diagnostic
ADIJake 0:85855ecd3257 573 * tests, on any enabled measurement channels, according to the current
ADIJake 0:85855ecd3257 574 * applied configuration settings. Device status registers will be
ADIJake 0:85855ecd3257 575 * updated to indicate if any errors were detected by the diagnostics.
ADIJake 0:85855ecd3257 576 *
ADIJake 0:85855ecd3257 577 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 578 */
Vkadaba 5:0728bde67bdb 579 ADMW_RESULT admw_RunDiagnostics(
Vkadaba 5:0728bde67bdb 580 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 581
ADIJake 0:85855ecd3257 582 /*!
ADIJake 0:85855ecd3257 583 * @brief Run built-in calibration on the device.
ADIJake 0:85855ecd3257 584 *
Vkadaba 5:0728bde67bdb 585 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 586 *
ADIJake 0:85855ecd3257 587 * @return Status
Vkadaba 5:0728bde67bdb 588 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 589 *
Vkadaba 5:0728bde67bdb 590 * @details Instructs the ADMW device to execute its self-calibration
ADIJake 0:85855ecd3257 591 * routines, on any enabled measurement channels, according to the
ADIJake 0:85855ecd3257 592 * current applied configuration settings. Device status registers
ADIJake 0:85855ecd3257 593 * will be updated to indicate if any errors were detected.
ADIJake 0:85855ecd3257 594 *
ADIJake 0:85855ecd3257 595 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 596 */
Vkadaba 5:0728bde67bdb 597 ADMW_RESULT admw_RunCalibration(
Vkadaba 5:0728bde67bdb 598 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 599
ADIJake 0:85855ecd3257 600 /*!
ADIJake 0:85855ecd3257 601 * @brief Run built-in digital calibration on the device.
ADIJake 0:85855ecd3257 602 *
Vkadaba 5:0728bde67bdb 603 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 604 *
ADIJake 0:85855ecd3257 605 * @return Status
Vkadaba 5:0728bde67bdb 606 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 607 *
Vkadaba 5:0728bde67bdb 608 * @details Instructs the ADMW device to execute its calibration
ADIJake 0:85855ecd3257 609 * routines, on any enabled digital channels, according to the
ADIJake 0:85855ecd3257 610 * current applied configuration settings. Device status registers
ADIJake 0:85855ecd3257 611 * will be updated to indicate if any errors were detected.
ADIJake 0:85855ecd3257 612 *
ADIJake 0:85855ecd3257 613 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 614 */
Vkadaba 5:0728bde67bdb 615 ADMW_RESULT admw_RunDigitalCalibration(
Vkadaba 5:0728bde67bdb 616 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 617
ADIJake 0:85855ecd3257 618 /*!
ADIJake 0:85855ecd3257 619 * @brief Read the current status from the device registers.
ADIJake 0:85855ecd3257 620 *
Vkadaba 5:0728bde67bdb 621 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 622 * @param[out] pStatus Pointer to return the status summary obtained from the
ADIJake 0:85855ecd3257 623 * device.
ADIJake 0:85855ecd3257 624 *
ADIJake 0:85855ecd3257 625 * @return Status
Vkadaba 5:0728bde67bdb 626 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 627 *
ADIJake 0:85855ecd3257 628 * @details Reads the status registers and extracts the relevant information
ADIJake 0:85855ecd3257 629 * to return to the caller.
ADIJake 0:85855ecd3257 630 *
ADIJake 0:85855ecd3257 631 * @note This may be called at any time, assuming the device is ready.
ADIJake 0:85855ecd3257 632 */
Vkadaba 5:0728bde67bdb 633 ADMW_RESULT admw_GetStatus(
Vkadaba 5:0728bde67bdb 634 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 635 ADMW_STATUS * const pStatus);
ADIJake 0:85855ecd3257 636
ADIJake 0:85855ecd3257 637 /*!
ADIJake 0:85855ecd3257 638 * @brief Read measurement data samples from the device registers.
ADIJake 0:85855ecd3257 639 *
Vkadaba 5:0728bde67bdb 640 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 641 * @param[in] eMeasurementMode Must be set to the same value used for @ref
Vkadaba 5:0728bde67bdb 642 * admw_StartMeasurement().
ADIJake 0:85855ecd3257 643 * @param[out] pSamples Pointer to return a set of requested data samples.
ADIJake 0:85855ecd3257 644 * @param[in] nBytesPerSample The size, in bytes, of each sample.
ADIJake 0:85855ecd3257 645 * @param[in] nRequested Number of requested data samples.
ADIJake 0:85855ecd3257 646 * @param[out] pnReturned Number of valid data samples successfully retrieved.
ADIJake 0:85855ecd3257 647 *
ADIJake 0:85855ecd3257 648 * @return Status
Vkadaba 5:0728bde67bdb 649 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 650 *
ADIJake 0:85855ecd3257 651 * @details Reads the status registers and extracts the relevant information
ADIJake 0:85855ecd3257 652 * to return to the caller.
ADIJake 0:85855ecd3257 653 *
ADIJake 0:85855ecd3257 654 * @note This is intended to be called only when the DATAREADY status signal
ADIJake 0:85855ecd3257 655 * is asserted.
ADIJake 0:85855ecd3257 656 */
Vkadaba 5:0728bde67bdb 657 ADMW_RESULT admw_GetData(
Vkadaba 5:0728bde67bdb 658 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 659 ADMW_MEASUREMENT_MODE const eMeasurementMode,
Vkadaba 5:0728bde67bdb 660 ADMW_DATA_SAMPLE * const pSamples,
ADIJake 0:85855ecd3257 661 uint8_t const nBytesPerSample,
ADIJake 0:85855ecd3257 662 uint32_t const nRequested,
ADIJake 0:85855ecd3257 663 uint32_t * const pnReturned);
ADIJake 0:85855ecd3257 664
ADIJake 0:85855ecd3257 665 /*!
ADIJake 0:85855ecd3257 666 * @brief Check if a command is currently running on the device.
ADIJake 0:85855ecd3257 667 *
Vkadaba 5:0728bde67bdb 668 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 669 * @param[out] pbCommandRunning Pointer to return the command running status
ADIJake 0:85855ecd3257 670 *
ADIJake 0:85855ecd3257 671 * @return Status
Vkadaba 5:0728bde67bdb 672 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 673 *
ADIJake 0:85855ecd3257 674 * @details Reads the device status register to check if a command is running.
ADIJake 0:85855ecd3257 675 */
Vkadaba 5:0728bde67bdb 676 ADMW_RESULT admw_GetCommandRunningState(
Vkadaba 5:0728bde67bdb 677 ADMW_DEVICE_HANDLE hDevice,
ADIJake 0:85855ecd3257 678 bool *pbCommandRunning);
ADIJake 0:85855ecd3257 679
ADIJake 0:85855ecd3257 680 #ifdef __cplusplus
ADIJake 0:85855ecd3257 681 }
ADIJake 0:85855ecd3257 682 #endif
ADIJake 0:85855ecd3257 683
ADIJake 0:85855ecd3257 684 /*!
ADIJake 0:85855ecd3257 685 * @}
ADIJake 0:85855ecd3257 686 */
ADIJake 0:85855ecd3257 687
Vkadaba 6:9d393a9677f4 688 #endif /* _ADMW_API_H__ */