Code clean up and handling FIFO errors

Committer:
Vkadaba
Date:
Thu Jul 25 11:46:20 2019 +0000
Revision:
14:266ab283b086
Parent:
13:97cb32670539
Child:
19:09d58952b65d
Added deviceInformation function to get the firmware version Id

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