Vybhav Kadaba
/
EV-PRO-MW1001_Development_updateFW
Bumped Mbed FW version to 01.20.0080
inc/admw_api.h@65:d91e1d63153d, 2020-04-14 (annotated)
- Committer:
- Vkadaba
- Date:
- Tue Apr 14 08:40:24 2020 +0000
- Revision:
- 65:d91e1d63153d
- Parent:
- 64:e8670e971e22
- Child:
- 70:420fac5132f5
modified the ADMW_SAMPLE enum to match the sensor_result enum ;
Who changed what in which revision?
User | Revision | Line number | New 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" |
Vkadaba | 54:31921ad29828 | 54 | #include "inc/admw1001/admw1001_lut_data.h" |
ADIJake | 0:85855ecd3257 | 55 | |
Vkadaba | 5:0728bde67bdb | 56 | /*! @defgroup ADMW_Api ADMW Host Library API |
Vkadaba | 5:0728bde67bdb | 57 | * Host library API common to the ADMW product family. |
ADIJake | 0:85855ecd3257 | 58 | * @{ |
ADIJake | 0:85855ecd3257 | 59 | */ |
ADIJake | 0:85855ecd3257 | 60 | |
ADIJake | 0:85855ecd3257 | 61 | #ifdef __cplusplus |
ADIJake | 0:85855ecd3257 | 62 | extern "C" { |
ADIJake | 0:85855ecd3257 | 63 | #endif |
ADIJake | 0:85855ecd3257 | 64 | |
Vkadaba | 5:0728bde67bdb | 65 | /*! A handle used in all API functions to identify the ADMW device. */ |
Vkadaba | 5:0728bde67bdb | 66 | typedef void* ADMW_DEVICE_HANDLE; |
Vkadaba | 14:266ab283b086 | 67 | |
Vkadaba | 13:97cb32670539 | 68 | #define SPI_BUFFER_SIZE 100u |
Vkadaba | 13:97cb32670539 | 69 | |
Vkadaba | 13:97cb32670539 | 70 | #define SFL_READ_STATUS_HDR_SIZE 14u |
Vkadaba | 13:97cb32670539 | 71 | |
Vkadaba | 13:97cb32670539 | 72 | #define SFL_READ_STATUS_RESPONSE_SIZE 42u |
ADIJake | 0:85855ecd3257 | 73 | |
Vkadaba | 5:0728bde67bdb | 74 | /*! Supported connection types for communication with the ADMW device. */ |
Vkadaba | 32:52445bef314d | 75 | typedef enum |
Vkadaba | 32:52445bef314d | 76 | { |
Vkadaba | 5:0728bde67bdb | 77 | ADMW_CONNECTION_TYPE_SPI = 1, |
ADIJake | 0:85855ecd3257 | 78 | /*!< Serial Peripheral Interface (SPI) connection type */ |
Vkadaba | 32:52445bef314d | 79 | |
Vkadaba | 32:52445bef314d | 80 | } ADMW_CONNECTION_TYPE; |
ADIJake | 0:85855ecd3257 | 81 | |
Vkadaba | 5:0728bde67bdb | 82 | /*! Connection details for communication with a ADMW device instance. */ |
Vkadaba | 32:52445bef314d | 83 | typedef struct |
Vkadaba | 32:52445bef314d | 84 | { |
Vkadaba | 5:0728bde67bdb | 85 | ADMW_CONNECTION_TYPE type; |
ADIJake | 0:85855ecd3257 | 86 | /*!< Connection type selection */ |
Vkadaba | 5:0728bde67bdb | 87 | ADMW_PLATFORM_SPI_CONFIG spi; |
ADIJake | 0:85855ecd3257 | 88 | /*!< SPI connection parameters, required if SPI connection type is used */ |
Vkadaba | 5:0728bde67bdb | 89 | ADMW_PLATFORM_GPIO_CONFIG gpio; |
ADIJake | 0:85855ecd3257 | 90 | /*!< GPIO connection parameters, for device reset and status I/O signals */ |
Vkadaba | 5:0728bde67bdb | 91 | ADMW_PLATFORM_LOG_CONFIG log; |
ADIJake | 0:85855ecd3257 | 92 | /*!< Log interface connection parameters, for display/routing of log messages */ |
Vkadaba | 32:52445bef314d | 93 | |
Vkadaba | 32:52445bef314d | 94 | } ADMW_CONNECTION; |
ADIJake | 0:85855ecd3257 | 95 | |
ADIJake | 0:85855ecd3257 | 96 | /*! Bit masks (flags) for the different device status indicators. */ |
Vkadaba | 32:52445bef314d | 97 | typedef enum |
Vkadaba | 32:52445bef314d | 98 | { |
Vkadaba | 5:0728bde67bdb | 99 | ADMW_DEVICE_STATUS_BUSY = (1 << 0), |
ADIJake | 0:85855ecd3257 | 100 | /*!< Indicates that a command is currently running on the device */ |
Vkadaba | 5:0728bde67bdb | 101 | ADMW_DEVICE_STATUS_DATAREADY = (1 << 1), |
ADIJake | 0:85855ecd3257 | 102 | /*!< Indicates the availability of measurement data for retrieval */ |
Vkadaba | 5:0728bde67bdb | 103 | ADMW_DEVICE_STATUS_ERROR = (1 << 2), |
ADIJake | 0:85855ecd3257 | 104 | /*!< Indicates that an error condition has been detected by the device */ |
Vkadaba | 5:0728bde67bdb | 105 | ADMW_DEVICE_STATUS_ALERT = (1 << 3), |
ADIJake | 0:85855ecd3257 | 106 | /*!< Indicates that an alert condition has been detected by the device */ |
Vkadaba | 5:0728bde67bdb | 107 | ADMW_DEVICE_STATUS_FIFO_ERROR = (1 << 4), |
ADIJake | 0:85855ecd3257 | 108 | /*!< Indicates that a FIFO error condition has been detected by the device */ |
Vkadaba | 5:0728bde67bdb | 109 | ADMW_DEVICE_STATUS_CONFIG_ERROR = (1 << 5), |
ADIJake | 0:85855ecd3257 | 110 | /*!< Indicates that a configuration error condition has been detected by the device */ |
Vkadaba | 5:0728bde67bdb | 111 | ADMW_DEVICE_STATUS_LUT_ERROR = (1 << 6), |
ADIJake | 0:85855ecd3257 | 112 | /*!< Indicates that a look-up table error condition has been detected by the device */ |
Vkadaba | 32:52445bef314d | 113 | |
Vkadaba | 32:52445bef314d | 114 | } ADMW_DEVICE_STATUS_FLAGS; |
ADIJake | 0:85855ecd3257 | 115 | |
ADIJake | 0:85855ecd3257 | 116 | |
ADIJake | 0:85855ecd3257 | 117 | /*! Bit masks (flags) for the different channel alert indicators. */ |
Vkadaba | 32:52445bef314d | 118 | typedef enum |
Vkadaba | 32:52445bef314d | 119 | { |
Vkadaba | 32:52445bef314d | 120 | ADMW_ALERT_DETAIL_CH_RESULT_VALID = (1 << 0), |
Vkadaba | 32:52445bef314d | 121 | /*!< Indicates valid result in the channel */ |
Vkadaba | 32:52445bef314d | 122 | ADMW_ALERT_DETAIL_CH_ADC_NEAR_OVERRANGE = (1 << 1), |
Vkadaba | 32:52445bef314d | 123 | /*!< Indicates ADC is near overrange in the channel */ |
Vkadaba | 32:52445bef314d | 124 | ADMW_ALERT_DETAIL_CH_SENSOR_UNDERRANGE = (1 << 2), |
Vkadaba | 32:52445bef314d | 125 | /*!< Indicates sensor underrange in the channel */ |
Vkadaba | 32:52445bef314d | 126 | ADMW_ALERT_DETAIL_CH_SENSOR_OVERRANGE = (1 << 3), |
Vkadaba | 32:52445bef314d | 127 | /*!< Indicates sensor overrange in the channel */ |
Vkadaba | 32:52445bef314d | 128 | ADMW_ALERT_DETAIL_CH_CJ_SOFT_FAULT = (1 << 4), |
Vkadaba | 32:52445bef314d | 129 | /*!< Indicates Cold Junction soft fault in the channel */ |
Vkadaba | 32:52445bef314d | 130 | ADMW_ALERT_DETAIL_CH_CJ_HARD_FAULT = (1 << 5), |
Vkadaba | 32:52445bef314d | 131 | /*!< Indicates Cold Junction Hard Fault in the channel */ |
Vkadaba | 32:52445bef314d | 132 | ADMW_ALERT_DETAIL_CH_ADC_INPUT_OVERRANGE = (1 << 6), |
Vkadaba | 32:52445bef314d | 133 | /*!< Indicates ADC Input overrange in the channel */ |
Vkadaba | 32:52445bef314d | 134 | ADMW_ALERT_DETAIL_CH_SENSOR_HARDFAULT = (1 << 7), |
Vkadaba | 32:52445bef314d | 135 | /*!< Indicates Hard Fault in the channel */ |
Vkadaba | 32:52445bef314d | 136 | } ADMW_CHANNEL_ALERT_FLAGS; |
ADIJake | 0:85855ecd3257 | 137 | |
Vkadaba | 5:0728bde67bdb | 138 | /*! Status details retreived from the ADMW device. */ |
Vkadaba | 32:52445bef314d | 139 | typedef struct |
Vkadaba | 32:52445bef314d | 140 | { |
Vkadaba | 5:0728bde67bdb | 141 | ADMW_DEVICE_STATUS_FLAGS deviceStatus; |
ADIJake | 0:85855ecd3257 | 142 | /*!< General summary status information from the device */ |
Vkadaba | 32:52445bef314d | 143 | ADMW_CHANNEL_ALERT_FLAGS channelAlerts[ADMW1001_MAX_CHANNELS]; |
ADIJake | 0:85855ecd3257 | 144 | /*!< Per-channel alert status information from the device */ |
Vkadaba | 32:52445bef314d | 145 | uint32_t errorCode; |
ADIJake | 0:85855ecd3257 | 146 | /*!< Code identifying the last error signalled by the device */ |
Vkadaba | 32:52445bef314d | 147 | uint32_t alertCode; |
ADIJake | 0:85855ecd3257 | 148 | /*!< Code identifying the last alert signalled by the device */ |
Vkadaba | 32:52445bef314d | 149 | uint32_t debugCode; |
ADIJake | 0:85855ecd3257 | 150 | /*!< Supplementary code related to the last error/alert */ |
Vkadaba | 32:52445bef314d | 151 | uint32_t channelAlertCodes[ADMW1001_MAX_CHANNELS]; |
ADIJake | 0:85855ecd3257 | 152 | /*!< Per-channel code identifying the last alert signalled for each channel */ |
Vkadaba | 32:52445bef314d | 153 | |
Vkadaba | 32:52445bef314d | 154 | } ADMW_STATUS; |
ADIJake | 0:85855ecd3257 | 155 | |
Vkadaba | 5:0728bde67bdb | 156 | /*! Data sample details retreived from the ADMW device. */ |
Vkadaba | 32:52445bef314d | 157 | typedef struct |
Vkadaba | 32:52445bef314d | 158 | { |
Vkadaba | 32:52445bef314d | 159 | float32_t processedValue; |
ADIJake | 0:85855ecd3257 | 160 | /*!< The processed value obtained from the measurement channel, as a final |
ADIJake | 0:85855ecd3257 | 161 | * measurement value, following calibration and linearisation correction, |
ADIJake | 0:85855ecd3257 | 162 | * and conversion into an appropriate unit of measurement. |
ADIJake | 0:85855ecd3257 | 163 | */ |
Vkadaba | 65:d91e1d63153d | 164 | uint32_t Channel_ID : 4; /**< Indicates which channel this result corresponds to */ |
Vkadaba | 65:d91e1d63153d | 165 | uint32_t Ch_Error : 1; /**< Indicates Error on channel */ |
Vkadaba | 65:d91e1d63153d | 166 | uint32_t Ch_Alert : 1; /**< Indicates Alert on channel */ |
Vkadaba | 65:d91e1d63153d | 167 | uint32_t Ch_Raw : 1; /**< Indicates if Raw sensor data field is valid */ |
Vkadaba | 65:d91e1d63153d | 168 | uint32_t Ch_Valid : 1; /**< Indicates if this Result structure is valid */ |
Vkadaba | 65:d91e1d63153d | 169 | uint32_t Status : 8; /**< Indicates the Status of this measurement */ |
Vkadaba | 65:d91e1d63153d | 170 | uint32_t Reserved : 16; /**< Reserved for future use */ |
Vkadaba | 65:d91e1d63153d | 171 | float32_t Raw_Sample; |
Vkadaba | 65:d91e1d63153d | 172 | /*!< The raw value obtained from the measurement channel, before |
Vkadaba | 65:d91e1d63153d | 173 | * calibration and linearisation correction, and conversion. |
Vkadaba | 65:d91e1d63153d | 174 | */ |
Vkadaba | 32:52445bef314d | 175 | |
Vkadaba | 32:52445bef314d | 176 | } ADMW_DATA_SAMPLE; |
ADIJake | 0:85855ecd3257 | 177 | |
Vkadaba | 5:0728bde67bdb | 178 | /*! Measurement mode options for the ADMW device. |
Vkadaba | 5:0728bde67bdb | 179 | * @ref admw_StartMeasurement |
ADIJake | 0:85855ecd3257 | 180 | */ |
Vkadaba | 32:52445bef314d | 181 | typedef enum |
Vkadaba | 32:52445bef314d | 182 | { |
Vkadaba | 6:9d393a9677f4 | 183 | ADMW_MEASUREMENT_MODE_NORMAL = 0, |
ADIJake | 0:85855ecd3257 | 184 | /*!< In this mode, normal measurement cycle(s) are executed and data samples |
ADIJake | 0:85855ecd3257 | 185 | * are returned with raw measurement values included. */ |
Vkadaba | 5:0728bde67bdb | 186 | ADMW_MEASUREMENT_MODE_OMIT_RAW, |
ADIJake | 0:85855ecd3257 | 187 | /*!< In this mode, normal measurement cycle(s) are executed and data samples |
ADIJake | 0:85855ecd3257 | 188 | * are returned with raw measurement values omitted for efficiency. */ |
Vkadaba | 32:52445bef314d | 189 | |
Vkadaba | 32:52445bef314d | 190 | } ADMW_MEASUREMENT_MODE; |
ADIJake | 0:85855ecd3257 | 191 | |
ADIJake | 0:85855ecd3257 | 192 | /*! Identifiers for the user configuration slots in persistent memory. */ |
Vkadaba | 32:52445bef314d | 193 | typedef enum |
Vkadaba | 32:52445bef314d | 194 | { |
Vkadaba | 5:0728bde67bdb | 195 | ADMW_FLASH_CONFIG_1, |
Vkadaba | 32:52445bef314d | 196 | |
Vkadaba | 32:52445bef314d | 197 | } ADMW_USER_CONFIG_SLOT; |
Vkadaba | 32:52445bef314d | 198 | |
Vkadaba | 50:d84305e5e1c0 | 199 | /*! Identifiers for the user configuration slots in persistent memory. */ |
Vkadaba | 50:d84305e5e1c0 | 200 | typedef enum |
Vkadaba | 50:d84305e5e1c0 | 201 | { |
Vkadaba | 50:d84305e5e1c0 | 202 | ADMW_FLASH_LUT_CHANNEL_0=0, |
Vkadaba | 50:d84305e5e1c0 | 203 | ADMW_FLASH_LUT_CHANNEL_1, |
Vkadaba | 50:d84305e5e1c0 | 204 | ADMW_FLASH_LUT_CHANNEL_2, |
Vkadaba | 50:d84305e5e1c0 | 205 | ADMW_FLASH_LUT_CHANNEL_3, |
Vkadaba | 50:d84305e5e1c0 | 206 | |
Vkadaba | 32:52445bef314d | 207 | |
Vkadaba | 50:d84305e5e1c0 | 208 | } ADMW_USER_LUT_CONFIG_SLOT; |
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 Store the LUT data to persistent memory on the device. |
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 | * |
Vkadaba | 5:0728bde67bdb | 443 | * @details Instructs the ADMW device to save the current contents of its |
Vkadaba | 5:0728bde67bdb | 444 | * LUT data buffer, set using @ref admw_SetLutData, to |
ADIJake | 0:85855ecd3257 | 445 | * non-volatile memory. |
ADIJake | 0:85855ecd3257 | 446 | * |
ADIJake | 0:85855ecd3257 | 447 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 448 | * @note Do not power down the device while this command is running. |
ADIJake | 0:85855ecd3257 | 449 | */ |
Vkadaba | 5:0728bde67bdb | 450 | ADMW_RESULT admw_SaveLutData( |
Vkadaba | 5:0728bde67bdb | 451 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 452 | |
ADIJake | 0:85855ecd3257 | 453 | /*! |
ADIJake | 0:85855ecd3257 | 454 | * @brief Restore LUT data from persistent memory on the device. |
ADIJake | 0:85855ecd3257 | 455 | * |
Vkadaba | 5:0728bde67bdb | 456 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 457 | * |
ADIJake | 0:85855ecd3257 | 458 | * @return Status |
Vkadaba | 5:0728bde67bdb | 459 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 460 | * |
Vkadaba | 5:0728bde67bdb | 461 | * @details Instructs the ADMW device to restore the contents of its |
Vkadaba | 5:0728bde67bdb | 462 | * LUT data, previously stored with @ref admw_SaveLutData, from |
ADIJake | 0:85855ecd3257 | 463 | * non-volatile memory. |
ADIJake | 0:85855ecd3257 | 464 | * |
ADIJake | 0:85855ecd3257 | 465 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 466 | */ |
Vkadaba | 5:0728bde67bdb | 467 | ADMW_RESULT admw_RestoreLutData( |
Vkadaba | 5:0728bde67bdb | 468 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 469 | |
ADIJake | 0:85855ecd3257 | 470 | /*! |
ADIJake | 0:85855ecd3257 | 471 | * @brief Start the measurement cycles on the device. |
ADIJake | 0:85855ecd3257 | 472 | * |
Vkadaba | 5:0728bde67bdb | 473 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 474 | * @param[in] eMeasurementMode Allows a choice of special modes for the |
Vkadaba | 5:0728bde67bdb | 475 | * measurement. See @ref ADMW_MEASUREMENT_MODE |
ADIJake | 0:85855ecd3257 | 476 | * for further information. |
ADIJake | 0:85855ecd3257 | 477 | * |
ADIJake | 0:85855ecd3257 | 478 | * @return Status |
Vkadaba | 5:0728bde67bdb | 479 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 480 | * |
Vkadaba | 5:0728bde67bdb | 481 | * @details Instructs the ADMW device to start executing measurement cycles |
ADIJake | 0:85855ecd3257 | 482 | * according to the current applied configuration settings. The |
ADIJake | 0:85855ecd3257 | 483 | * DATAREADY status signal will be asserted whenever new measurement |
ADIJake | 0:85855ecd3257 | 484 | * data is published, according to selected settings. |
ADIJake | 0:85855ecd3257 | 485 | * Measurement cycles may be stopped by calling @ref |
Vkadaba | 5:0728bde67bdb | 486 | * admw_StopMeasurement. |
ADIJake | 0:85855ecd3257 | 487 | * |
ADIJake | 0:85855ecd3257 | 488 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 489 | */ |
Vkadaba | 5:0728bde67bdb | 490 | ADMW_RESULT admw_StartMeasurement( |
Vkadaba | 5:0728bde67bdb | 491 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 492 | ADMW_MEASUREMENT_MODE const eMeasurementMode); |
ADIJake | 0:85855ecd3257 | 493 | |
ADIJake | 0:85855ecd3257 | 494 | /*! |
ADIJake | 0:85855ecd3257 | 495 | * @brief Stop the measurement cycles on the device. |
ADIJake | 0:85855ecd3257 | 496 | * |
Vkadaba | 5:0728bde67bdb | 497 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 498 | * |
ADIJake | 0:85855ecd3257 | 499 | * @return Status |
Vkadaba | 5:0728bde67bdb | 500 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 501 | * |
Vkadaba | 5:0728bde67bdb | 502 | * @details Instructs the ADMW device to stop executing measurement cycles. |
ADIJake | 0:85855ecd3257 | 503 | * The command may be delayed until the current conversion, if any, has |
ADIJake | 0:85855ecd3257 | 504 | * been completed and published. |
ADIJake | 0:85855ecd3257 | 505 | * |
ADIJake | 0:85855ecd3257 | 506 | * @note To be used only if a measurement command is currently running. |
ADIJake | 0:85855ecd3257 | 507 | */ |
Vkadaba | 5:0728bde67bdb | 508 | ADMW_RESULT admw_StopMeasurement( |
Vkadaba | 5:0728bde67bdb | 509 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 510 | |
ADIJake | 0:85855ecd3257 | 511 | /*! |
ADIJake | 0:85855ecd3257 | 512 | * @brief Run built-in diagnostic checks 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 execute its built-in diagnostic |
ADIJake | 0:85855ecd3257 | 520 | * tests, on any enabled measurement channels, according to the current |
ADIJake | 0:85855ecd3257 | 521 | * applied configuration settings. Device status registers will be |
ADIJake | 0:85855ecd3257 | 522 | * updated to indicate if any errors were detected by the diagnostics. |
ADIJake | 0:85855ecd3257 | 523 | * |
ADIJake | 0:85855ecd3257 | 524 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 525 | */ |
Vkadaba | 5:0728bde67bdb | 526 | ADMW_RESULT admw_RunDiagnostics( |
Vkadaba | 5:0728bde67bdb | 527 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 528 | |
ADIJake | 0:85855ecd3257 | 529 | /*! |
ADIJake | 0:85855ecd3257 | 530 | * @brief Run built-in calibration 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 execute its self-calibration |
ADIJake | 0:85855ecd3257 | 538 | * routines, on any enabled measurement channels, according to the |
ADIJake | 0:85855ecd3257 | 539 | * current applied configuration settings. Device status registers |
ADIJake | 0:85855ecd3257 | 540 | * will be updated to indicate if any errors were detected. |
ADIJake | 0:85855ecd3257 | 541 | * |
ADIJake | 0:85855ecd3257 | 542 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 543 | */ |
Vkadaba | 5:0728bde67bdb | 544 | ADMW_RESULT admw_RunCalibration( |
Vkadaba | 5:0728bde67bdb | 545 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 546 | |
ADIJake | 0:85855ecd3257 | 547 | /*! |
ADIJake | 0:85855ecd3257 | 548 | * @brief Run built-in digital calibration on the device. |
ADIJake | 0:85855ecd3257 | 549 | * |
Vkadaba | 5:0728bde67bdb | 550 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 551 | * |
ADIJake | 0:85855ecd3257 | 552 | * @return Status |
Vkadaba | 5:0728bde67bdb | 553 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 554 | * |
Vkadaba | 5:0728bde67bdb | 555 | * @details Instructs the ADMW device to execute its calibration |
ADIJake | 0:85855ecd3257 | 556 | * routines, on any enabled digital channels, according to the |
ADIJake | 0:85855ecd3257 | 557 | * current applied configuration settings. Device status registers |
ADIJake | 0:85855ecd3257 | 558 | * will be updated to indicate if any errors were detected. |
ADIJake | 0:85855ecd3257 | 559 | * |
ADIJake | 0:85855ecd3257 | 560 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 561 | */ |
Vkadaba | 5:0728bde67bdb | 562 | ADMW_RESULT admw_RunDigitalCalibration( |
Vkadaba | 5:0728bde67bdb | 563 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 564 | |
ADIJake | 0:85855ecd3257 | 565 | /*! |
ADIJake | 0:85855ecd3257 | 566 | * @brief Read the current status from the device registers. |
ADIJake | 0:85855ecd3257 | 567 | * |
Vkadaba | 5:0728bde67bdb | 568 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 569 | * @param[out] pStatus Pointer to return the status summary obtained from the |
ADIJake | 0:85855ecd3257 | 570 | * device. |
ADIJake | 0:85855ecd3257 | 571 | * |
ADIJake | 0:85855ecd3257 | 572 | * @return Status |
Vkadaba | 5:0728bde67bdb | 573 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 574 | * |
ADIJake | 0:85855ecd3257 | 575 | * @details Reads the status registers and extracts the relevant information |
ADIJake | 0:85855ecd3257 | 576 | * to return to the caller. |
ADIJake | 0:85855ecd3257 | 577 | * |
ADIJake | 0:85855ecd3257 | 578 | * @note This may be called at any time, assuming the device is ready. |
ADIJake | 0:85855ecd3257 | 579 | */ |
Vkadaba | 5:0728bde67bdb | 580 | ADMW_RESULT admw_GetStatus( |
Vkadaba | 5:0728bde67bdb | 581 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 582 | ADMW_STATUS * const pStatus); |
ADIJake | 0:85855ecd3257 | 583 | |
ADIJake | 0:85855ecd3257 | 584 | /*! |
Vkadaba | 54:31921ad29828 | 585 | * @brief Assemble a list of separate Look-Up Tables into a single buffer |
Vkadaba | 54:31921ad29828 | 586 | * |
Vkadaba | 54:31921ad29828 | 587 | * @param[out] pLutBuffer Pointer to the Look-Up Table data buffer where |
Vkadaba | 54:31921ad29828 | 588 | * the assembled Look-Up Table data will be placed |
Vkadaba | 54:31921ad29828 | 589 | * @param[in] nLutBufferSize Allocated size, in bytes, of the output data buffer |
Vkadaba | 54:31921ad29828 | 590 | * @param[in] nNumTables Number of tables to add to the Look-Up Table buffer |
Vkadaba | 54:31921ad29828 | 591 | * @param[in] ppDesc Array of pointers to the table descriptors to be added |
Vkadaba | 54:31921ad29828 | 592 | * @param[in] ppData Array of pointers to the table data to be added |
Vkadaba | 54:31921ad29828 | 593 | * |
Vkadaba | 54:31921ad29828 | 594 | * @return Status |
Vkadaba | 54:31921ad29828 | 595 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 54:31921ad29828 | 596 | * |
Vkadaba | 54:31921ad29828 | 597 | * @details This utiliity function fills the Look-up Table header fields; then |
Vkadaba | 54:31921ad29828 | 598 | * walks through the array of individual table descriptor and data |
Vkadaba | 54:31921ad29828 | 599 | * pointers provided, appending (copying) each one to the Look-Up Table |
Vkadaba | 54:31921ad29828 | 600 | * data buffer. The length and crc16 fields of each table descriptor |
Vkadaba | 54:31921ad29828 | 601 | * will be calculated and filled by this function, but other fields in |
Vkadaba | 54:31921ad29828 | 602 | * the descriptor structure must be filled by the caller beforehand. |
Vkadaba | 54:31921ad29828 | 603 | * |
Vkadaba | 54:31921ad29828 | 604 | * @note The assembled LUT data buffer filled by this function can then be |
Vkadaba | 54:31921ad29828 | 605 | * written to the device memory using @ref admw1001_SetLutData. |
Vkadaba | 54:31921ad29828 | 606 | */ |
Vkadaba | 54:31921ad29828 | 607 | ADMW_RESULT admw1001_AssembleLutData( |
Vkadaba | 54:31921ad29828 | 608 | ADMW1001_LUT *pLutBuffer, |
Vkadaba | 54:31921ad29828 | 609 | unsigned nLutBufferSize, |
Vkadaba | 54:31921ad29828 | 610 | unsigned const nNumTables, |
Vkadaba | 54:31921ad29828 | 611 | ADMW1001_LUT_DESCRIPTOR *const ppDesc[], |
Vkadaba | 54:31921ad29828 | 612 | ADMW1001_LUT_TABLE_DATA *const ppData[]); |
Vkadaba | 54:31921ad29828 | 613 | |
Vkadaba | 54:31921ad29828 | 614 | /*! |
Vkadaba | 54:31921ad29828 | 615 | * @brief Write Look-Up Table data to the device memory |
Vkadaba | 54:31921ad29828 | 616 | * |
Vkadaba | 54:31921ad29828 | 617 | * @param[in] hDevice ADMW1001 device context handle |
Vkadaba | 54:31921ad29828 | 618 | * @param[out] pLutData Pointer to the Look-Up Table data structure |
Vkadaba | 54:31921ad29828 | 619 | * |
Vkadaba | 54:31921ad29828 | 620 | * @return Status |
Vkadaba | 54:31921ad29828 | 621 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 54:31921ad29828 | 622 | * |
Vkadaba | 54:31921ad29828 | 623 | * @details Validates the Look-Up Table data format and loads it into |
Vkadaba | 54:31921ad29828 | 624 | * device memory via dedicated keyhole registers. |
Vkadaba | 54:31921ad29828 | 625 | * |
Vkadaba | 54:31921ad29828 | 626 | * @note Settings are not applied until admw_ApplyConfigUpdates() is called |
Vkadaba | 54:31921ad29828 | 627 | */ |
Vkadaba | 54:31921ad29828 | 628 | ADMW_RESULT admw1001_SetLutData( |
Vkadaba | 54:31921ad29828 | 629 | ADMW_DEVICE_HANDLE hDevice, |
Vkadaba | 54:31921ad29828 | 630 | ADMW1001_LUT *const pLutData); |
Vkadaba | 54:31921ad29828 | 631 | |
Vkadaba | 54:31921ad29828 | 632 | /*! |
Vkadaba | 54:31921ad29828 | 633 | * @brief Write Look-Up Table raw data to the device memory |
Vkadaba | 54:31921ad29828 | 634 | * |
Vkadaba | 54:31921ad29828 | 635 | * @param[in] hDevice ADMW device context handle |
Vkadaba | 54:31921ad29828 | 636 | * @param[out] pLutData Pointer to the Look-Up Table raw data structure |
Vkadaba | 54:31921ad29828 | 637 | * |
Vkadaba | 54:31921ad29828 | 638 | * @return Status |
Vkadaba | 54:31921ad29828 | 639 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 54:31921ad29828 | 640 | * |
Vkadaba | 54:31921ad29828 | 641 | * @details This can be used instead of @ref admw1001_SetLutData for |
Vkadaba | 54:31921ad29828 | 642 | * loading LUT data from the alternative raw data format. See |
Vkadaba | 54:31921ad29828 | 643 | * @ref admw1001_SetLutData for more information. |
Vkadaba | 54:31921ad29828 | 644 | * |
Vkadaba | 54:31921ad29828 | 645 | * @note Settings are not applied until admw_ApplyConfigUpdates() is called |
Vkadaba | 54:31921ad29828 | 646 | */ |
Vkadaba | 54:31921ad29828 | 647 | ADMW_RESULT admw1001_SetLutDataRaw( |
Vkadaba | 54:31921ad29828 | 648 | ADMW_DEVICE_HANDLE hDevice, |
Vkadaba | 54:31921ad29828 | 649 | ADMW1001_LUT_RAW *const pLutData); |
Vkadaba | 54:31921ad29828 | 650 | /*! |
ADIJake | 0:85855ecd3257 | 651 | * @brief Read measurement data samples from the device registers. |
ADIJake | 0:85855ecd3257 | 652 | * |
Vkadaba | 5:0728bde67bdb | 653 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 654 | * @param[in] eMeasurementMode Must be set to the same value used for @ref |
Vkadaba | 5:0728bde67bdb | 655 | * admw_StartMeasurement(). |
ADIJake | 0:85855ecd3257 | 656 | * @param[out] pSamples Pointer to return a set of requested data samples. |
ADIJake | 0:85855ecd3257 | 657 | * @param[in] nBytesPerSample The size, in bytes, of each sample. |
ADIJake | 0:85855ecd3257 | 658 | * @param[in] nRequested Number of requested data samples. |
ADIJake | 0:85855ecd3257 | 659 | * @param[out] pnReturned Number of valid data samples successfully retrieved. |
ADIJake | 0:85855ecd3257 | 660 | * |
ADIJake | 0:85855ecd3257 | 661 | * @return Status |
Vkadaba | 5:0728bde67bdb | 662 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 663 | * |
ADIJake | 0:85855ecd3257 | 664 | * @details Reads the status registers and extracts the relevant information |
ADIJake | 0:85855ecd3257 | 665 | * to return to the caller. |
ADIJake | 0:85855ecd3257 | 666 | * |
ADIJake | 0:85855ecd3257 | 667 | * @note This is intended to be called only when the DATAREADY status signal |
ADIJake | 0:85855ecd3257 | 668 | * is asserted. |
ADIJake | 0:85855ecd3257 | 669 | */ |
Vkadaba | 5:0728bde67bdb | 670 | ADMW_RESULT admw_GetData( |
Vkadaba | 5:0728bde67bdb | 671 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 672 | ADMW_MEASUREMENT_MODE const eMeasurementMode, |
Vkadaba | 5:0728bde67bdb | 673 | ADMW_DATA_SAMPLE * const pSamples, |
ADIJake | 0:85855ecd3257 | 674 | uint8_t const nBytesPerSample, |
ADIJake | 0:85855ecd3257 | 675 | uint32_t const nRequested, |
ADIJake | 0:85855ecd3257 | 676 | uint32_t * const pnReturned); |
ADIJake | 0:85855ecd3257 | 677 | |
ADIJake | 0:85855ecd3257 | 678 | /*! |
ADIJake | 0:85855ecd3257 | 679 | * @brief Check if a command is currently running on the device. |
ADIJake | 0:85855ecd3257 | 680 | * |
Vkadaba | 5:0728bde67bdb | 681 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 682 | * @param[out] pbCommandRunning Pointer to return the command running status |
ADIJake | 0:85855ecd3257 | 683 | * |
ADIJake | 0:85855ecd3257 | 684 | * @return Status |
Vkadaba | 5:0728bde67bdb | 685 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 686 | * |
ADIJake | 0:85855ecd3257 | 687 | * @details Reads the device status register to check if a command is running. |
ADIJake | 0:85855ecd3257 | 688 | */ |
Vkadaba | 5:0728bde67bdb | 689 | ADMW_RESULT admw_GetCommandRunningState( |
Vkadaba | 5:0728bde67bdb | 690 | ADMW_DEVICE_HANDLE hDevice, |
ADIJake | 0:85855ecd3257 | 691 | bool *pbCommandRunning); |
ADIJake | 0:85855ecd3257 | 692 | |
Vkadaba | 32:52445bef314d | 693 | ADMW_RESULT admw1001_sendRun( ADMW_DEVICE_HANDLE const hDevice); |
Vkadaba | 50:d84305e5e1c0 | 694 | ADMW_RESULT admw_deviceInformation(ADMW_DEVICE_HANDLE hDevice); |
Vkadaba | 53:644c5f6300da | 695 | |
ADIJake | 0:85855ecd3257 | 696 | #ifdef __cplusplus |
ADIJake | 0:85855ecd3257 | 697 | } |
ADIJake | 0:85855ecd3257 | 698 | #endif |
ADIJake | 0:85855ecd3257 | 699 | |
ADIJake | 0:85855ecd3257 | 700 | /*! |
ADIJake | 0:85855ecd3257 | 701 | * @} |
ADIJake | 0:85855ecd3257 | 702 | */ |
ADIJake | 0:85855ecd3257 | 703 | |
Vkadaba | 6:9d393a9677f4 | 704 | #endif /* _ADMW_API_H__ */ |