Vybhav Kadaba
/
EV-PRO-MW1001_Development
added wait_us(31) in admw_spi.cpp to support hibernation mode
inc/admw_api.h@60:363fffe5bd22, 2020-03-16 (annotated)
- Committer:
- Vkadaba
- Date:
- Mon Mar 16 09:54:36 2020 +0000
- Revision:
- 60:363fffe5bd22
- Parent:
- 56:38b36e947602
Added wait_us(31) in admw_spi.cpp when hibernation mode is enabled
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 | /*! Bit masks (flags) for the different diagnostics status indicators. */ |
Vkadaba | 32:52445bef314d | 117 | typedef enum |
Vkadaba | 32:52445bef314d | 118 | { |
Vkadaba | 5:0728bde67bdb | 119 | ADMW_DIAGNOSTICS_STATUS_CHECKSUM_ERROR = (1 << 0), |
ADIJake | 0:85855ecd3257 | 120 | /*!< Indicates Error on Internal Checksum Calculations */ |
Vkadaba | 5:0728bde67bdb | 121 | ADMW_DIAGNOSTICS_STATUS_CONVERSION_ERROR = (1 << 8), |
ADIJake | 0:85855ecd3257 | 122 | /*!< Indicates Error During Internal ADC Conversions */ |
Vkadaba | 5:0728bde67bdb | 123 | ADMW_DIAGNOSTICS_STATUS_CALIBRATION_ERROR = (1 << 9), |
ADIJake | 0:85855ecd3257 | 124 | /*!< Indicates Error During Internal Device Calibrations */ |
Vkadaba | 32:52445bef314d | 125 | |
Vkadaba | 32:52445bef314d | 126 | } ADMW_DIAGNOSTICS_STATUS_FLAGS; |
ADIJake | 0:85855ecd3257 | 127 | |
ADIJake | 0:85855ecd3257 | 128 | /*! Bit masks (flags) for the different channel alert indicators. */ |
Vkadaba | 32:52445bef314d | 129 | typedef enum |
Vkadaba | 32:52445bef314d | 130 | { |
Vkadaba | 32:52445bef314d | 131 | ADMW_ALERT_DETAIL_CH_RESULT_VALID = (1 << 0), |
Vkadaba | 32:52445bef314d | 132 | /*!< Indicates valid result in the channel */ |
Vkadaba | 32:52445bef314d | 133 | ADMW_ALERT_DETAIL_CH_ADC_NEAR_OVERRANGE = (1 << 1), |
Vkadaba | 32:52445bef314d | 134 | /*!< Indicates ADC is near overrange in the channel */ |
Vkadaba | 32:52445bef314d | 135 | ADMW_ALERT_DETAIL_CH_SENSOR_UNDERRANGE = (1 << 2), |
Vkadaba | 32:52445bef314d | 136 | /*!< Indicates sensor underrange in the channel */ |
Vkadaba | 32:52445bef314d | 137 | ADMW_ALERT_DETAIL_CH_SENSOR_OVERRANGE = (1 << 3), |
Vkadaba | 32:52445bef314d | 138 | /*!< Indicates sensor overrange in the channel */ |
Vkadaba | 32:52445bef314d | 139 | ADMW_ALERT_DETAIL_CH_CJ_SOFT_FAULT = (1 << 4), |
Vkadaba | 32:52445bef314d | 140 | /*!< Indicates Cold Junction soft fault in the channel */ |
Vkadaba | 32:52445bef314d | 141 | ADMW_ALERT_DETAIL_CH_CJ_HARD_FAULT = (1 << 5), |
Vkadaba | 32:52445bef314d | 142 | /*!< Indicates Cold Junction Hard Fault in the channel */ |
Vkadaba | 32:52445bef314d | 143 | ADMW_ALERT_DETAIL_CH_ADC_INPUT_OVERRANGE = (1 << 6), |
Vkadaba | 32:52445bef314d | 144 | /*!< Indicates ADC Input overrange in the channel */ |
Vkadaba | 32:52445bef314d | 145 | ADMW_ALERT_DETAIL_CH_SENSOR_HARDFAULT = (1 << 7), |
Vkadaba | 32:52445bef314d | 146 | /*!< Indicates Hard Fault in the channel */ |
Vkadaba | 32:52445bef314d | 147 | } ADMW_CHANNEL_ALERT_FLAGS; |
ADIJake | 0:85855ecd3257 | 148 | |
Vkadaba | 5:0728bde67bdb | 149 | /*! Status details retreived from the ADMW device. */ |
Vkadaba | 32:52445bef314d | 150 | typedef struct |
Vkadaba | 32:52445bef314d | 151 | { |
Vkadaba | 5:0728bde67bdb | 152 | ADMW_DEVICE_STATUS_FLAGS deviceStatus; |
ADIJake | 0:85855ecd3257 | 153 | /*!< General summary status information from the device */ |
Vkadaba | 5:0728bde67bdb | 154 | ADMW_DIAGNOSTICS_STATUS_FLAGS diagnosticsStatus; |
ADIJake | 0:85855ecd3257 | 155 | /*!< Diagnostic error status information from the device */ |
Vkadaba | 32:52445bef314d | 156 | ADMW_CHANNEL_ALERT_FLAGS channelAlerts[ADMW1001_MAX_CHANNELS]; |
ADIJake | 0:85855ecd3257 | 157 | /*!< Per-channel alert status information from the device */ |
Vkadaba | 32:52445bef314d | 158 | uint32_t errorCode; |
ADIJake | 0:85855ecd3257 | 159 | /*!< Code identifying the last error signalled by the device */ |
Vkadaba | 32:52445bef314d | 160 | uint32_t alertCode; |
ADIJake | 0:85855ecd3257 | 161 | /*!< Code identifying the last alert signalled by the device */ |
Vkadaba | 32:52445bef314d | 162 | uint32_t debugCode; |
ADIJake | 0:85855ecd3257 | 163 | /*!< Supplementary code related to the last error/alert */ |
Vkadaba | 32:52445bef314d | 164 | uint32_t channelAlertCodes[ADMW1001_MAX_CHANNELS]; |
ADIJake | 0:85855ecd3257 | 165 | /*!< Per-channel code identifying the last alert signalled for each channel */ |
Vkadaba | 32:52445bef314d | 166 | |
Vkadaba | 32:52445bef314d | 167 | } ADMW_STATUS; |
ADIJake | 0:85855ecd3257 | 168 | |
Vkadaba | 5:0728bde67bdb | 169 | /*! Data sample details retreived from the ADMW device. */ |
Vkadaba | 32:52445bef314d | 170 | typedef struct |
Vkadaba | 32:52445bef314d | 171 | { |
Vkadaba | 5:0728bde67bdb | 172 | ADMW_DEVICE_STATUS_FLAGS status; |
ADIJake | 0:85855ecd3257 | 173 | /*!< Device summary status snapshot when the sample was recorded */ |
Vkadaba | 32:52445bef314d | 174 | uint32_t channelId; |
ADIJake | 0:85855ecd3257 | 175 | /*!< The measurement channel from which this sample was obtained */ |
Vkadaba | 50:d84305e5e1c0 | 176 | uint8_t measurementStatus; |
Vkadaba | 50:d84305e5e1c0 | 177 | /*!< The measurement status from the DMZ layer */ |
Vkadaba | 56:38b36e947602 | 178 | float32_t rawValue; |
ADIJake | 0:85855ecd3257 | 179 | /*!< The raw (unprocessed) value obtained directly from the measurement |
ADIJake | 0:85855ecd3257 | 180 | * channel, if available |
ADIJake | 0:85855ecd3257 | 181 | */ |
Vkadaba | 32:52445bef314d | 182 | float32_t processedValue; |
ADIJake | 0:85855ecd3257 | 183 | /*!< The processed value obtained from the measurement channel, as a final |
ADIJake | 0:85855ecd3257 | 184 | * measurement value, following calibration and linearisation correction, |
ADIJake | 0:85855ecd3257 | 185 | * and conversion into an appropriate unit of measurement. |
ADIJake | 0:85855ecd3257 | 186 | */ |
Vkadaba | 32:52445bef314d | 187 | |
Vkadaba | 32:52445bef314d | 188 | } ADMW_DATA_SAMPLE; |
ADIJake | 0:85855ecd3257 | 189 | |
Vkadaba | 5:0728bde67bdb | 190 | /*! Measurement mode options for the ADMW device. |
Vkadaba | 5:0728bde67bdb | 191 | * @ref admw_StartMeasurement |
ADIJake | 0:85855ecd3257 | 192 | */ |
Vkadaba | 32:52445bef314d | 193 | typedef enum |
Vkadaba | 32:52445bef314d | 194 | { |
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 | 32:52445bef314d | 201 | |
Vkadaba | 32:52445bef314d | 202 | } ADMW_MEASUREMENT_MODE; |
ADIJake | 0:85855ecd3257 | 203 | |
ADIJake | 0:85855ecd3257 | 204 | /*! Identifiers for the user configuration slots in persistent memory. */ |
Vkadaba | 32:52445bef314d | 205 | typedef enum |
Vkadaba | 32:52445bef314d | 206 | { |
Vkadaba | 5:0728bde67bdb | 207 | ADMW_FLASH_CONFIG_1, |
Vkadaba | 32:52445bef314d | 208 | |
Vkadaba | 32:52445bef314d | 209 | } ADMW_USER_CONFIG_SLOT; |
Vkadaba | 32:52445bef314d | 210 | |
Vkadaba | 50:d84305e5e1c0 | 211 | /*! Identifiers for the user configuration slots in persistent memory. */ |
Vkadaba | 50:d84305e5e1c0 | 212 | typedef enum |
Vkadaba | 50:d84305e5e1c0 | 213 | { |
Vkadaba | 50:d84305e5e1c0 | 214 | ADMW_FLASH_LUT_CHANNEL_0=0, |
Vkadaba | 50:d84305e5e1c0 | 215 | ADMW_FLASH_LUT_CHANNEL_1, |
Vkadaba | 50:d84305e5e1c0 | 216 | ADMW_FLASH_LUT_CHANNEL_2, |
Vkadaba | 50:d84305e5e1c0 | 217 | ADMW_FLASH_LUT_CHANNEL_3, |
Vkadaba | 50:d84305e5e1c0 | 218 | |
Vkadaba | 32:52445bef314d | 219 | |
Vkadaba | 50:d84305e5e1c0 | 220 | } ADMW_USER_LUT_CONFIG_SLOT; |
ADIJake | 0:85855ecd3257 | 221 | |
Vkadaba | 32:52445bef314d | 222 | typedef struct |
Vkadaba | 32:52445bef314d | 223 | { |
Vkadaba | 32:52445bef314d | 224 | unsigned nDeviceIndex; |
Vkadaba | 32:52445bef314d | 225 | ADMW_SPI_HANDLE hSpi; |
Vkadaba | 32:52445bef314d | 226 | ADMW_GPIO_HANDLE hGpio; |
Vkadaba | 32:52445bef314d | 227 | } ADMW_DEVICE_CONTEXT; |
ADIJake | 0:85855ecd3257 | 228 | |
ADIJake | 0:85855ecd3257 | 229 | /****************************************************************************** |
Vkadaba | 5:0728bde67bdb | 230 | * ADMW High-Level API function prototypes |
ADIJake | 0:85855ecd3257 | 231 | *****************************************************************************/ |
ADIJake | 0:85855ecd3257 | 232 | |
ADIJake | 0:85855ecd3257 | 233 | /*! |
Vkadaba | 5:0728bde67bdb | 234 | * @brief Open ADMW device handle and set up communication interface. |
ADIJake | 0:85855ecd3257 | 235 | * |
ADIJake | 0:85855ecd3257 | 236 | * @param[in] nDeviceIndex Zero-based index number identifying this device |
ADIJake | 0:85855ecd3257 | 237 | * instance. Note that this will be used to |
ADIJake | 0:85855ecd3257 | 238 | * retrieve a specific device configuration for |
Vkadaba | 5:0728bde67bdb | 239 | * this device (see @ref admw_SetConfig |
Vkadaba | 5:0728bde67bdb | 240 | * and @ref ADMW_CONFIG) |
ADIJake | 0:85855ecd3257 | 241 | * @param[in] pConnectionInfo Host-specific connection details (e.g. SPI, GPIO) |
Vkadaba | 5:0728bde67bdb | 242 | * @param[out] phDevice Pointer to return an ADMW device handle |
ADIJake | 0:85855ecd3257 | 243 | * |
ADIJake | 0:85855ecd3257 | 244 | * @return Status |
Vkadaba | 5:0728bde67bdb | 245 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 5:0728bde67bdb | 246 | * - #ADMW_NO_MEM Failed to allocate memory resources. |
Vkadaba | 5:0728bde67bdb | 247 | * - #ADMW_INVALID_DEVICE_NUM Invalid device index specified |
ADIJake | 0:85855ecd3257 | 248 | * |
ADIJake | 0:85855ecd3257 | 249 | * @details Configure and initialise the Log interface and the SPI/GPIO |
Vkadaba | 32:52445bef314d | 250 | * communication interface to the ADISense module. |
ADIJake | 0:85855ecd3257 | 251 | */ |
Vkadaba | 5:0728bde67bdb | 252 | ADMW_RESULT admw_Open( |
ADIJake | 0:85855ecd3257 | 253 | unsigned const nDeviceIndex, |
Vkadaba | 5:0728bde67bdb | 254 | ADMW_CONNECTION * const pConnectionInfo, |
Vkadaba | 5:0728bde67bdb | 255 | ADMW_DEVICE_HANDLE * const phDevice); |
ADIJake | 0:85855ecd3257 | 256 | |
ADIJake | 0:85855ecd3257 | 257 | /*! |
Vkadaba | 5:0728bde67bdb | 258 | * @brief Close ADMW device context and free resources. |
ADIJake | 0:85855ecd3257 | 259 | * |
Vkadaba | 5:0728bde67bdb | 260 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 261 | * |
ADIJake | 0:85855ecd3257 | 262 | * @return Status |
Vkadaba | 5:0728bde67bdb | 263 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 264 | */ |
Vkadaba | 5:0728bde67bdb | 265 | ADMW_RESULT admw_Close( |
Vkadaba | 5:0728bde67bdb | 266 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 267 | |
ADIJake | 0:85855ecd3257 | 268 | /*! |
ADIJake | 0:85855ecd3257 | 269 | * @brief Get the current state of the specified GPIO input signal. |
ADIJake | 0:85855ecd3257 | 270 | * |
Vkadaba | 5:0728bde67bdb | 271 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 272 | * @param[in] ePinId GPIO pin to query |
ADIJake | 0:85855ecd3257 | 273 | * @param[out] pbAsserted Pointer to return the state of the status signal GPIO pin |
ADIJake | 0:85855ecd3257 | 274 | * |
ADIJake | 0:85855ecd3257 | 275 | * @return Status |
Vkadaba | 5:0728bde67bdb | 276 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 5:0728bde67bdb | 277 | * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified. |
ADIJake | 0:85855ecd3257 | 278 | * |
ADIJake | 0:85855ecd3257 | 279 | * @details Sets *pbAsserted to true if the status signal is asserted, or false |
ADIJake | 0:85855ecd3257 | 280 | * otherwise. |
ADIJake | 0:85855ecd3257 | 281 | */ |
Vkadaba | 5:0728bde67bdb | 282 | ADMW_RESULT admw_GetGpioState( |
Vkadaba | 5:0728bde67bdb | 283 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 284 | ADMW_GPIO_PIN const ePinId, |
ADIJake | 0:85855ecd3257 | 285 | bool * const pbAsserted); |
ADIJake | 0:85855ecd3257 | 286 | |
ADIJake | 0:85855ecd3257 | 287 | /*! |
ADIJake | 0:85855ecd3257 | 288 | * @brief Register an application-defined callback function for GPIO interrupts |
ADIJake | 0:85855ecd3257 | 289 | * |
Vkadaba | 5:0728bde67bdb | 290 | * @param[in] hDevice ADMW context handle (@ref admw_Open) |
ADIJake | 0:85855ecd3257 | 291 | * @param[in] ePinId GPIO pin on which to enable/disable interrupts |
ADIJake | 0:85855ecd3257 | 292 | * @param[in] callbackFunction Function to be called when an interrupt occurs. |
ADIJake | 0:85855ecd3257 | 293 | * Specify NULL here to disable interrupts. |
ADIJake | 0:85855ecd3257 | 294 | * @param[in] pCallbackParam Optional opaque parameter passed to the callback |
ADIJake | 0:85855ecd3257 | 295 | * |
ADIJake | 0:85855ecd3257 | 296 | * @return Status |
Vkadaba | 5:0728bde67bdb | 297 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 5:0728bde67bdb | 298 | * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified. |
ADIJake | 0:85855ecd3257 | 299 | */ |
Vkadaba | 5:0728bde67bdb | 300 | ADMW_RESULT admw_RegisterGpioCallback( |
Vkadaba | 5:0728bde67bdb | 301 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 302 | ADMW_GPIO_PIN const ePinId, |
Vkadaba | 5:0728bde67bdb | 303 | ADMW_GPIO_CALLBACK const callbackFunction, |
ADIJake | 0:85855ecd3257 | 304 | void * const pCallbackParam); |
ADIJake | 0:85855ecd3257 | 305 | |
ADIJake | 0:85855ecd3257 | 306 | /*! |
ADIJake | 0:85855ecd3257 | 307 | * @brief Trigger a shut down of the 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 Instructs the ADMW device to initiate a shut down, |
ADIJake | 0:85855ecd3257 | 315 | * typically used to conserve power when the device is not |
ADIJake | 0:85855ecd3257 | 316 | * in use. The device may be restarted by calling |
Vkadaba | 5:0728bde67bdb | 317 | * @ref admw_Reset(). Note that active configuration |
ADIJake | 0:85855ecd3257 | 318 | * settings are not preserved during shutdown and must be |
ADIJake | 0:85855ecd3257 | 319 | * reloaded after the device has become ready again. |
ADIJake | 0:85855ecd3257 | 320 | * |
ADIJake | 0:85855ecd3257 | 321 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 322 | */ |
Vkadaba | 5:0728bde67bdb | 323 | ADMW_RESULT admw_Shutdown( |
Vkadaba | 5:0728bde67bdb | 324 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 325 | |
ADIJake | 0:85855ecd3257 | 326 | /*! |
Vkadaba | 5:0728bde67bdb | 327 | * @brief Reset the ADMW device. |
ADIJake | 0:85855ecd3257 | 328 | * |
Vkadaba | 5:0728bde67bdb | 329 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 330 | * |
ADIJake | 0:85855ecd3257 | 331 | * @return Status |
Vkadaba | 5:0728bde67bdb | 332 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 333 | * |
Vkadaba | 5:0728bde67bdb | 334 | * @details Trigger a hardware-reset of the ADMW device. |
ADIJake | 0:85855ecd3257 | 335 | * |
ADIJake | 0:85855ecd3257 | 336 | * @note The device may require several seconds before it is ready for use |
Vkadaba | 5:0728bde67bdb | 337 | * again. @ref admw_GetDeviceReadyState may be used to check if |
ADIJake | 0:85855ecd3257 | 338 | * the device is ready. |
ADIJake | 0:85855ecd3257 | 339 | */ |
Vkadaba | 5:0728bde67bdb | 340 | ADMW_RESULT admw_Reset( |
Vkadaba | 5:0728bde67bdb | 341 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 342 | |
ADIJake | 0:85855ecd3257 | 343 | /*! |
ADIJake | 0:85855ecd3257 | 344 | * @brief Check if the device is ready, following power-up or a reset. |
ADIJake | 0:85855ecd3257 | 345 | * |
Vkadaba | 5:0728bde67bdb | 346 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 347 | * @param[out] pbReady Pointer to return true if the device is ready, or false |
ADIJake | 0:85855ecd3257 | 348 | * otherwise |
ADIJake | 0:85855ecd3257 | 349 | * |
ADIJake | 0:85855ecd3257 | 350 | * @return Status |
Vkadaba | 5:0728bde67bdb | 351 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 352 | * |
ADIJake | 0:85855ecd3257 | 353 | * @details This function attempts to read a fixed-value device register via |
ADIJake | 0:85855ecd3257 | 354 | * the communication interface. |
ADIJake | 0:85855ecd3257 | 355 | */ |
Vkadaba | 5:0728bde67bdb | 356 | ADMW_RESULT admw_GetDeviceReadyState( |
Vkadaba | 5:0728bde67bdb | 357 | ADMW_DEVICE_HANDLE const hDevice, |
ADIJake | 0:85855ecd3257 | 358 | bool * const pbReady); |
ADIJake | 0:85855ecd3257 | 359 | |
ADIJake | 0:85855ecd3257 | 360 | /*! |
ADIJake | 0:85855ecd3257 | 361 | * @brief Obtain the product ID from the device. |
ADIJake | 0:85855ecd3257 | 362 | * |
Vkadaba | 5:0728bde67bdb | 363 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 364 | * @param[out] pProductId Pointer to return the product ID value |
ADIJake | 0:85855ecd3257 | 365 | * |
ADIJake | 0:85855ecd3257 | 366 | * @return Status |
Vkadaba | 5:0728bde67bdb | 367 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 368 | * |
ADIJake | 0:85855ecd3257 | 369 | * @details Reads the product ID registers on the device and returns the value. |
ADIJake | 0:85855ecd3257 | 370 | */ |
Vkadaba | 5:0728bde67bdb | 371 | ADMW_RESULT admw_GetProductID( |
Vkadaba | 5:0728bde67bdb | 372 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 373 | ADMW_PRODUCT_ID * const pProductId); |
ADIJake | 0:85855ecd3257 | 374 | |
ADIJake | 0:85855ecd3257 | 375 | /*! |
ADIJake | 0:85855ecd3257 | 376 | * @brief Write full configuration settings to the device registers. |
ADIJake | 0:85855ecd3257 | 377 | * |
Vkadaba | 5:0728bde67bdb | 378 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 379 | * @param[out] pConfig Pointer to the configuration data structure |
ADIJake | 0:85855ecd3257 | 380 | * |
ADIJake | 0:85855ecd3257 | 381 | * @return Status |
Vkadaba | 5:0728bde67bdb | 382 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 383 | * |
ADIJake | 0:85855ecd3257 | 384 | * @details Translates configuration details provided into device-specific |
ADIJake | 0:85855ecd3257 | 385 | * register settings and updates device configuration registers. |
ADIJake | 0:85855ecd3257 | 386 | * |
Vkadaba | 5:0728bde67bdb | 387 | * @note Settings are not applied until admw_ApplyConfigUpdates() is called |
ADIJake | 0:85855ecd3257 | 388 | */ |
Vkadaba | 5:0728bde67bdb | 389 | ADMW_RESULT admw_SetConfig( |
Vkadaba | 5:0728bde67bdb | 390 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 391 | ADMW_CONFIG * const pConfig); |
ADIJake | 0:85855ecd3257 | 392 | |
ADIJake | 0:85855ecd3257 | 393 | /*! |
ADIJake | 0:85855ecd3257 | 394 | * @brief Apply the configuration settings currently stored in device registers |
ADIJake | 0:85855ecd3257 | 395 | * |
Vkadaba | 5:0728bde67bdb | 396 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 397 | * |
ADIJake | 0:85855ecd3257 | 398 | * @return Status |
Vkadaba | 5:0728bde67bdb | 399 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 400 | * |
Vkadaba | 5:0728bde67bdb | 401 | * @details Instructs the ADMW device to reload and apply configuration |
ADIJake | 0:85855ecd3257 | 402 | * from the device configuration registers. Changes to configuration |
ADIJake | 0:85855ecd3257 | 403 | * registers are ignored by the device until this function is called. |
ADIJake | 0:85855ecd3257 | 404 | * |
ADIJake | 0:85855ecd3257 | 405 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 406 | */ |
Vkadaba | 5:0728bde67bdb | 407 | ADMW_RESULT admw_ApplyConfigUpdates( |
Vkadaba | 5:0728bde67bdb | 408 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 409 | |
ADIJake | 0:85855ecd3257 | 410 | /*! |
ADIJake | 0:85855ecd3257 | 411 | * @brief Store the configuration settings to persistent memory on the device. |
ADIJake | 0:85855ecd3257 | 412 | * |
Vkadaba | 5:0728bde67bdb | 413 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 414 | * @param[in] eSlotId User configuration slot in persistent memory |
ADIJake | 0:85855ecd3257 | 415 | * |
ADIJake | 0:85855ecd3257 | 416 | * @return Status |
Vkadaba | 5:0728bde67bdb | 417 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 418 | * |
Vkadaba | 5:0728bde67bdb | 419 | * @details Instructs the ADMW device to save the current contents of its |
ADIJake | 0:85855ecd3257 | 420 | * device configuration registers to non-volatile memory. |
ADIJake | 0:85855ecd3257 | 421 | * |
ADIJake | 0:85855ecd3257 | 422 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 423 | * @note Do not power down the device while this command is running. |
ADIJake | 0:85855ecd3257 | 424 | */ |
Vkadaba | 5:0728bde67bdb | 425 | ADMW_RESULT admw_SaveConfig( |
Vkadaba | 5:0728bde67bdb | 426 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 427 | ADMW_USER_CONFIG_SLOT const eSlotId); |
ADIJake | 0:85855ecd3257 | 428 | |
ADIJake | 0:85855ecd3257 | 429 | /*! |
ADIJake | 0:85855ecd3257 | 430 | * @brief Restore configuration settings from persistent memory on the device. |
ADIJake | 0:85855ecd3257 | 431 | * |
Vkadaba | 5:0728bde67bdb | 432 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 433 | * @param[in] eSlotId User configuration slot in persistent memory |
ADIJake | 0:85855ecd3257 | 434 | * |
ADIJake | 0:85855ecd3257 | 435 | * @return Status |
Vkadaba | 5:0728bde67bdb | 436 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 437 | * |
Vkadaba | 5:0728bde67bdb | 438 | * @details Instructs the ADMW device to restore the contents of its |
ADIJake | 0:85855ecd3257 | 439 | * device configuration registers from non-volatile memory. |
ADIJake | 0:85855ecd3257 | 440 | * |
ADIJake | 0:85855ecd3257 | 441 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 442 | */ |
Vkadaba | 5:0728bde67bdb | 443 | ADMW_RESULT admw_RestoreConfig( |
Vkadaba | 5:0728bde67bdb | 444 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 445 | ADMW_USER_CONFIG_SLOT const eSlotId); |
ADIJake | 0:85855ecd3257 | 446 | |
ADIJake | 0:85855ecd3257 | 447 | /*! |
ADIJake | 0:85855ecd3257 | 448 | * @brief Erases the external flash memory. |
ADIJake | 0:85855ecd3257 | 449 | * |
Vkadaba | 5:0728bde67bdb | 450 | * @param[in] hDevice ADMW device context handle |
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 | * @details Sends the bulk erase instruction to the external flash |
ADIJake | 0:85855ecd3257 | 456 | * device. All stored samples are deleted. |
ADIJake | 0:85855ecd3257 | 457 | * It is a blocking operation and takes tens of seconds to |
ADIJake | 0:85855ecd3257 | 458 | * complete. |
ADIJake | 0:85855ecd3257 | 459 | * |
ADIJake | 0:85855ecd3257 | 460 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 461 | */ |
Vkadaba | 5:0728bde67bdb | 462 | ADMW_RESULT admw_EraseExternalFlash( |
Vkadaba | 5:0728bde67bdb | 463 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 464 | |
ADIJake | 0:85855ecd3257 | 465 | /*! |
ADIJake | 0:85855ecd3257 | 466 | * @brief Gets the number of samples stored in the external flash |
ADIJake | 0:85855ecd3257 | 467 | * memory. |
ADIJake | 0:85855ecd3257 | 468 | * |
Vkadaba | 5:0728bde67bdb | 469 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 470 | * @param[in] pSampleCount Address of the return value. |
ADIJake | 0:85855ecd3257 | 471 | * |
ADIJake | 0:85855ecd3257 | 472 | * @return Status |
Vkadaba | 5:0728bde67bdb | 473 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 474 | * |
ADIJake | 0:85855ecd3257 | 475 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 476 | */ |
Vkadaba | 5:0728bde67bdb | 477 | ADMW_RESULT admw_GetExternalFlashSampleCount( |
Vkadaba | 5:0728bde67bdb | 478 | ADMW_DEVICE_HANDLE const hDevice, |
ADIJake | 0:85855ecd3257 | 479 | uint32_t * nSampleCount); |
ADIJake | 0:85855ecd3257 | 480 | |
ADIJake | 0:85855ecd3257 | 481 | // DEBUG - TO BE DELETED |
Vkadaba | 5:0728bde67bdb | 482 | ADMW_RESULT admw_SetExternalFlashIndex( |
Vkadaba | 5:0728bde67bdb | 483 | ADMW_DEVICE_HANDLE const hDevice, |
ADIJake | 0:85855ecd3257 | 484 | uint32_t nStartIndex); |
ADIJake | 0:85855ecd3257 | 485 | |
ADIJake | 0:85855ecd3257 | 486 | /*! |
ADIJake | 0:85855ecd3257 | 487 | * @brief Read measurement samples stored in the the external flash memory. |
ADIJake | 0:85855ecd3257 | 488 | * |
Vkadaba | 5:0728bde67bdb | 489 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 490 | * @param[out] pSamples Pointer to return a set of requested data |
ADIJake | 0:85855ecd3257 | 491 | * samples. |
ADIJake | 0:85855ecd3257 | 492 | * @param[in] nStartIndex Index of first sample to retrieve. |
ADIJake | 0:85855ecd3257 | 493 | * @param[in] nBytesPerSample The size, in bytes, of each sample. |
ADIJake | 0:85855ecd3257 | 494 | * @param[in] nRequested Number of requested data samples. |
ADIJake | 0:85855ecd3257 | 495 | * @param[out] pnReturned Number of valid data samples successfully |
ADIJake | 0:85855ecd3257 | 496 | * retrieved. |
ADIJake | 0:85855ecd3257 | 497 | * |
ADIJake | 0:85855ecd3257 | 498 | * @return Status |
Vkadaba | 5:0728bde67bdb | 499 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 500 | * |
ADIJake | 0:85855ecd3257 | 501 | * @details Reads the status registers and extracts the relevant information |
ADIJake | 0:85855ecd3257 | 502 | * to return to the caller. |
ADIJake | 0:85855ecd3257 | 503 | * |
ADIJake | 0:85855ecd3257 | 504 | */ |
Vkadaba | 5:0728bde67bdb | 505 | ADMW_RESULT admw_GetExternalFlashData( |
Vkadaba | 5:0728bde67bdb | 506 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 507 | ADMW_DATA_SAMPLE * const pSamples, |
ADIJake | 0:85855ecd3257 | 508 | uint32_t const nIndex, |
ADIJake | 0:85855ecd3257 | 509 | uint32_t const nRequested, |
ADIJake | 0:85855ecd3257 | 510 | uint32_t * const pnReturned); |
ADIJake | 0:85855ecd3257 | 511 | |
ADIJake | 0:85855ecd3257 | 512 | /*! |
ADIJake | 0:85855ecd3257 | 513 | * @brief Store the LUT data to persistent memory on the device. |
ADIJake | 0:85855ecd3257 | 514 | * |
Vkadaba | 5:0728bde67bdb | 515 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 516 | * |
ADIJake | 0:85855ecd3257 | 517 | * @return Status |
Vkadaba | 5:0728bde67bdb | 518 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 519 | * |
Vkadaba | 5:0728bde67bdb | 520 | * @details Instructs the ADMW device to save the current contents of its |
Vkadaba | 5:0728bde67bdb | 521 | * LUT data buffer, set using @ref admw_SetLutData, to |
ADIJake | 0:85855ecd3257 | 522 | * non-volatile memory. |
ADIJake | 0:85855ecd3257 | 523 | * |
ADIJake | 0:85855ecd3257 | 524 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 525 | * @note Do not power down the device while this command is running. |
ADIJake | 0:85855ecd3257 | 526 | */ |
Vkadaba | 5:0728bde67bdb | 527 | ADMW_RESULT admw_SaveLutData( |
Vkadaba | 5:0728bde67bdb | 528 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 529 | |
ADIJake | 0:85855ecd3257 | 530 | /*! |
ADIJake | 0:85855ecd3257 | 531 | * @brief Restore LUT data from persistent memory on the device. |
ADIJake | 0:85855ecd3257 | 532 | * |
Vkadaba | 5:0728bde67bdb | 533 | * @param[in] hDevice ADMW device context handle |
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 restore the contents of its |
Vkadaba | 5:0728bde67bdb | 539 | * LUT data, previously stored with @ref admw_SaveLutData, from |
ADIJake | 0:85855ecd3257 | 540 | * non-volatile memory. |
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_RestoreLutData( |
Vkadaba | 5:0728bde67bdb | 545 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 546 | |
ADIJake | 0:85855ecd3257 | 547 | /*! |
ADIJake | 0:85855ecd3257 | 548 | * @brief Start the measurement cycles on the device. |
ADIJake | 0:85855ecd3257 | 549 | * |
Vkadaba | 5:0728bde67bdb | 550 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 551 | * @param[in] eMeasurementMode Allows a choice of special modes for the |
Vkadaba | 5:0728bde67bdb | 552 | * measurement. See @ref ADMW_MEASUREMENT_MODE |
ADIJake | 0:85855ecd3257 | 553 | * for further information. |
ADIJake | 0:85855ecd3257 | 554 | * |
ADIJake | 0:85855ecd3257 | 555 | * @return Status |
Vkadaba | 5:0728bde67bdb | 556 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 557 | * |
Vkadaba | 5:0728bde67bdb | 558 | * @details Instructs the ADMW device to start executing measurement cycles |
ADIJake | 0:85855ecd3257 | 559 | * according to the current applied configuration settings. The |
ADIJake | 0:85855ecd3257 | 560 | * DATAREADY status signal will be asserted whenever new measurement |
ADIJake | 0:85855ecd3257 | 561 | * data is published, according to selected settings. |
ADIJake | 0:85855ecd3257 | 562 | * Measurement cycles may be stopped by calling @ref |
Vkadaba | 5:0728bde67bdb | 563 | * admw_StopMeasurement. |
ADIJake | 0:85855ecd3257 | 564 | * |
ADIJake | 0:85855ecd3257 | 565 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 566 | */ |
Vkadaba | 5:0728bde67bdb | 567 | ADMW_RESULT admw_StartMeasurement( |
Vkadaba | 5:0728bde67bdb | 568 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 569 | ADMW_MEASUREMENT_MODE const eMeasurementMode); |
ADIJake | 0:85855ecd3257 | 570 | |
ADIJake | 0:85855ecd3257 | 571 | /*! |
ADIJake | 0:85855ecd3257 | 572 | * @brief Stop the measurement cycles on the device. |
ADIJake | 0:85855ecd3257 | 573 | * |
Vkadaba | 5:0728bde67bdb | 574 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 575 | * |
ADIJake | 0:85855ecd3257 | 576 | * @return Status |
Vkadaba | 5:0728bde67bdb | 577 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 578 | * |
Vkadaba | 5:0728bde67bdb | 579 | * @details Instructs the ADMW device to stop executing measurement cycles. |
ADIJake | 0:85855ecd3257 | 580 | * The command may be delayed until the current conversion, if any, has |
ADIJake | 0:85855ecd3257 | 581 | * been completed and published. |
ADIJake | 0:85855ecd3257 | 582 | * |
ADIJake | 0:85855ecd3257 | 583 | * @note To be used only if a measurement command is currently running. |
ADIJake | 0:85855ecd3257 | 584 | */ |
Vkadaba | 5:0728bde67bdb | 585 | ADMW_RESULT admw_StopMeasurement( |
Vkadaba | 5:0728bde67bdb | 586 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 587 | |
ADIJake | 0:85855ecd3257 | 588 | /*! |
ADIJake | 0:85855ecd3257 | 589 | * @brief Run built-in diagnostic checks on the device. |
ADIJake | 0:85855ecd3257 | 590 | * |
Vkadaba | 5:0728bde67bdb | 591 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 592 | * |
ADIJake | 0:85855ecd3257 | 593 | * @return Status |
Vkadaba | 5:0728bde67bdb | 594 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 595 | * |
Vkadaba | 5:0728bde67bdb | 596 | * @details Instructs the ADMW device to execute its built-in diagnostic |
ADIJake | 0:85855ecd3257 | 597 | * tests, on any enabled measurement channels, according to the current |
ADIJake | 0:85855ecd3257 | 598 | * applied configuration settings. Device status registers will be |
ADIJake | 0:85855ecd3257 | 599 | * updated to indicate if any errors were detected by the diagnostics. |
ADIJake | 0:85855ecd3257 | 600 | * |
ADIJake | 0:85855ecd3257 | 601 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 602 | */ |
Vkadaba | 5:0728bde67bdb | 603 | ADMW_RESULT admw_RunDiagnostics( |
Vkadaba | 5:0728bde67bdb | 604 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 605 | |
ADIJake | 0:85855ecd3257 | 606 | /*! |
ADIJake | 0:85855ecd3257 | 607 | * @brief Run built-in calibration on the device. |
ADIJake | 0:85855ecd3257 | 608 | * |
Vkadaba | 5:0728bde67bdb | 609 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 610 | * |
ADIJake | 0:85855ecd3257 | 611 | * @return Status |
Vkadaba | 5:0728bde67bdb | 612 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 613 | * |
Vkadaba | 5:0728bde67bdb | 614 | * @details Instructs the ADMW device to execute its self-calibration |
ADIJake | 0:85855ecd3257 | 615 | * routines, on any enabled measurement channels, according to the |
ADIJake | 0:85855ecd3257 | 616 | * current applied configuration settings. Device status registers |
ADIJake | 0:85855ecd3257 | 617 | * will be updated to indicate if any errors were detected. |
ADIJake | 0:85855ecd3257 | 618 | * |
ADIJake | 0:85855ecd3257 | 619 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 620 | */ |
Vkadaba | 5:0728bde67bdb | 621 | ADMW_RESULT admw_RunCalibration( |
Vkadaba | 5:0728bde67bdb | 622 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 623 | |
ADIJake | 0:85855ecd3257 | 624 | /*! |
ADIJake | 0:85855ecd3257 | 625 | * @brief Run built-in digital calibration on the device. |
ADIJake | 0:85855ecd3257 | 626 | * |
Vkadaba | 5:0728bde67bdb | 627 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 628 | * |
ADIJake | 0:85855ecd3257 | 629 | * @return Status |
Vkadaba | 5:0728bde67bdb | 630 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 631 | * |
Vkadaba | 5:0728bde67bdb | 632 | * @details Instructs the ADMW device to execute its calibration |
ADIJake | 0:85855ecd3257 | 633 | * routines, on any enabled digital channels, according to the |
ADIJake | 0:85855ecd3257 | 634 | * current applied configuration settings. Device status registers |
ADIJake | 0:85855ecd3257 | 635 | * will be updated to indicate if any errors were detected. |
ADIJake | 0:85855ecd3257 | 636 | * |
ADIJake | 0:85855ecd3257 | 637 | * @note No other command must be running when this is called. |
ADIJake | 0:85855ecd3257 | 638 | */ |
Vkadaba | 5:0728bde67bdb | 639 | ADMW_RESULT admw_RunDigitalCalibration( |
Vkadaba | 5:0728bde67bdb | 640 | ADMW_DEVICE_HANDLE const hDevice); |
ADIJake | 0:85855ecd3257 | 641 | |
ADIJake | 0:85855ecd3257 | 642 | /*! |
ADIJake | 0:85855ecd3257 | 643 | * @brief Read the current status from the device registers. |
ADIJake | 0:85855ecd3257 | 644 | * |
Vkadaba | 5:0728bde67bdb | 645 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 646 | * @param[out] pStatus Pointer to return the status summary obtained from the |
ADIJake | 0:85855ecd3257 | 647 | * device. |
ADIJake | 0:85855ecd3257 | 648 | * |
ADIJake | 0:85855ecd3257 | 649 | * @return Status |
Vkadaba | 5:0728bde67bdb | 650 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 651 | * |
ADIJake | 0:85855ecd3257 | 652 | * @details Reads the status registers and extracts the relevant information |
ADIJake | 0:85855ecd3257 | 653 | * to return to the caller. |
ADIJake | 0:85855ecd3257 | 654 | * |
ADIJake | 0:85855ecd3257 | 655 | * @note This may be called at any time, assuming the device is ready. |
ADIJake | 0:85855ecd3257 | 656 | */ |
Vkadaba | 5:0728bde67bdb | 657 | ADMW_RESULT admw_GetStatus( |
Vkadaba | 5:0728bde67bdb | 658 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 659 | ADMW_STATUS * const pStatus); |
ADIJake | 0:85855ecd3257 | 660 | |
ADIJake | 0:85855ecd3257 | 661 | /*! |
Vkadaba | 54:31921ad29828 | 662 | * @brief Assemble a list of separate Look-Up Tables into a single buffer |
Vkadaba | 54:31921ad29828 | 663 | * |
Vkadaba | 54:31921ad29828 | 664 | * @param[out] pLutBuffer Pointer to the Look-Up Table data buffer where |
Vkadaba | 54:31921ad29828 | 665 | * the assembled Look-Up Table data will be placed |
Vkadaba | 54:31921ad29828 | 666 | * @param[in] nLutBufferSize Allocated size, in bytes, of the output data buffer |
Vkadaba | 54:31921ad29828 | 667 | * @param[in] nNumTables Number of tables to add to the Look-Up Table buffer |
Vkadaba | 54:31921ad29828 | 668 | * @param[in] ppDesc Array of pointers to the table descriptors to be added |
Vkadaba | 54:31921ad29828 | 669 | * @param[in] ppData Array of pointers to the table data to be added |
Vkadaba | 54:31921ad29828 | 670 | * |
Vkadaba | 54:31921ad29828 | 671 | * @return Status |
Vkadaba | 54:31921ad29828 | 672 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 54:31921ad29828 | 673 | * |
Vkadaba | 54:31921ad29828 | 674 | * @details This utiliity function fills the Look-up Table header fields; then |
Vkadaba | 54:31921ad29828 | 675 | * walks through the array of individual table descriptor and data |
Vkadaba | 54:31921ad29828 | 676 | * pointers provided, appending (copying) each one to the Look-Up Table |
Vkadaba | 54:31921ad29828 | 677 | * data buffer. The length and crc16 fields of each table descriptor |
Vkadaba | 54:31921ad29828 | 678 | * will be calculated and filled by this function, but other fields in |
Vkadaba | 54:31921ad29828 | 679 | * the descriptor structure must be filled by the caller beforehand. |
Vkadaba | 54:31921ad29828 | 680 | * |
Vkadaba | 54:31921ad29828 | 681 | * @note The assembled LUT data buffer filled by this function can then be |
Vkadaba | 54:31921ad29828 | 682 | * written to the device memory using @ref admw1001_SetLutData. |
Vkadaba | 54:31921ad29828 | 683 | */ |
Vkadaba | 54:31921ad29828 | 684 | ADMW_RESULT admw1001_AssembleLutData( |
Vkadaba | 54:31921ad29828 | 685 | ADMW1001_LUT *pLutBuffer, |
Vkadaba | 54:31921ad29828 | 686 | unsigned nLutBufferSize, |
Vkadaba | 54:31921ad29828 | 687 | unsigned const nNumTables, |
Vkadaba | 54:31921ad29828 | 688 | ADMW1001_LUT_DESCRIPTOR *const ppDesc[], |
Vkadaba | 54:31921ad29828 | 689 | ADMW1001_LUT_TABLE_DATA *const ppData[]); |
Vkadaba | 54:31921ad29828 | 690 | |
Vkadaba | 54:31921ad29828 | 691 | /*! |
Vkadaba | 54:31921ad29828 | 692 | * @brief Write Look-Up Table data to the device memory |
Vkadaba | 54:31921ad29828 | 693 | * |
Vkadaba | 54:31921ad29828 | 694 | * @param[in] hDevice ADMW1001 device context handle |
Vkadaba | 54:31921ad29828 | 695 | * @param[out] pLutData Pointer to the Look-Up Table data structure |
Vkadaba | 54:31921ad29828 | 696 | * |
Vkadaba | 54:31921ad29828 | 697 | * @return Status |
Vkadaba | 54:31921ad29828 | 698 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 54:31921ad29828 | 699 | * |
Vkadaba | 54:31921ad29828 | 700 | * @details Validates the Look-Up Table data format and loads it into |
Vkadaba | 54:31921ad29828 | 701 | * device memory via dedicated keyhole registers. |
Vkadaba | 54:31921ad29828 | 702 | * |
Vkadaba | 54:31921ad29828 | 703 | * @note Settings are not applied until admw_ApplyConfigUpdates() is called |
Vkadaba | 54:31921ad29828 | 704 | */ |
Vkadaba | 54:31921ad29828 | 705 | ADMW_RESULT admw1001_SetLutData( |
Vkadaba | 54:31921ad29828 | 706 | ADMW_DEVICE_HANDLE hDevice, |
Vkadaba | 54:31921ad29828 | 707 | ADMW1001_LUT *const pLutData); |
Vkadaba | 54:31921ad29828 | 708 | |
Vkadaba | 54:31921ad29828 | 709 | /*! |
Vkadaba | 54:31921ad29828 | 710 | * @brief Write Look-Up Table raw data to the device memory |
Vkadaba | 54:31921ad29828 | 711 | * |
Vkadaba | 54:31921ad29828 | 712 | * @param[in] hDevice ADMW device context handle |
Vkadaba | 54:31921ad29828 | 713 | * @param[out] pLutData Pointer to the Look-Up Table raw data structure |
Vkadaba | 54:31921ad29828 | 714 | * |
Vkadaba | 54:31921ad29828 | 715 | * @return Status |
Vkadaba | 54:31921ad29828 | 716 | * - #ADMW_SUCCESS Call completed successfully. |
Vkadaba | 54:31921ad29828 | 717 | * |
Vkadaba | 54:31921ad29828 | 718 | * @details This can be used instead of @ref admw1001_SetLutData for |
Vkadaba | 54:31921ad29828 | 719 | * loading LUT data from the alternative raw data format. See |
Vkadaba | 54:31921ad29828 | 720 | * @ref admw1001_SetLutData for more information. |
Vkadaba | 54:31921ad29828 | 721 | * |
Vkadaba | 54:31921ad29828 | 722 | * @note Settings are not applied until admw_ApplyConfigUpdates() is called |
Vkadaba | 54:31921ad29828 | 723 | */ |
Vkadaba | 54:31921ad29828 | 724 | ADMW_RESULT admw1001_SetLutDataRaw( |
Vkadaba | 54:31921ad29828 | 725 | ADMW_DEVICE_HANDLE hDevice, |
Vkadaba | 54:31921ad29828 | 726 | ADMW1001_LUT_RAW *const pLutData); |
Vkadaba | 54:31921ad29828 | 727 | /*! |
ADIJake | 0:85855ecd3257 | 728 | * @brief Read measurement data samples from the device registers. |
ADIJake | 0:85855ecd3257 | 729 | * |
Vkadaba | 5:0728bde67bdb | 730 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 731 | * @param[in] eMeasurementMode Must be set to the same value used for @ref |
Vkadaba | 5:0728bde67bdb | 732 | * admw_StartMeasurement(). |
ADIJake | 0:85855ecd3257 | 733 | * @param[out] pSamples Pointer to return a set of requested data samples. |
ADIJake | 0:85855ecd3257 | 734 | * @param[in] nBytesPerSample The size, in bytes, of each sample. |
ADIJake | 0:85855ecd3257 | 735 | * @param[in] nRequested Number of requested data samples. |
ADIJake | 0:85855ecd3257 | 736 | * @param[out] pnReturned Number of valid data samples successfully retrieved. |
ADIJake | 0:85855ecd3257 | 737 | * |
ADIJake | 0:85855ecd3257 | 738 | * @return Status |
Vkadaba | 5:0728bde67bdb | 739 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 740 | * |
ADIJake | 0:85855ecd3257 | 741 | * @details Reads the status registers and extracts the relevant information |
ADIJake | 0:85855ecd3257 | 742 | * to return to the caller. |
ADIJake | 0:85855ecd3257 | 743 | * |
ADIJake | 0:85855ecd3257 | 744 | * @note This is intended to be called only when the DATAREADY status signal |
ADIJake | 0:85855ecd3257 | 745 | * is asserted. |
ADIJake | 0:85855ecd3257 | 746 | */ |
Vkadaba | 5:0728bde67bdb | 747 | ADMW_RESULT admw_GetData( |
Vkadaba | 5:0728bde67bdb | 748 | ADMW_DEVICE_HANDLE const hDevice, |
Vkadaba | 5:0728bde67bdb | 749 | ADMW_MEASUREMENT_MODE const eMeasurementMode, |
Vkadaba | 5:0728bde67bdb | 750 | ADMW_DATA_SAMPLE * const pSamples, |
ADIJake | 0:85855ecd3257 | 751 | uint8_t const nBytesPerSample, |
ADIJake | 0:85855ecd3257 | 752 | uint32_t const nRequested, |
ADIJake | 0:85855ecd3257 | 753 | uint32_t * const pnReturned); |
ADIJake | 0:85855ecd3257 | 754 | |
ADIJake | 0:85855ecd3257 | 755 | /*! |
ADIJake | 0:85855ecd3257 | 756 | * @brief Check if a command is currently running on the device. |
ADIJake | 0:85855ecd3257 | 757 | * |
Vkadaba | 5:0728bde67bdb | 758 | * @param[in] hDevice ADMW device context handle |
ADIJake | 0:85855ecd3257 | 759 | * @param[out] pbCommandRunning Pointer to return the command running status |
ADIJake | 0:85855ecd3257 | 760 | * |
ADIJake | 0:85855ecd3257 | 761 | * @return Status |
Vkadaba | 5:0728bde67bdb | 762 | * - #ADMW_SUCCESS Call completed successfully. |
ADIJake | 0:85855ecd3257 | 763 | * |
ADIJake | 0:85855ecd3257 | 764 | * @details Reads the device status register to check if a command is running. |
ADIJake | 0:85855ecd3257 | 765 | */ |
Vkadaba | 5:0728bde67bdb | 766 | ADMW_RESULT admw_GetCommandRunningState( |
Vkadaba | 5:0728bde67bdb | 767 | ADMW_DEVICE_HANDLE hDevice, |
ADIJake | 0:85855ecd3257 | 768 | bool *pbCommandRunning); |
ADIJake | 0:85855ecd3257 | 769 | |
Vkadaba | 32:52445bef314d | 770 | ADMW_RESULT admw1001_sendRun( ADMW_DEVICE_HANDLE const hDevice); |
Vkadaba | 50:d84305e5e1c0 | 771 | ADMW_RESULT admw_deviceInformation(ADMW_DEVICE_HANDLE hDevice); |
Vkadaba | 53:644c5f6300da | 772 | |
ADIJake | 0:85855ecd3257 | 773 | #ifdef __cplusplus |
ADIJake | 0:85855ecd3257 | 774 | } |
ADIJake | 0:85855ecd3257 | 775 | #endif |
ADIJake | 0:85855ecd3257 | 776 | |
ADIJake | 0:85855ecd3257 | 777 | /*! |
ADIJake | 0:85855ecd3257 | 778 | * @} |
ADIJake | 0:85855ecd3257 | 779 | */ |
ADIJake | 0:85855ecd3257 | 780 | |
Vkadaba | 6:9d393a9677f4 | 781 | #endif /* _ADMW_API_H__ */ |