sensor result structure modified

Committer:
Vkadaba
Date:
Fri Oct 25 05:08:19 2019 +0000
Revision:
32:52445bef314d
Parent:
19:09d58952b65d
Child:
50:d84305e5e1c0
Register map updated.; Files changed:; 1. ADMW1001_REGISTERS.h; 2.ADMW1001_REGISTERS_typedefs.h; 3.admw_api.h; ; Changes are done to support the new register map. ; Files changed:; 1.utils.c; 2.admw1001.c; ; admw_spi.cpp file is changed to test DRDY issue ;

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"
Vkadaba 32:52445bef314d 53 #include "inc/admw1001/admw1001_sensor_types.h"
ADIJake 0:85855ecd3257 54
Vkadaba 5:0728bde67bdb 55 /*! @defgroup ADMW_Api ADMW Host Library API
Vkadaba 5:0728bde67bdb 56 * Host library API common to the ADMW product family.
ADIJake 0:85855ecd3257 57 * @{
ADIJake 0:85855ecd3257 58 */
ADIJake 0:85855ecd3257 59
ADIJake 0:85855ecd3257 60 #ifdef __cplusplus
ADIJake 0:85855ecd3257 61 extern "C" {
ADIJake 0:85855ecd3257 62 #endif
ADIJake 0:85855ecd3257 63
Vkadaba 5:0728bde67bdb 64 /*! A handle used in all API functions to identify the ADMW device. */
Vkadaba 5:0728bde67bdb 65 typedef void* ADMW_DEVICE_HANDLE;
Vkadaba 14:266ab283b086 66
Vkadaba 13:97cb32670539 67 #define SPI_BUFFER_SIZE 100u
Vkadaba 13:97cb32670539 68
Vkadaba 13:97cb32670539 69 #define SFL_READ_STATUS_HDR_SIZE 14u
Vkadaba 13:97cb32670539 70
Vkadaba 13:97cb32670539 71 #define SFL_READ_STATUS_RESPONSE_SIZE 42u
ADIJake 0:85855ecd3257 72
Vkadaba 5:0728bde67bdb 73 /*! Supported connection types for communication with the ADMW device. */
Vkadaba 32:52445bef314d 74 typedef enum
Vkadaba 32:52445bef314d 75 {
Vkadaba 5:0728bde67bdb 76 ADMW_CONNECTION_TYPE_SPI = 1,
ADIJake 0:85855ecd3257 77 /*!< Serial Peripheral Interface (SPI) connection type */
Vkadaba 32:52445bef314d 78
Vkadaba 32:52445bef314d 79 } ADMW_CONNECTION_TYPE;
ADIJake 0:85855ecd3257 80
Vkadaba 5:0728bde67bdb 81 /*! Connection details for communication with a ADMW device instance. */
Vkadaba 32:52445bef314d 82 typedef struct
Vkadaba 32:52445bef314d 83 {
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 32:52445bef314d 92
Vkadaba 32:52445bef314d 93 } ADMW_CONNECTION;
ADIJake 0:85855ecd3257 94
ADIJake 0:85855ecd3257 95 /*! Bit masks (flags) for the different device status indicators. */
Vkadaba 32:52445bef314d 96 typedef enum
Vkadaba 32:52445bef314d 97 {
Vkadaba 5:0728bde67bdb 98 ADMW_DEVICE_STATUS_BUSY = (1 << 0),
ADIJake 0:85855ecd3257 99 /*!< Indicates that a command is currently running on the device */
Vkadaba 5:0728bde67bdb 100 ADMW_DEVICE_STATUS_DATAREADY = (1 << 1),
ADIJake 0:85855ecd3257 101 /*!< Indicates the availability of measurement data for retrieval */
Vkadaba 5:0728bde67bdb 102 ADMW_DEVICE_STATUS_ERROR = (1 << 2),
ADIJake 0:85855ecd3257 103 /*!< Indicates that an error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 104 ADMW_DEVICE_STATUS_ALERT = (1 << 3),
ADIJake 0:85855ecd3257 105 /*!< Indicates that an alert condition has been detected by the device */
Vkadaba 5:0728bde67bdb 106 ADMW_DEVICE_STATUS_FIFO_ERROR = (1 << 4),
ADIJake 0:85855ecd3257 107 /*!< Indicates that a FIFO error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 108 ADMW_DEVICE_STATUS_CONFIG_ERROR = (1 << 5),
ADIJake 0:85855ecd3257 109 /*!< Indicates that a configuration error condition has been detected by the device */
Vkadaba 5:0728bde67bdb 110 ADMW_DEVICE_STATUS_LUT_ERROR = (1 << 6),
ADIJake 0:85855ecd3257 111 /*!< Indicates that a look-up table error condition has been detected by the device */
Vkadaba 32:52445bef314d 112
Vkadaba 32:52445bef314d 113 } ADMW_DEVICE_STATUS_FLAGS;
ADIJake 0:85855ecd3257 114
ADIJake 0:85855ecd3257 115 /*! Bit masks (flags) for the different diagnostics status indicators. */
Vkadaba 32:52445bef314d 116 typedef enum
Vkadaba 32:52445bef314d 117 {
Vkadaba 5:0728bde67bdb 118 ADMW_DIAGNOSTICS_STATUS_CHECKSUM_ERROR = (1 << 0),
ADIJake 0:85855ecd3257 119 /*!< Indicates Error on Internal Checksum Calculations */
Vkadaba 5:0728bde67bdb 120 ADMW_DIAGNOSTICS_STATUS_CONVERSION_ERROR = (1 << 8),
ADIJake 0:85855ecd3257 121 /*!< Indicates Error During Internal ADC Conversions */
Vkadaba 5:0728bde67bdb 122 ADMW_DIAGNOSTICS_STATUS_CALIBRATION_ERROR = (1 << 9),
ADIJake 0:85855ecd3257 123 /*!< Indicates Error During Internal Device Calibrations */
Vkadaba 32:52445bef314d 124
Vkadaba 32:52445bef314d 125 } ADMW_DIAGNOSTICS_STATUS_FLAGS;
ADIJake 0:85855ecd3257 126
ADIJake 0:85855ecd3257 127 /*! Bit masks (flags) for the different channel alert indicators. */
Vkadaba 32:52445bef314d 128 typedef enum
Vkadaba 32:52445bef314d 129 {
Vkadaba 32:52445bef314d 130 ADMW_ALERT_DETAIL_CH_RESULT_VALID = (1 << 0),
Vkadaba 32:52445bef314d 131 /*!< Indicates valid result in the channel */
Vkadaba 32:52445bef314d 132 ADMW_ALERT_DETAIL_CH_ADC_NEAR_OVERRANGE = (1 << 1),
Vkadaba 32:52445bef314d 133 /*!< Indicates ADC is near overrange in the channel */
Vkadaba 32:52445bef314d 134 ADMW_ALERT_DETAIL_CH_SENSOR_UNDERRANGE = (1 << 2),
Vkadaba 32:52445bef314d 135 /*!< Indicates sensor underrange in the channel */
Vkadaba 32:52445bef314d 136 ADMW_ALERT_DETAIL_CH_SENSOR_OVERRANGE = (1 << 3),
Vkadaba 32:52445bef314d 137 /*!< Indicates sensor overrange in the channel */
Vkadaba 32:52445bef314d 138 ADMW_ALERT_DETAIL_CH_CJ_SOFT_FAULT = (1 << 4),
Vkadaba 32:52445bef314d 139 /*!< Indicates Cold Junction soft fault in the channel */
Vkadaba 32:52445bef314d 140 ADMW_ALERT_DETAIL_CH_CJ_HARD_FAULT = (1 << 5),
Vkadaba 32:52445bef314d 141 /*!< Indicates Cold Junction Hard Fault in the channel */
Vkadaba 32:52445bef314d 142 ADMW_ALERT_DETAIL_CH_ADC_INPUT_OVERRANGE = (1 << 6),
Vkadaba 32:52445bef314d 143 /*!< Indicates ADC Input overrange in the channel */
Vkadaba 32:52445bef314d 144 ADMW_ALERT_DETAIL_CH_SENSOR_HARDFAULT = (1 << 7),
Vkadaba 32:52445bef314d 145 /*!< Indicates Hard Fault in the channel */
Vkadaba 32:52445bef314d 146 } ADMW_CHANNEL_ALERT_FLAGS;
ADIJake 0:85855ecd3257 147
Vkadaba 5:0728bde67bdb 148 /*! Status details retreived from the ADMW device. */
Vkadaba 32:52445bef314d 149 typedef struct
Vkadaba 32:52445bef314d 150 {
Vkadaba 5:0728bde67bdb 151 ADMW_DEVICE_STATUS_FLAGS deviceStatus;
ADIJake 0:85855ecd3257 152 /*!< General summary status information from the device */
Vkadaba 5:0728bde67bdb 153 ADMW_DIAGNOSTICS_STATUS_FLAGS diagnosticsStatus;
ADIJake 0:85855ecd3257 154 /*!< Diagnostic error status information from the device */
Vkadaba 32:52445bef314d 155 ADMW_CHANNEL_ALERT_FLAGS channelAlerts[ADMW1001_MAX_CHANNELS];
ADIJake 0:85855ecd3257 156 /*!< Per-channel alert status information from the device */
Vkadaba 32:52445bef314d 157 uint32_t errorCode;
ADIJake 0:85855ecd3257 158 /*!< Code identifying the last error signalled by the device */
Vkadaba 32:52445bef314d 159 uint32_t alertCode;
ADIJake 0:85855ecd3257 160 /*!< Code identifying the last alert signalled by the device */
Vkadaba 32:52445bef314d 161 uint32_t debugCode;
ADIJake 0:85855ecd3257 162 /*!< Supplementary code related to the last error/alert */
Vkadaba 32:52445bef314d 163 uint32_t channelAlertCodes[ADMW1001_MAX_CHANNELS];
ADIJake 0:85855ecd3257 164 /*!< Per-channel code identifying the last alert signalled for each channel */
Vkadaba 32:52445bef314d 165
Vkadaba 32:52445bef314d 166 } ADMW_STATUS;
ADIJake 0:85855ecd3257 167
Vkadaba 5:0728bde67bdb 168 /*! Data sample details retreived from the ADMW device. */
Vkadaba 32:52445bef314d 169 typedef struct
Vkadaba 32:52445bef314d 170 {
Vkadaba 5:0728bde67bdb 171 ADMW_DEVICE_STATUS_FLAGS status;
ADIJake 0:85855ecd3257 172 /*!< Device summary status snapshot when the sample was recorded */
Vkadaba 32:52445bef314d 173 uint32_t channelId;
ADIJake 0:85855ecd3257 174 /*!< The measurement channel from which this sample was obtained */
Vkadaba 32:52445bef314d 175 uint32_t rawValue;
ADIJake 0:85855ecd3257 176 /*!< The raw (unprocessed) value obtained directly from the measurement
ADIJake 0:85855ecd3257 177 * channel, if available
ADIJake 0:85855ecd3257 178 */
Vkadaba 32:52445bef314d 179 float32_t processedValue;
ADIJake 0:85855ecd3257 180 /*!< The processed value obtained from the measurement channel, as a final
ADIJake 0:85855ecd3257 181 * measurement value, following calibration and linearisation correction,
ADIJake 0:85855ecd3257 182 * and conversion into an appropriate unit of measurement.
ADIJake 0:85855ecd3257 183 */
Vkadaba 32:52445bef314d 184
Vkadaba 32:52445bef314d 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 */
Vkadaba 32:52445bef314d 190 typedef enum
Vkadaba 32:52445bef314d 191 {
Vkadaba 6:9d393a9677f4 192 ADMW_MEASUREMENT_MODE_NORMAL = 0,
ADIJake 0:85855ecd3257 193 /*!< In this mode, normal measurement cycle(s) are executed and data samples
ADIJake 0:85855ecd3257 194 * are returned with raw measurement values included. */
Vkadaba 5:0728bde67bdb 195 ADMW_MEASUREMENT_MODE_OMIT_RAW,
ADIJake 0:85855ecd3257 196 /*!< In this mode, normal measurement cycle(s) are executed and data samples
ADIJake 0:85855ecd3257 197 * are returned with raw measurement values omitted for efficiency. */
Vkadaba 32:52445bef314d 198
Vkadaba 32:52445bef314d 199 } ADMW_MEASUREMENT_MODE;
ADIJake 0:85855ecd3257 200
ADIJake 0:85855ecd3257 201 /*! Identifiers for the user configuration slots in persistent memory. */
Vkadaba 32:52445bef314d 202 typedef enum
Vkadaba 32:52445bef314d 203 {
Vkadaba 5:0728bde67bdb 204 ADMW_FLASH_CONFIG_1,
Vkadaba 32:52445bef314d 205
Vkadaba 32:52445bef314d 206 } ADMW_USER_CONFIG_SLOT;
Vkadaba 32:52445bef314d 207
Vkadaba 32:52445bef314d 208
ADIJake 0:85855ecd3257 209
Vkadaba 32:52445bef314d 210 typedef struct
Vkadaba 32:52445bef314d 211 {
Vkadaba 32:52445bef314d 212 unsigned nDeviceIndex;
Vkadaba 32:52445bef314d 213 ADMW_SPI_HANDLE hSpi;
Vkadaba 32:52445bef314d 214 ADMW_GPIO_HANDLE hGpio;
Vkadaba 32:52445bef314d 215 } ADMW_DEVICE_CONTEXT;
ADIJake 0:85855ecd3257 216
ADIJake 0:85855ecd3257 217 /******************************************************************************
Vkadaba 5:0728bde67bdb 218 * ADMW High-Level API function prototypes
ADIJake 0:85855ecd3257 219 *****************************************************************************/
ADIJake 0:85855ecd3257 220
ADIJake 0:85855ecd3257 221 /*!
Vkadaba 5:0728bde67bdb 222 * @brief Open ADMW 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
Vkadaba 5:0728bde67bdb 227 * this device (see @ref admw_SetConfig
Vkadaba 5:0728bde67bdb 228 * and @ref ADMW_CONFIG)
ADIJake 0:85855ecd3257 229 * @param[in] pConnectionInfo Host-specific connection details (e.g. SPI, GPIO)
Vkadaba 5:0728bde67bdb 230 * @param[out] phDevice Pointer to return an ADMW device handle
ADIJake 0:85855ecd3257 231 *
ADIJake 0:85855ecd3257 232 * @return Status
Vkadaba 5:0728bde67bdb 233 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 234 * - #ADMW_NO_MEM Failed to allocate memory resources.
Vkadaba 5:0728bde67bdb 235 * - #ADMW_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
Vkadaba 32:52445bef314d 238 * communication interface to the ADISense module.
ADIJake 0:85855ecd3257 239 */
Vkadaba 5:0728bde67bdb 240 ADMW_RESULT admw_Open(
ADIJake 0:85855ecd3257 241 unsigned const nDeviceIndex,
Vkadaba 5:0728bde67bdb 242 ADMW_CONNECTION * const pConnectionInfo,
Vkadaba 5:0728bde67bdb 243 ADMW_DEVICE_HANDLE * const phDevice);
ADIJake 0:85855ecd3257 244
ADIJake 0:85855ecd3257 245 /*!
Vkadaba 5:0728bde67bdb 246 * @brief Close ADMW device context and free resources.
ADIJake 0:85855ecd3257 247 *
Vkadaba 5:0728bde67bdb 248 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 249 *
ADIJake 0:85855ecd3257 250 * @return Status
Vkadaba 5:0728bde67bdb 251 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 252 */
Vkadaba 5:0728bde67bdb 253 ADMW_RESULT admw_Close(
Vkadaba 5:0728bde67bdb 254 ADMW_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 *
Vkadaba 5:0728bde67bdb 259 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 264 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 265 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 270 ADMW_RESULT admw_GetGpioState(
Vkadaba 5:0728bde67bdb 271 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 272 ADMW_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 *
Vkadaba 5:0728bde67bdb 278 * @param[in] hDevice ADMW context handle (@ref admw_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
Vkadaba 5:0728bde67bdb 285 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 286 * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified.
ADIJake 0:85855ecd3257 287 */
Vkadaba 5:0728bde67bdb 288 ADMW_RESULT admw_RegisterGpioCallback(
Vkadaba 5:0728bde67bdb 289 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 290 ADMW_GPIO_PIN const ePinId,
Vkadaba 5:0728bde67bdb 291 ADMW_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 *
Vkadaba 5:0728bde67bdb 297 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 298 *
ADIJake 0:85855ecd3257 299 * @return Status
Vkadaba 5:0728bde67bdb 300 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 301 *
Vkadaba 5:0728bde67bdb 302 * @details Instructs the ADMW 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
Vkadaba 5:0728bde67bdb 305 * @ref admw_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 */
Vkadaba 5:0728bde67bdb 311 ADMW_RESULT admw_Shutdown(
Vkadaba 5:0728bde67bdb 312 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 313
ADIJake 0:85855ecd3257 314 /*!
Vkadaba 5:0728bde67bdb 315 * @brief Reset the ADMW device.
ADIJake 0:85855ecd3257 316 *
Vkadaba 5:0728bde67bdb 317 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 318 *
ADIJake 0:85855ecd3257 319 * @return Status
Vkadaba 5:0728bde67bdb 320 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 321 *
Vkadaba 5:0728bde67bdb 322 * @details Trigger a hardware-reset of the ADMW device.
ADIJake 0:85855ecd3257 323 *
ADIJake 0:85855ecd3257 324 * @note The device may require several seconds before it is ready for use
Vkadaba 5:0728bde67bdb 325 * again. @ref admw_GetDeviceReadyState may be used to check if
ADIJake 0:85855ecd3257 326 * the device is ready.
ADIJake 0:85855ecd3257 327 */
Vkadaba 5:0728bde67bdb 328 ADMW_RESULT admw_Reset(
Vkadaba 5:0728bde67bdb 329 ADMW_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 *
Vkadaba 5:0728bde67bdb 334 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 339 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 344 ADMW_RESULT admw_GetDeviceReadyState(
Vkadaba 5:0728bde67bdb 345 ADMW_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 *
Vkadaba 5:0728bde67bdb 351 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 355 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 359 ADMW_RESULT admw_GetProductID(
Vkadaba 5:0728bde67bdb 360 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 361 ADMW_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 *
Vkadaba 5:0728bde67bdb 366 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 370 * - #ADMW_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 *
Vkadaba 5:0728bde67bdb 375 * @note Settings are not applied until admw_ApplyConfigUpdates() is called
ADIJake 0:85855ecd3257 376 */
Vkadaba 5:0728bde67bdb 377 ADMW_RESULT admw_SetConfig(
Vkadaba 5:0728bde67bdb 378 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 379 ADMW_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 *
Vkadaba 5:0728bde67bdb 384 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 385 *
ADIJake 0:85855ecd3257 386 * @return Status
Vkadaba 5:0728bde67bdb 387 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 388 *
Vkadaba 5:0728bde67bdb 389 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 395 ADMW_RESULT admw_ApplyConfigUpdates(
Vkadaba 5:0728bde67bdb 396 ADMW_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 *
Vkadaba 5:0728bde67bdb 401 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 405 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 406 *
Vkadaba 5:0728bde67bdb 407 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 413 ADMW_RESULT admw_SaveConfig(
Vkadaba 5:0728bde67bdb 414 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 415 ADMW_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 *
Vkadaba 5:0728bde67bdb 420 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 424 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 425 *
Vkadaba 5:0728bde67bdb 426 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 431 ADMW_RESULT admw_RestoreConfig(
Vkadaba 5:0728bde67bdb 432 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 433 ADMW_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 *
Vkadaba 5:0728bde67bdb 438 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 439 *
ADIJake 0:85855ecd3257 440 * @return Status
Vkadaba 5:0728bde67bdb 441 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 450 ADMW_RESULT admw_EraseExternalFlash(
Vkadaba 5:0728bde67bdb 451 ADMW_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 *
Vkadaba 5:0728bde67bdb 457 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 461 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 465 ADMW_RESULT admw_GetExternalFlashSampleCount(
Vkadaba 5:0728bde67bdb 466 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 467 uint32_t * nSampleCount);
ADIJake 0:85855ecd3257 468
ADIJake 0:85855ecd3257 469 // DEBUG - TO BE DELETED
Vkadaba 5:0728bde67bdb 470 ADMW_RESULT admw_SetExternalFlashIndex(
Vkadaba 5:0728bde67bdb 471 ADMW_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 *
Vkadaba 5:0728bde67bdb 477 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 487 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 493 ADMW_RESULT admw_GetExternalFlashData(
Vkadaba 5:0728bde67bdb 494 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 495 ADMW_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 *
Vkadaba 5:0728bde67bdb 503 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 504 *
ADIJake 0:85855ecd3257 505 * @return Status
Vkadaba 5:0728bde67bdb 506 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 507 *
Vkadaba 5:0728bde67bdb 508 * @details Instructs the ADMW device to save the current contents of its
Vkadaba 5:0728bde67bdb 509 * LUT data buffer, set using @ref admw_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 */
Vkadaba 5:0728bde67bdb 515 ADMW_RESULT admw_SaveLutData(
Vkadaba 5:0728bde67bdb 516 ADMW_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 *
Vkadaba 5:0728bde67bdb 521 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 522 *
ADIJake 0:85855ecd3257 523 * @return Status
Vkadaba 5:0728bde67bdb 524 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 525 *
Vkadaba 5:0728bde67bdb 526 * @details Instructs the ADMW device to restore the contents of its
Vkadaba 5:0728bde67bdb 527 * LUT data, previously stored with @ref admw_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 */
Vkadaba 5:0728bde67bdb 532 ADMW_RESULT admw_RestoreLutData(
Vkadaba 5:0728bde67bdb 533 ADMW_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 *
Vkadaba 5:0728bde67bdb 538 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 539 * @param[in] eMeasurementMode Allows a choice of special modes for the
Vkadaba 5:0728bde67bdb 540 * measurement. See @ref ADMW_MEASUREMENT_MODE
ADIJake 0:85855ecd3257 541 * for further information.
ADIJake 0:85855ecd3257 542 *
ADIJake 0:85855ecd3257 543 * @return Status
Vkadaba 5:0728bde67bdb 544 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 545 *
Vkadaba 5:0728bde67bdb 546 * @details Instructs the ADMW 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
Vkadaba 5:0728bde67bdb 551 * admw_StopMeasurement.
ADIJake 0:85855ecd3257 552 *
ADIJake 0:85855ecd3257 553 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 554 */
Vkadaba 5:0728bde67bdb 555 ADMW_RESULT admw_StartMeasurement(
Vkadaba 5:0728bde67bdb 556 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 557 ADMW_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 *
Vkadaba 5:0728bde67bdb 562 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 563 *
ADIJake 0:85855ecd3257 564 * @return Status
Vkadaba 5:0728bde67bdb 565 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 566 *
Vkadaba 5:0728bde67bdb 567 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 573 ADMW_RESULT admw_StopMeasurement(
Vkadaba 5:0728bde67bdb 574 ADMW_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 *
Vkadaba 5:0728bde67bdb 579 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 580 *
ADIJake 0:85855ecd3257 581 * @return Status
Vkadaba 5:0728bde67bdb 582 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 583 *
Vkadaba 5:0728bde67bdb 584 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 591 ADMW_RESULT admw_RunDiagnostics(
Vkadaba 5:0728bde67bdb 592 ADMW_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 *
Vkadaba 5:0728bde67bdb 597 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 598 *
ADIJake 0:85855ecd3257 599 * @return Status
Vkadaba 5:0728bde67bdb 600 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 601 *
Vkadaba 5:0728bde67bdb 602 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 609 ADMW_RESULT admw_RunCalibration(
Vkadaba 5:0728bde67bdb 610 ADMW_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 *
Vkadaba 5:0728bde67bdb 615 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 616 *
ADIJake 0:85855ecd3257 617 * @return Status
Vkadaba 5:0728bde67bdb 618 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 619 *
Vkadaba 5:0728bde67bdb 620 * @details Instructs the ADMW 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 */
Vkadaba 5:0728bde67bdb 627 ADMW_RESULT admw_RunDigitalCalibration(
Vkadaba 5:0728bde67bdb 628 ADMW_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 *
Vkadaba 5:0728bde67bdb 633 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 638 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 645 ADMW_RESULT admw_GetStatus(
Vkadaba 5:0728bde67bdb 646 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 647 ADMW_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 *
Vkadaba 5:0728bde67bdb 652 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 653 * @param[in] eMeasurementMode Must be set to the same value used for @ref
Vkadaba 5:0728bde67bdb 654 * admw_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
Vkadaba 5:0728bde67bdb 661 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 669 ADMW_RESULT admw_GetData(
Vkadaba 5:0728bde67bdb 670 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 671 ADMW_MEASUREMENT_MODE const eMeasurementMode,
Vkadaba 5:0728bde67bdb 672 ADMW_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 *
Vkadaba 5:0728bde67bdb 680 * @param[in] hDevice ADMW 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
Vkadaba 5:0728bde67bdb 684 * - #ADMW_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 */
Vkadaba 5:0728bde67bdb 688 ADMW_RESULT admw_GetCommandRunningState(
Vkadaba 5:0728bde67bdb 689 ADMW_DEVICE_HANDLE hDevice,
ADIJake 0:85855ecd3257 690 bool *pbCommandRunning);
ADIJake 0:85855ecd3257 691
Vkadaba 32:52445bef314d 692 ADMW_RESULT admw1001_sendRun( ADMW_DEVICE_HANDLE const hDevice);
Vkadaba 14:266ab283b086 693 ADMW_RESULT deviceInformation(ADMW_DEVICE_HANDLE hDevice);
Vkadaba 32:52445bef314d 694
ADIJake 0:85855ecd3257 695 #ifdef __cplusplus
ADIJake 0:85855ecd3257 696 }
ADIJake 0:85855ecd3257 697 #endif
ADIJake 0:85855ecd3257 698
ADIJake 0:85855ecd3257 699 /*!
ADIJake 0:85855ecd3257 700 * @}
ADIJake 0:85855ecd3257 701 */
ADIJake 0:85855ecd3257 702
Vkadaba 6:9d393a9677f4 703 #endif /* _ADMW_API_H__ */