sensor result structure modified

Committer:
Vkadaba
Date:
Mon Feb 17 11:23:39 2020 +0000
Revision:
50:d84305e5e1c0
Parent:
32:52445bef314d
Child:
52:d32ea3dfc8ac
Mbed Firmware Update to support Device FW v1.12.061

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 50:d84305e5e1c0 175 uint8_t measurementStatus;
Vkadaba 50:d84305e5e1c0 176 /*!< The measurement status from the DMZ layer */
Vkadaba 32:52445bef314d 177 uint32_t rawValue;
ADIJake 0:85855ecd3257 178 /*!< The raw (unprocessed) value obtained directly from the measurement
ADIJake 0:85855ecd3257 179 * channel, if available
ADIJake 0:85855ecd3257 180 */
Vkadaba 32:52445bef314d 181 float32_t processedValue;
ADIJake 0:85855ecd3257 182 /*!< The processed value obtained from the measurement channel, as a final
ADIJake 0:85855ecd3257 183 * measurement value, following calibration and linearisation correction,
ADIJake 0:85855ecd3257 184 * and conversion into an appropriate unit of measurement.
ADIJake 0:85855ecd3257 185 */
Vkadaba 32:52445bef314d 186
Vkadaba 32:52445bef314d 187 } ADMW_DATA_SAMPLE;
ADIJake 0:85855ecd3257 188
Vkadaba 5:0728bde67bdb 189 /*! Measurement mode options for the ADMW device.
Vkadaba 5:0728bde67bdb 190 * @ref admw_StartMeasurement
ADIJake 0:85855ecd3257 191 */
Vkadaba 32:52445bef314d 192 typedef enum
Vkadaba 32:52445bef314d 193 {
Vkadaba 6:9d393a9677f4 194 ADMW_MEASUREMENT_MODE_NORMAL = 0,
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 included. */
Vkadaba 5:0728bde67bdb 197 ADMW_MEASUREMENT_MODE_OMIT_RAW,
ADIJake 0:85855ecd3257 198 /*!< In this mode, normal measurement cycle(s) are executed and data samples
ADIJake 0:85855ecd3257 199 * are returned with raw measurement values omitted for efficiency. */
Vkadaba 32:52445bef314d 200
Vkadaba 32:52445bef314d 201 } ADMW_MEASUREMENT_MODE;
ADIJake 0:85855ecd3257 202
ADIJake 0:85855ecd3257 203 /*! Identifiers for the user configuration slots in persistent memory. */
Vkadaba 32:52445bef314d 204 typedef enum
Vkadaba 32:52445bef314d 205 {
Vkadaba 5:0728bde67bdb 206 ADMW_FLASH_CONFIG_1,
Vkadaba 32:52445bef314d 207
Vkadaba 32:52445bef314d 208 } ADMW_USER_CONFIG_SLOT;
Vkadaba 32:52445bef314d 209
Vkadaba 50:d84305e5e1c0 210 /*! Identifiers for the user configuration slots in persistent memory. */
Vkadaba 50:d84305e5e1c0 211 typedef enum
Vkadaba 50:d84305e5e1c0 212 {
Vkadaba 50:d84305e5e1c0 213 ADMW_FLASH_LUT_CHANNEL_0=0,
Vkadaba 50:d84305e5e1c0 214 ADMW_FLASH_LUT_CHANNEL_1,
Vkadaba 50:d84305e5e1c0 215 ADMW_FLASH_LUT_CHANNEL_2,
Vkadaba 50:d84305e5e1c0 216 ADMW_FLASH_LUT_CHANNEL_3,
Vkadaba 50:d84305e5e1c0 217
Vkadaba 32:52445bef314d 218
Vkadaba 50:d84305e5e1c0 219 } ADMW_USER_LUT_CONFIG_SLOT;
ADIJake 0:85855ecd3257 220
Vkadaba 32:52445bef314d 221 typedef struct
Vkadaba 32:52445bef314d 222 {
Vkadaba 32:52445bef314d 223 unsigned nDeviceIndex;
Vkadaba 32:52445bef314d 224 ADMW_SPI_HANDLE hSpi;
Vkadaba 32:52445bef314d 225 ADMW_GPIO_HANDLE hGpio;
Vkadaba 32:52445bef314d 226 } ADMW_DEVICE_CONTEXT;
ADIJake 0:85855ecd3257 227
ADIJake 0:85855ecd3257 228 /******************************************************************************
Vkadaba 5:0728bde67bdb 229 * ADMW High-Level API function prototypes
ADIJake 0:85855ecd3257 230 *****************************************************************************/
ADIJake 0:85855ecd3257 231
ADIJake 0:85855ecd3257 232 /*!
Vkadaba 5:0728bde67bdb 233 * @brief Open ADMW device handle and set up communication interface.
ADIJake 0:85855ecd3257 234 *
ADIJake 0:85855ecd3257 235 * @param[in] nDeviceIndex Zero-based index number identifying this device
ADIJake 0:85855ecd3257 236 * instance. Note that this will be used to
ADIJake 0:85855ecd3257 237 * retrieve a specific device configuration for
Vkadaba 5:0728bde67bdb 238 * this device (see @ref admw_SetConfig
Vkadaba 5:0728bde67bdb 239 * and @ref ADMW_CONFIG)
ADIJake 0:85855ecd3257 240 * @param[in] pConnectionInfo Host-specific connection details (e.g. SPI, GPIO)
Vkadaba 5:0728bde67bdb 241 * @param[out] phDevice Pointer to return an ADMW device handle
ADIJake 0:85855ecd3257 242 *
ADIJake 0:85855ecd3257 243 * @return Status
Vkadaba 5:0728bde67bdb 244 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 245 * - #ADMW_NO_MEM Failed to allocate memory resources.
Vkadaba 5:0728bde67bdb 246 * - #ADMW_INVALID_DEVICE_NUM Invalid device index specified
ADIJake 0:85855ecd3257 247 *
ADIJake 0:85855ecd3257 248 * @details Configure and initialise the Log interface and the SPI/GPIO
Vkadaba 32:52445bef314d 249 * communication interface to the ADISense module.
ADIJake 0:85855ecd3257 250 */
Vkadaba 5:0728bde67bdb 251 ADMW_RESULT admw_Open(
ADIJake 0:85855ecd3257 252 unsigned const nDeviceIndex,
Vkadaba 5:0728bde67bdb 253 ADMW_CONNECTION * const pConnectionInfo,
Vkadaba 5:0728bde67bdb 254 ADMW_DEVICE_HANDLE * const phDevice);
ADIJake 0:85855ecd3257 255
ADIJake 0:85855ecd3257 256 /*!
Vkadaba 5:0728bde67bdb 257 * @brief Close ADMW device context and free resources.
ADIJake 0:85855ecd3257 258 *
Vkadaba 5:0728bde67bdb 259 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 260 *
ADIJake 0:85855ecd3257 261 * @return Status
Vkadaba 5:0728bde67bdb 262 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 263 */
Vkadaba 5:0728bde67bdb 264 ADMW_RESULT admw_Close(
Vkadaba 5:0728bde67bdb 265 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 266
ADIJake 0:85855ecd3257 267 /*!
ADIJake 0:85855ecd3257 268 * @brief Get the current state of the specified GPIO input signal.
ADIJake 0:85855ecd3257 269 *
Vkadaba 5:0728bde67bdb 270 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 271 * @param[in] ePinId GPIO pin to query
ADIJake 0:85855ecd3257 272 * @param[out] pbAsserted Pointer to return the state of the status signal GPIO pin
ADIJake 0:85855ecd3257 273 *
ADIJake 0:85855ecd3257 274 * @return Status
Vkadaba 5:0728bde67bdb 275 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 276 * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified.
ADIJake 0:85855ecd3257 277 *
ADIJake 0:85855ecd3257 278 * @details Sets *pbAsserted to true if the status signal is asserted, or false
ADIJake 0:85855ecd3257 279 * otherwise.
ADIJake 0:85855ecd3257 280 */
Vkadaba 5:0728bde67bdb 281 ADMW_RESULT admw_GetGpioState(
Vkadaba 5:0728bde67bdb 282 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 283 ADMW_GPIO_PIN const ePinId,
ADIJake 0:85855ecd3257 284 bool * const pbAsserted);
ADIJake 0:85855ecd3257 285
ADIJake 0:85855ecd3257 286 /*!
ADIJake 0:85855ecd3257 287 * @brief Register an application-defined callback function for GPIO interrupts
ADIJake 0:85855ecd3257 288 *
Vkadaba 5:0728bde67bdb 289 * @param[in] hDevice ADMW context handle (@ref admw_Open)
ADIJake 0:85855ecd3257 290 * @param[in] ePinId GPIO pin on which to enable/disable interrupts
ADIJake 0:85855ecd3257 291 * @param[in] callbackFunction Function to be called when an interrupt occurs.
ADIJake 0:85855ecd3257 292 * Specify NULL here to disable interrupts.
ADIJake 0:85855ecd3257 293 * @param[in] pCallbackParam Optional opaque parameter passed to the callback
ADIJake 0:85855ecd3257 294 *
ADIJake 0:85855ecd3257 295 * @return Status
Vkadaba 5:0728bde67bdb 296 * - #ADMW_SUCCESS Call completed successfully.
Vkadaba 5:0728bde67bdb 297 * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified.
ADIJake 0:85855ecd3257 298 */
Vkadaba 5:0728bde67bdb 299 ADMW_RESULT admw_RegisterGpioCallback(
Vkadaba 5:0728bde67bdb 300 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 301 ADMW_GPIO_PIN const ePinId,
Vkadaba 5:0728bde67bdb 302 ADMW_GPIO_CALLBACK const callbackFunction,
ADIJake 0:85855ecd3257 303 void * const pCallbackParam);
ADIJake 0:85855ecd3257 304
ADIJake 0:85855ecd3257 305 /*!
ADIJake 0:85855ecd3257 306 * @brief Trigger a shut down of the device.
ADIJake 0:85855ecd3257 307 *
Vkadaba 5:0728bde67bdb 308 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 309 *
ADIJake 0:85855ecd3257 310 * @return Status
Vkadaba 5:0728bde67bdb 311 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 312 *
Vkadaba 5:0728bde67bdb 313 * @details Instructs the ADMW device to initiate a shut down,
ADIJake 0:85855ecd3257 314 * typically used to conserve power when the device is not
ADIJake 0:85855ecd3257 315 * in use. The device may be restarted by calling
Vkadaba 5:0728bde67bdb 316 * @ref admw_Reset(). Note that active configuration
ADIJake 0:85855ecd3257 317 * settings are not preserved during shutdown and must be
ADIJake 0:85855ecd3257 318 * reloaded after the device has become ready again.
ADIJake 0:85855ecd3257 319 *
ADIJake 0:85855ecd3257 320 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 321 */
Vkadaba 5:0728bde67bdb 322 ADMW_RESULT admw_Shutdown(
Vkadaba 5:0728bde67bdb 323 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 324
ADIJake 0:85855ecd3257 325 /*!
Vkadaba 5:0728bde67bdb 326 * @brief Reset the ADMW device.
ADIJake 0:85855ecd3257 327 *
Vkadaba 5:0728bde67bdb 328 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 329 *
ADIJake 0:85855ecd3257 330 * @return Status
Vkadaba 5:0728bde67bdb 331 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 332 *
Vkadaba 5:0728bde67bdb 333 * @details Trigger a hardware-reset of the ADMW device.
ADIJake 0:85855ecd3257 334 *
ADIJake 0:85855ecd3257 335 * @note The device may require several seconds before it is ready for use
Vkadaba 5:0728bde67bdb 336 * again. @ref admw_GetDeviceReadyState may be used to check if
ADIJake 0:85855ecd3257 337 * the device is ready.
ADIJake 0:85855ecd3257 338 */
Vkadaba 5:0728bde67bdb 339 ADMW_RESULT admw_Reset(
Vkadaba 5:0728bde67bdb 340 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 341
ADIJake 0:85855ecd3257 342 /*!
ADIJake 0:85855ecd3257 343 * @brief Check if the device is ready, following power-up or a reset.
ADIJake 0:85855ecd3257 344 *
Vkadaba 5:0728bde67bdb 345 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 346 * @param[out] pbReady Pointer to return true if the device is ready, or false
ADIJake 0:85855ecd3257 347 * otherwise
ADIJake 0:85855ecd3257 348 *
ADIJake 0:85855ecd3257 349 * @return Status
Vkadaba 5:0728bde67bdb 350 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 351 *
ADIJake 0:85855ecd3257 352 * @details This function attempts to read a fixed-value device register via
ADIJake 0:85855ecd3257 353 * the communication interface.
ADIJake 0:85855ecd3257 354 */
Vkadaba 5:0728bde67bdb 355 ADMW_RESULT admw_GetDeviceReadyState(
Vkadaba 5:0728bde67bdb 356 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 357 bool * const pbReady);
ADIJake 0:85855ecd3257 358
ADIJake 0:85855ecd3257 359 /*!
ADIJake 0:85855ecd3257 360 * @brief Obtain the product ID from the device.
ADIJake 0:85855ecd3257 361 *
Vkadaba 5:0728bde67bdb 362 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 363 * @param[out] pProductId Pointer to return the product ID value
ADIJake 0:85855ecd3257 364 *
ADIJake 0:85855ecd3257 365 * @return Status
Vkadaba 5:0728bde67bdb 366 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 367 *
ADIJake 0:85855ecd3257 368 * @details Reads the product ID registers on the device and returns the value.
ADIJake 0:85855ecd3257 369 */
Vkadaba 5:0728bde67bdb 370 ADMW_RESULT admw_GetProductID(
Vkadaba 5:0728bde67bdb 371 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 372 ADMW_PRODUCT_ID * const pProductId);
ADIJake 0:85855ecd3257 373
ADIJake 0:85855ecd3257 374 /*!
ADIJake 0:85855ecd3257 375 * @brief Write full configuration settings to the device registers.
ADIJake 0:85855ecd3257 376 *
Vkadaba 5:0728bde67bdb 377 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 378 * @param[out] pConfig Pointer to the configuration data structure
ADIJake 0:85855ecd3257 379 *
ADIJake 0:85855ecd3257 380 * @return Status
Vkadaba 5:0728bde67bdb 381 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 382 *
ADIJake 0:85855ecd3257 383 * @details Translates configuration details provided into device-specific
ADIJake 0:85855ecd3257 384 * register settings and updates device configuration registers.
ADIJake 0:85855ecd3257 385 *
Vkadaba 5:0728bde67bdb 386 * @note Settings are not applied until admw_ApplyConfigUpdates() is called
ADIJake 0:85855ecd3257 387 */
Vkadaba 5:0728bde67bdb 388 ADMW_RESULT admw_SetConfig(
Vkadaba 5:0728bde67bdb 389 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 390 ADMW_CONFIG * const pConfig);
ADIJake 0:85855ecd3257 391
ADIJake 0:85855ecd3257 392 /*!
ADIJake 0:85855ecd3257 393 * @brief Apply the configuration settings currently stored in device registers
ADIJake 0:85855ecd3257 394 *
Vkadaba 5:0728bde67bdb 395 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 396 *
ADIJake 0:85855ecd3257 397 * @return Status
Vkadaba 5:0728bde67bdb 398 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 399 *
Vkadaba 5:0728bde67bdb 400 * @details Instructs the ADMW device to reload and apply configuration
ADIJake 0:85855ecd3257 401 * from the device configuration registers. Changes to configuration
ADIJake 0:85855ecd3257 402 * registers are ignored by the device until this function is called.
ADIJake 0:85855ecd3257 403 *
ADIJake 0:85855ecd3257 404 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 405 */
Vkadaba 5:0728bde67bdb 406 ADMW_RESULT admw_ApplyConfigUpdates(
Vkadaba 5:0728bde67bdb 407 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 408
ADIJake 0:85855ecd3257 409 /*!
ADIJake 0:85855ecd3257 410 * @brief Store the configuration settings to persistent memory on the device.
ADIJake 0:85855ecd3257 411 *
Vkadaba 5:0728bde67bdb 412 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 413 * @param[in] eSlotId User configuration slot in persistent memory
ADIJake 0:85855ecd3257 414 *
ADIJake 0:85855ecd3257 415 * @return Status
Vkadaba 5:0728bde67bdb 416 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 417 *
Vkadaba 5:0728bde67bdb 418 * @details Instructs the ADMW device to save the current contents of its
ADIJake 0:85855ecd3257 419 * device configuration registers to non-volatile memory.
ADIJake 0:85855ecd3257 420 *
ADIJake 0:85855ecd3257 421 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 422 * @note Do not power down the device while this command is running.
ADIJake 0:85855ecd3257 423 */
Vkadaba 5:0728bde67bdb 424 ADMW_RESULT admw_SaveConfig(
Vkadaba 5:0728bde67bdb 425 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 426 ADMW_USER_CONFIG_SLOT const eSlotId);
ADIJake 0:85855ecd3257 427
ADIJake 0:85855ecd3257 428 /*!
ADIJake 0:85855ecd3257 429 * @brief Restore configuration settings from persistent memory on the device.
ADIJake 0:85855ecd3257 430 *
Vkadaba 5:0728bde67bdb 431 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 432 * @param[in] eSlotId User configuration slot in persistent memory
ADIJake 0:85855ecd3257 433 *
ADIJake 0:85855ecd3257 434 * @return Status
Vkadaba 5:0728bde67bdb 435 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 436 *
Vkadaba 5:0728bde67bdb 437 * @details Instructs the ADMW device to restore the contents of its
ADIJake 0:85855ecd3257 438 * device configuration registers from non-volatile memory.
ADIJake 0:85855ecd3257 439 *
ADIJake 0:85855ecd3257 440 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 441 */
Vkadaba 5:0728bde67bdb 442 ADMW_RESULT admw_RestoreConfig(
Vkadaba 5:0728bde67bdb 443 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 444 ADMW_USER_CONFIG_SLOT const eSlotId);
ADIJake 0:85855ecd3257 445
ADIJake 0:85855ecd3257 446 /*!
ADIJake 0:85855ecd3257 447 * @brief Erases the external flash memory.
ADIJake 0:85855ecd3257 448 *
Vkadaba 5:0728bde67bdb 449 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 450 *
ADIJake 0:85855ecd3257 451 * @return Status
Vkadaba 5:0728bde67bdb 452 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 453 *
ADIJake 0:85855ecd3257 454 * @details Sends the bulk erase instruction to the external flash
ADIJake 0:85855ecd3257 455 * device. All stored samples are deleted.
ADIJake 0:85855ecd3257 456 * It is a blocking operation and takes tens of seconds to
ADIJake 0:85855ecd3257 457 * complete.
ADIJake 0:85855ecd3257 458 *
ADIJake 0:85855ecd3257 459 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 460 */
Vkadaba 5:0728bde67bdb 461 ADMW_RESULT admw_EraseExternalFlash(
Vkadaba 5:0728bde67bdb 462 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 463
ADIJake 0:85855ecd3257 464 /*!
ADIJake 0:85855ecd3257 465 * @brief Gets the number of samples stored in the external flash
ADIJake 0:85855ecd3257 466 * memory.
ADIJake 0:85855ecd3257 467 *
Vkadaba 5:0728bde67bdb 468 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 469 * @param[in] pSampleCount Address of the return value.
ADIJake 0:85855ecd3257 470 *
ADIJake 0:85855ecd3257 471 * @return Status
Vkadaba 5:0728bde67bdb 472 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 473 *
ADIJake 0:85855ecd3257 474 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 475 */
Vkadaba 5:0728bde67bdb 476 ADMW_RESULT admw_GetExternalFlashSampleCount(
Vkadaba 5:0728bde67bdb 477 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 478 uint32_t * nSampleCount);
ADIJake 0:85855ecd3257 479
ADIJake 0:85855ecd3257 480 // DEBUG - TO BE DELETED
Vkadaba 5:0728bde67bdb 481 ADMW_RESULT admw_SetExternalFlashIndex(
Vkadaba 5:0728bde67bdb 482 ADMW_DEVICE_HANDLE const hDevice,
ADIJake 0:85855ecd3257 483 uint32_t nStartIndex);
ADIJake 0:85855ecd3257 484
ADIJake 0:85855ecd3257 485 /*!
ADIJake 0:85855ecd3257 486 * @brief Read measurement samples stored in the the external flash memory.
ADIJake 0:85855ecd3257 487 *
Vkadaba 5:0728bde67bdb 488 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 489 * @param[out] pSamples Pointer to return a set of requested data
ADIJake 0:85855ecd3257 490 * samples.
ADIJake 0:85855ecd3257 491 * @param[in] nStartIndex Index of first sample to retrieve.
ADIJake 0:85855ecd3257 492 * @param[in] nBytesPerSample The size, in bytes, of each sample.
ADIJake 0:85855ecd3257 493 * @param[in] nRequested Number of requested data samples.
ADIJake 0:85855ecd3257 494 * @param[out] pnReturned Number of valid data samples successfully
ADIJake 0:85855ecd3257 495 * retrieved.
ADIJake 0:85855ecd3257 496 *
ADIJake 0:85855ecd3257 497 * @return Status
Vkadaba 5:0728bde67bdb 498 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 499 *
ADIJake 0:85855ecd3257 500 * @details Reads the status registers and extracts the relevant information
ADIJake 0:85855ecd3257 501 * to return to the caller.
ADIJake 0:85855ecd3257 502 *
ADIJake 0:85855ecd3257 503 */
Vkadaba 5:0728bde67bdb 504 ADMW_RESULT admw_GetExternalFlashData(
Vkadaba 5:0728bde67bdb 505 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 506 ADMW_DATA_SAMPLE * const pSamples,
ADIJake 0:85855ecd3257 507 uint32_t const nIndex,
ADIJake 0:85855ecd3257 508 uint32_t const nRequested,
ADIJake 0:85855ecd3257 509 uint32_t * const pnReturned);
ADIJake 0:85855ecd3257 510
ADIJake 0:85855ecd3257 511 /*!
ADIJake 0:85855ecd3257 512 * @brief Store the LUT data to persistent memory on the device.
ADIJake 0:85855ecd3257 513 *
Vkadaba 5:0728bde67bdb 514 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 515 *
ADIJake 0:85855ecd3257 516 * @return Status
Vkadaba 5:0728bde67bdb 517 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 518 *
Vkadaba 5:0728bde67bdb 519 * @details Instructs the ADMW device to save the current contents of its
Vkadaba 5:0728bde67bdb 520 * LUT data buffer, set using @ref admw_SetLutData, to
ADIJake 0:85855ecd3257 521 * non-volatile memory.
ADIJake 0:85855ecd3257 522 *
ADIJake 0:85855ecd3257 523 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 524 * @note Do not power down the device while this command is running.
ADIJake 0:85855ecd3257 525 */
Vkadaba 5:0728bde67bdb 526 ADMW_RESULT admw_SaveLutData(
Vkadaba 5:0728bde67bdb 527 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 528
ADIJake 0:85855ecd3257 529 /*!
ADIJake 0:85855ecd3257 530 * @brief Restore LUT data from persistent memory on the device.
ADIJake 0:85855ecd3257 531 *
Vkadaba 5:0728bde67bdb 532 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 533 *
ADIJake 0:85855ecd3257 534 * @return Status
Vkadaba 5:0728bde67bdb 535 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 536 *
Vkadaba 5:0728bde67bdb 537 * @details Instructs the ADMW device to restore the contents of its
Vkadaba 5:0728bde67bdb 538 * LUT data, previously stored with @ref admw_SaveLutData, from
ADIJake 0:85855ecd3257 539 * non-volatile memory.
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_RestoreLutData(
Vkadaba 5:0728bde67bdb 544 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 545
ADIJake 0:85855ecd3257 546 /*!
ADIJake 0:85855ecd3257 547 * @brief Start the measurement cycles on the device.
ADIJake 0:85855ecd3257 548 *
Vkadaba 5:0728bde67bdb 549 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 550 * @param[in] eMeasurementMode Allows a choice of special modes for the
Vkadaba 5:0728bde67bdb 551 * measurement. See @ref ADMW_MEASUREMENT_MODE
ADIJake 0:85855ecd3257 552 * for further information.
ADIJake 0:85855ecd3257 553 *
ADIJake 0:85855ecd3257 554 * @return Status
Vkadaba 5:0728bde67bdb 555 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 556 *
Vkadaba 5:0728bde67bdb 557 * @details Instructs the ADMW device to start executing measurement cycles
ADIJake 0:85855ecd3257 558 * according to the current applied configuration settings. The
ADIJake 0:85855ecd3257 559 * DATAREADY status signal will be asserted whenever new measurement
ADIJake 0:85855ecd3257 560 * data is published, according to selected settings.
ADIJake 0:85855ecd3257 561 * Measurement cycles may be stopped by calling @ref
Vkadaba 5:0728bde67bdb 562 * admw_StopMeasurement.
ADIJake 0:85855ecd3257 563 *
ADIJake 0:85855ecd3257 564 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 565 */
Vkadaba 5:0728bde67bdb 566 ADMW_RESULT admw_StartMeasurement(
Vkadaba 5:0728bde67bdb 567 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 568 ADMW_MEASUREMENT_MODE const eMeasurementMode);
ADIJake 0:85855ecd3257 569
ADIJake 0:85855ecd3257 570 /*!
ADIJake 0:85855ecd3257 571 * @brief Stop the measurement cycles on the device.
ADIJake 0:85855ecd3257 572 *
Vkadaba 5:0728bde67bdb 573 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 574 *
ADIJake 0:85855ecd3257 575 * @return Status
Vkadaba 5:0728bde67bdb 576 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 577 *
Vkadaba 5:0728bde67bdb 578 * @details Instructs the ADMW device to stop executing measurement cycles.
ADIJake 0:85855ecd3257 579 * The command may be delayed until the current conversion, if any, has
ADIJake 0:85855ecd3257 580 * been completed and published.
ADIJake 0:85855ecd3257 581 *
ADIJake 0:85855ecd3257 582 * @note To be used only if a measurement command is currently running.
ADIJake 0:85855ecd3257 583 */
Vkadaba 5:0728bde67bdb 584 ADMW_RESULT admw_StopMeasurement(
Vkadaba 5:0728bde67bdb 585 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 586
ADIJake 0:85855ecd3257 587 /*!
ADIJake 0:85855ecd3257 588 * @brief Run built-in diagnostic checks on the device.
ADIJake 0:85855ecd3257 589 *
Vkadaba 5:0728bde67bdb 590 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 591 *
ADIJake 0:85855ecd3257 592 * @return Status
Vkadaba 5:0728bde67bdb 593 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 594 *
Vkadaba 5:0728bde67bdb 595 * @details Instructs the ADMW device to execute its built-in diagnostic
ADIJake 0:85855ecd3257 596 * tests, on any enabled measurement channels, according to the current
ADIJake 0:85855ecd3257 597 * applied configuration settings. Device status registers will be
ADIJake 0:85855ecd3257 598 * updated to indicate if any errors were detected by the diagnostics.
ADIJake 0:85855ecd3257 599 *
ADIJake 0:85855ecd3257 600 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 601 */
Vkadaba 5:0728bde67bdb 602 ADMW_RESULT admw_RunDiagnostics(
Vkadaba 5:0728bde67bdb 603 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 604
ADIJake 0:85855ecd3257 605 /*!
ADIJake 0:85855ecd3257 606 * @brief Run built-in calibration on the device.
ADIJake 0:85855ecd3257 607 *
Vkadaba 5:0728bde67bdb 608 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 609 *
ADIJake 0:85855ecd3257 610 * @return Status
Vkadaba 5:0728bde67bdb 611 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 612 *
Vkadaba 5:0728bde67bdb 613 * @details Instructs the ADMW device to execute its self-calibration
ADIJake 0:85855ecd3257 614 * routines, on any enabled measurement channels, according to the
ADIJake 0:85855ecd3257 615 * current applied configuration settings. Device status registers
ADIJake 0:85855ecd3257 616 * will be updated to indicate if any errors were detected.
ADIJake 0:85855ecd3257 617 *
ADIJake 0:85855ecd3257 618 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 619 */
Vkadaba 5:0728bde67bdb 620 ADMW_RESULT admw_RunCalibration(
Vkadaba 5:0728bde67bdb 621 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 622
ADIJake 0:85855ecd3257 623 /*!
ADIJake 0:85855ecd3257 624 * @brief Run built-in digital calibration on the device.
ADIJake 0:85855ecd3257 625 *
Vkadaba 5:0728bde67bdb 626 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 627 *
ADIJake 0:85855ecd3257 628 * @return Status
Vkadaba 5:0728bde67bdb 629 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 630 *
Vkadaba 5:0728bde67bdb 631 * @details Instructs the ADMW device to execute its calibration
ADIJake 0:85855ecd3257 632 * routines, on any enabled digital channels, according to the
ADIJake 0:85855ecd3257 633 * current applied configuration settings. Device status registers
ADIJake 0:85855ecd3257 634 * will be updated to indicate if any errors were detected.
ADIJake 0:85855ecd3257 635 *
ADIJake 0:85855ecd3257 636 * @note No other command must be running when this is called.
ADIJake 0:85855ecd3257 637 */
Vkadaba 5:0728bde67bdb 638 ADMW_RESULT admw_RunDigitalCalibration(
Vkadaba 5:0728bde67bdb 639 ADMW_DEVICE_HANDLE const hDevice);
ADIJake 0:85855ecd3257 640
ADIJake 0:85855ecd3257 641 /*!
ADIJake 0:85855ecd3257 642 * @brief Read the current status from the device registers.
ADIJake 0:85855ecd3257 643 *
Vkadaba 5:0728bde67bdb 644 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 645 * @param[out] pStatus Pointer to return the status summary obtained from the
ADIJake 0:85855ecd3257 646 * device.
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 may be called at any time, assuming the device is ready.
ADIJake 0:85855ecd3257 655 */
Vkadaba 5:0728bde67bdb 656 ADMW_RESULT admw_GetStatus(
Vkadaba 5:0728bde67bdb 657 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 658 ADMW_STATUS * const pStatus);
ADIJake 0:85855ecd3257 659
ADIJake 0:85855ecd3257 660 /*!
ADIJake 0:85855ecd3257 661 * @brief Read measurement data samples from the device registers.
ADIJake 0:85855ecd3257 662 *
Vkadaba 5:0728bde67bdb 663 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 664 * @param[in] eMeasurementMode Must be set to the same value used for @ref
Vkadaba 5:0728bde67bdb 665 * admw_StartMeasurement().
ADIJake 0:85855ecd3257 666 * @param[out] pSamples Pointer to return a set of requested data samples.
ADIJake 0:85855ecd3257 667 * @param[in] nBytesPerSample The size, in bytes, of each sample.
ADIJake 0:85855ecd3257 668 * @param[in] nRequested Number of requested data samples.
ADIJake 0:85855ecd3257 669 * @param[out] pnReturned Number of valid data samples successfully retrieved.
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 status registers and extracts the relevant information
ADIJake 0:85855ecd3257 675 * to return to the caller.
ADIJake 0:85855ecd3257 676 *
ADIJake 0:85855ecd3257 677 * @note This is intended to be called only when the DATAREADY status signal
ADIJake 0:85855ecd3257 678 * is asserted.
ADIJake 0:85855ecd3257 679 */
Vkadaba 5:0728bde67bdb 680 ADMW_RESULT admw_GetData(
Vkadaba 5:0728bde67bdb 681 ADMW_DEVICE_HANDLE const hDevice,
Vkadaba 5:0728bde67bdb 682 ADMW_MEASUREMENT_MODE const eMeasurementMode,
Vkadaba 5:0728bde67bdb 683 ADMW_DATA_SAMPLE * const pSamples,
ADIJake 0:85855ecd3257 684 uint8_t const nBytesPerSample,
ADIJake 0:85855ecd3257 685 uint32_t const nRequested,
ADIJake 0:85855ecd3257 686 uint32_t * const pnReturned);
ADIJake 0:85855ecd3257 687
ADIJake 0:85855ecd3257 688 /*!
ADIJake 0:85855ecd3257 689 * @brief Check if a command is currently running on the device.
ADIJake 0:85855ecd3257 690 *
Vkadaba 5:0728bde67bdb 691 * @param[in] hDevice ADMW device context handle
ADIJake 0:85855ecd3257 692 * @param[out] pbCommandRunning Pointer to return the command running status
ADIJake 0:85855ecd3257 693 *
ADIJake 0:85855ecd3257 694 * @return Status
Vkadaba 5:0728bde67bdb 695 * - #ADMW_SUCCESS Call completed successfully.
ADIJake 0:85855ecd3257 696 *
ADIJake 0:85855ecd3257 697 * @details Reads the device status register to check if a command is running.
ADIJake 0:85855ecd3257 698 */
Vkadaba 5:0728bde67bdb 699 ADMW_RESULT admw_GetCommandRunningState(
Vkadaba 5:0728bde67bdb 700 ADMW_DEVICE_HANDLE hDevice,
ADIJake 0:85855ecd3257 701 bool *pbCommandRunning);
ADIJake 0:85855ecd3257 702
Vkadaba 32:52445bef314d 703 ADMW_RESULT admw1001_sendRun( ADMW_DEVICE_HANDLE const hDevice);
Vkadaba 50:d84305e5e1c0 704 ADMW_RESULT admw_deviceInformation(ADMW_DEVICE_HANDLE hDevice);
Vkadaba 32:52445bef314d 705
ADIJake 0:85855ecd3257 706 #ifdef __cplusplus
ADIJake 0:85855ecd3257 707 }
ADIJake 0:85855ecd3257 708 #endif
ADIJake 0:85855ecd3257 709
ADIJake 0:85855ecd3257 710 /*!
ADIJake 0:85855ecd3257 711 * @}
ADIJake 0:85855ecd3257 712 */
ADIJake 0:85855ecd3257 713
Vkadaba 6:9d393a9677f4 714 #endif /* _ADMW_API_H__ */