AdiSense1000_V21 MBED API

Fork of AdiSense1000 by PoC_Team

Committer:
seanwilson10
Date:
Tue Jul 24 11:49:57 2018 +0000
Revision:
32:262fc8aeb486
Parent:
28:4eb837cd71df
Child:
30:119ff4f3aef6
v2.1 imported

Who changed what in which revision?

UserRevisionLine numberNew contents of line
danodonovan 26:12d0204be712 1 /*
danodonovan 26:12d0204be712 2 Copyright 2017 (c) Analog Devices, Inc.
danodonovan 26:12d0204be712 3
danodonovan 26:12d0204be712 4 All rights reserved.
danodonovan 26:12d0204be712 5
danodonovan 26:12d0204be712 6 Redistribution and use in source and binary forms, with or without
danodonovan 26:12d0204be712 7 modification, are permitted provided that the following conditions are met:
danodonovan 26:12d0204be712 8 - Redistributions of source code must retain the above copyright
danodonovan 26:12d0204be712 9 notice, this list of conditions and the following disclaimer.
danodonovan 26:12d0204be712 10 - Redistributions in binary form must reproduce the above copyright
danodonovan 26:12d0204be712 11 notice, this list of conditions and the following disclaimer in
danodonovan 26:12d0204be712 12 the documentation and/or other materials provided with the
danodonovan 26:12d0204be712 13 distribution.
danodonovan 26:12d0204be712 14 - Neither the name of Analog Devices, Inc. nor the names of its
danodonovan 26:12d0204be712 15 contributors may be used to endorse or promote products derived
danodonovan 26:12d0204be712 16 from this software without specific prior written permission.
danodonovan 26:12d0204be712 17 - The use of this software may or may not infringe the patent rights
danodonovan 26:12d0204be712 18 of one or more patent holders. This license does not release you
danodonovan 26:12d0204be712 19 from the requirement that you obtain separate licenses from these
danodonovan 26:12d0204be712 20 patent holders to use this software.
danodonovan 26:12d0204be712 21 - Use of the software either in source or binary form, must be run
danodonovan 26:12d0204be712 22 on or directly connected to an Analog Devices Inc. component.
danodonovan 26:12d0204be712 23
danodonovan 26:12d0204be712 24 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
danodonovan 26:12d0204be712 25 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
danodonovan 26:12d0204be712 26 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
danodonovan 26:12d0204be712 27 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
danodonovan 26:12d0204be712 28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
danodonovan 26:12d0204be712 29 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
danodonovan 26:12d0204be712 30 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
danodonovan 26:12d0204be712 31 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
danodonovan 26:12d0204be712 32 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
danodonovan 26:12d0204be712 33 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
danodonovan 26:12d0204be712 34 */
danodonovan 26:12d0204be712 35
kevin1990 28:4eb837cd71df 36 /*!
kevin1990 28:4eb837cd71df 37 ******************************************************************************
kevin1990 28:4eb837cd71df 38 * @file:
kevin1990 28:4eb837cd71df 39 * @brief: Look-Up Table data-type definitions for ADSNS1000 API.
kevin1990 28:4eb837cd71df 40 *-----------------------------------------------------------------------------
kevin1990 28:4eb837cd71df 41 */
kevin1990 28:4eb837cd71df 42
danodonovan 26:12d0204be712 43 #ifndef __ADI_SENSE_1000_LUT_DATA_H__
danodonovan 26:12d0204be712 44 #define __ADI_SENSE_1000_LUT_DATA_H__
danodonovan 26:12d0204be712 45
danodonovan 26:12d0204be712 46 #include "adi_sense_types.h"
danodonovan 26:12d0204be712 47 #include "adi_sense_1000_sensor_types.h"
danodonovan 26:12d0204be712 48
danodonovan 26:12d0204be712 49 /*! @addtogroup ADSNS1000_Api
danodonovan 26:12d0204be712 50 * @{
danodonovan 26:12d0204be712 51 */
danodonovan 26:12d0204be712 52
danodonovan 26:12d0204be712 53 #ifdef __cplusplus
danodonovan 26:12d0204be712 54 extern "C" {
danodonovan 26:12d0204be712 55 #endif
danodonovan 26:12d0204be712 56
danodonovan 26:12d0204be712 57 /*! LUT data validation signature */
danodonovan 26:12d0204be712 58 #define ADI_SENSE_LUT_SIGNATURE 0x4C555473
danodonovan 26:12d0204be712 59
danodonovan 26:12d0204be712 60 /*! LUT data CRC-16-CCITT seed value */
danodonovan 26:12d0204be712 61 #define ADI_SENSE_LUT_CRC_SEED 0x4153
danodonovan 26:12d0204be712 62
danodonovan 26:12d0204be712 63 /*! LUT maximum allowed size */
danodonovan 26:12d0204be712 64 #define ADI_SENSE_LUT_MAX_SIZE 12288U
danodonovan 26:12d0204be712 65
danodonovan 26:12d0204be712 66 /*! Linearisation look-up table / co-efficient list geometry */
danodonovan 26:12d0204be712 67 typedef enum {
danodonovan 26:12d0204be712 68 ADI_SENSE_1000_LUT_GEOMETRY_RESERVED = 0x00,
danodonovan 26:12d0204be712 69 /**< reserved - for internal use only */
danodonovan 26:12d0204be712 70 ADI_SENSE_1000_LUT_GEOMETRY_COEFFS = 0x01,
danodonovan 26:12d0204be712 71 /**< 1-dimensional equation coefficient list */
danodonovan 26:12d0204be712 72 ADI_SENSE_1000_LUT_GEOMETRY_NES_1D = 0x02,
danodonovan 26:12d0204be712 73 /**< 1-dimensional not-equally-spaced look-up table */
danodonovan 26:12d0204be712 74 ADI_SENSE_1000_LUT_GEOMETRY_NES_2D = 0x03,
danodonovan 26:12d0204be712 75 /**< 2-dimensional not-equally-spaced look-up table */
danodonovan 26:12d0204be712 76 ADI_SENSE_1000_LUT_GEOMETRY_ES_1D = 0x04,
danodonovan 26:12d0204be712 77 /**< 1-dimensional equally-spaced look-up table */
danodonovan 26:12d0204be712 78 ADI_SENSE_1000_LUT_GEOMETRY_ES_2D = 0x05,
danodonovan 26:12d0204be712 79 /**< 2-dimensional equally-spaced look-up table */
danodonovan 26:12d0204be712 80 } ADI_SENSE_1000_LUT_GEOMETRY;
danodonovan 26:12d0204be712 81
danodonovan 26:12d0204be712 82 /*! Linearisation equation type */
danodonovan 26:12d0204be712 83 typedef enum {
danodonovan 26:12d0204be712 84 ADI_SENSE_1000_LUT_EQUATION_POLYN,
danodonovan 26:12d0204be712 85 /**< Polynomial equation, typically used for Thermocouple and RTD
danodonovan 26:12d0204be712 86 * linearisation */
danodonovan 26:12d0204be712 87 ADI_SENSE_1000_LUT_EQUATION_POLYNEXP,
danodonovan 26:12d0204be712 88 /**< Polynomial + exponential equation, typically used for Thermocouple
danodonovan 26:12d0204be712 89 * inverse linearisation */
danodonovan 26:12d0204be712 90 ADI_SENSE_1000_LUT_EQUATION_QUADRATIC,
danodonovan 26:12d0204be712 91 /**< Quadratic linearisation equation, typically used for RTD
danodonovan 26:12d0204be712 92 * linearisation */
danodonovan 26:12d0204be712 93 ADI_SENSE_1000_LUT_EQUATION_STEINHART,
danodonovan 26:12d0204be712 94 /**< Steinhart-Hart equation, typically used for Thermistor
danodonovan 26:12d0204be712 95 * linearisation */
danodonovan 26:12d0204be712 96 ADI_SENSE_1000_LUT_EQUATION_LOGARITHMIC,
danodonovan 26:12d0204be712 97 /**< Beta-based logarithmic equation, typically used for Thermistor
danodonovan 26:12d0204be712 98 * linearisation */
danodonovan 26:12d0204be712 99 ADI_SENSE_1000_LUT_EQUATION_EXPONENTIAL,
danodonovan 26:12d0204be712 100 /**< Exponential equation */
danodonovan 26:12d0204be712 101 ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN,
danodonovan 26:12d0204be712 102 /**< Bi-variate polynomial equation, typically used for bridge pressure
danodonovan 26:12d0204be712 103 * sensor linearisation
danodonovan 26:12d0204be712 104 * @note 2nd-degree is the maximum currently supported
danodonovan 26:12d0204be712 105 */
danodonovan 26:12d0204be712 106 ADI_SENSE_1000_LUT_EQUATION_COUNT,
danodonovan 26:12d0204be712 107 /**< Enum count value - for internal use only */
danodonovan 26:12d0204be712 108 ADI_SENSE_1000_LUT_EQUATION_LUT,
danodonovan 26:12d0204be712 109 /**< Hard-coded Look-Up Table - for internal use only */
danodonovan 26:12d0204be712 110 } ADI_SENSE_1000_LUT_EQUATION;
danodonovan 26:12d0204be712 111
danodonovan 26:12d0204be712 112 typedef enum {
danodonovan 26:12d0204be712 113 ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
danodonovan 26:12d0204be712 114 /**< Thermocouple forward (mV to Celsius) linearisation
danodonovan 26:12d0204be712 115 * Use this value by default for non-thermocouple sensors */
danodonovan 26:12d0204be712 116 ADI_SENSE_1000_LUT_TC_DIRECTION_BACKWARD,
danodonovan 26:12d0204be712 117 /**< Thermocouple inverse (Celsius to mV) linearisation */
danodonovan 26:12d0204be712 118 ADI_SENSE_1000_LUT_TC_DIRECTION_COUNT,
danodonovan 26:12d0204be712 119 /**< Enum count value - for internal use only */
danodonovan 26:12d0204be712 120 } ADI_SENSE_1000_LUT_TC_DIRECTION;
danodonovan 26:12d0204be712 121
danodonovan 26:12d0204be712 122 /*! Linearisation data vector format */
danodonovan 26:12d0204be712 123 typedef enum {
danodonovan 26:12d0204be712 124 ADI_SENSE_1000_LUT_DATA_TYPE_RESERVED = 0,
danodonovan 26:12d0204be712 125 /**< Reserved - for internal use only */
danodonovan 26:12d0204be712 126 ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32 = 1,
danodonovan 26:12d0204be712 127 /**< Single-precision 32-bit floating-point */
danodonovan 26:12d0204be712 128 ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT64 = 2,
danodonovan 26:12d0204be712 129 /**< Double-precision 64-bit floating-point */
danodonovan 26:12d0204be712 130 } ADI_SENSE_1000_LUT_DATA_TYPE;
danodonovan 26:12d0204be712 131
danodonovan 26:12d0204be712 132 /*! Struct for a list of coefficients to be used in an equation */
danodonovan 26:12d0204be712 133 typedef struct __attribute__((packed, aligned(4))){
danodonovan 26:12d0204be712 134 uint32_t nCoeffs;
danodonovan 26:12d0204be712 135 /**< number of coefficients */
danodonovan 26:12d0204be712 136 float32_t rangeMin;
danodonovan 26:12d0204be712 137 /**< look-up table range - minimum */
danodonovan 26:12d0204be712 138 float32_t rangeMax;
danodonovan 26:12d0204be712 139 /**< look-up table range - maximum */
danodonovan 26:12d0204be712 140 float64_t coeffs[];
danodonovan 26:12d0204be712 141 /**< C99 flexible array: sorted by ascending exponent in polynomials */
danodonovan 26:12d0204be712 142 } ADI_SENSE_1000_LUT_COEFF_LIST;
danodonovan 26:12d0204be712 143
danodonovan 26:12d0204be712 144 /*! Struct for a 1-dimensional equally-spaced look-up table */
danodonovan 26:12d0204be712 145 typedef struct __attribute__((packed, aligned(4))){
danodonovan 26:12d0204be712 146 uint32_t nElements;
danodonovan 26:12d0204be712 147 /**< number of elements. */
danodonovan 26:12d0204be712 148 float32_t initInputValue;
danodonovan 26:12d0204be712 149 /**< initial input value, corresponding to first table element */
danodonovan 26:12d0204be712 150 float32_t inputValueIncrement;
danodonovan 26:12d0204be712 151 /**< interval between successive input values */
danodonovan 26:12d0204be712 152 float32_t lut[];
danodonovan 26:12d0204be712 153 /**< C99 flexible array */
danodonovan 26:12d0204be712 154 } ADI_SENSE_1000_LUT_1D_ES;
danodonovan 26:12d0204be712 155
danodonovan 26:12d0204be712 156 /*! Struct for a 1-dimensional not-equally-spaced look-up table */
danodonovan 26:12d0204be712 157 typedef struct __attribute__((packed, aligned(4))){
danodonovan 26:12d0204be712 158 uint32_t nElements;
danodonovan 26:12d0204be712 159 /**< number of elements of each array. */
danodonovan 26:12d0204be712 160 float32_t lut[];
danodonovan 26:12d0204be712 161 /**< C99 flexible array, first X's array then Y's array*/
danodonovan 26:12d0204be712 162 } ADI_SENSE_1000_LUT_1D_NES;
danodonovan 26:12d0204be712 163
danodonovan 26:12d0204be712 164 /*! Struct for a 2-dimensional equally-spaced look-up table */
danodonovan 26:12d0204be712 165 typedef struct __attribute__((packed, aligned(4))){
danodonovan 26:12d0204be712 166 uint16_t nElementsX;
danodonovan 26:12d0204be712 167 /**< number of elements for input X. */
danodonovan 26:12d0204be712 168 uint16_t nElementsY;
danodonovan 26:12d0204be712 169 /**< number of elements for input Y. */
danodonovan 26:12d0204be712 170 float32_t initInputValueX;
danodonovan 26:12d0204be712 171 /**< initial X input value */
danodonovan 26:12d0204be712 172 float32_t inputValueIncrementX;
danodonovan 26:12d0204be712 173 /**< interval between successive X input values */
danodonovan 26:12d0204be712 174 float32_t initInputValueY;
danodonovan 26:12d0204be712 175 /**< initial Y input value */
danodonovan 26:12d0204be712 176 float32_t inputValueIncrementY;
danodonovan 26:12d0204be712 177 /**< interval between successive Y input values */
danodonovan 26:12d0204be712 178 float32_t lut[];
danodonovan 26:12d0204be712 179 /**< C99 flexible array, Z matrix[y][x] */
danodonovan 26:12d0204be712 180 } ADI_SENSE_1000_LUT_2D_ES;
danodonovan 26:12d0204be712 181
danodonovan 26:12d0204be712 182 /*! Struct for a 2-dimensional not-equally-spaced look-up table */
danodonovan 26:12d0204be712 183 typedef struct __attribute__((packed, aligned(4))){
danodonovan 26:12d0204be712 184 uint16_t nElementsX;
danodonovan 26:12d0204be712 185 /**< number of elements in array X. */
danodonovan 26:12d0204be712 186 uint16_t nElementsY;
danodonovan 26:12d0204be712 187 /**< number of elements in array Y. */
danodonovan 26:12d0204be712 188 float32_t lut[];
danodonovan 26:12d0204be712 189 /**< C99 flexible array, Order: X's array, Y's array, Z matrix[y][x] */
danodonovan 26:12d0204be712 190 } ADI_SENSE_1000_LUT_2D_NES;
danodonovan 26:12d0204be712 191
danodonovan 26:12d0204be712 192 /*! Struct for a 2-dimensional list of coefficients to be used in a
danodonovan 26:12d0204be712 193 * bi-variate polynomial equation */
danodonovan 26:12d0204be712 194 typedef struct __attribute__((packed, aligned(4))){
danodonovan 26:12d0204be712 195 uint32_t maxDegree;
danodonovan 26:12d0204be712 196 /**< number of coefficients */
danodonovan 26:12d0204be712 197 float32_t rangeMinX;
danodonovan 26:12d0204be712 198 /**< look-up table range - minimum X input value */
danodonovan 26:12d0204be712 199 float32_t rangeMaxX;
danodonovan 26:12d0204be712 200 /**< look-up table range - maximum X input value */
danodonovan 26:12d0204be712 201 float32_t rangeMinY;
danodonovan 26:12d0204be712 202 /**< look-up table range - minimum Y input value */
danodonovan 26:12d0204be712 203 float32_t rangeMaxY;
danodonovan 26:12d0204be712 204 /**< look-up table range - maximum Y input value */
danodonovan 26:12d0204be712 205 float64_t coeffs[];
danodonovan 26:12d0204be712 206 /**< C99 flexible array: sorted by ascending X degree then sorted by
danodonovan 26:12d0204be712 207 * ascending Y exponent */
danodonovan 26:12d0204be712 208 } ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST;
danodonovan 26:12d0204be712 209
danodonovan 26:12d0204be712 210 /*! Macro to calculate the number of elements in
danodonovan 26:12d0204be712 211 * a @ref ADI_SENSE_1000_LUT_COEFF_LIST table */
danodonovan 26:12d0204be712 212 #define ADI_SENSE_1000_LUT_COEFF_LIST_NELEMENTS(_t) \
danodonovan 26:12d0204be712 213 ((_t).nCoeffs)
danodonovan 26:12d0204be712 214
danodonovan 26:12d0204be712 215 /*! Macro to calculate the number of elements in
danodonovan 26:12d0204be712 216 * a @ref ADI_SENSE_1000_LUT_1D_ES table */
danodonovan 26:12d0204be712 217 #define ADI_SENSE_1000_LUT_1D_ES_NELEMENTS(_t) \
danodonovan 26:12d0204be712 218 ((_t).nElements)
danodonovan 26:12d0204be712 219
danodonovan 26:12d0204be712 220 /*! Macro to calculate the number of elements in
danodonovan 26:12d0204be712 221 * a @ref ADI_SENSE_1000_LUT_1D_NES table */
danodonovan 26:12d0204be712 222 #define ADI_SENSE_1000_LUT_1D_NES_NELEMENTS(_t) \
danodonovan 26:12d0204be712 223 ((_t).nElements * 2)
danodonovan 26:12d0204be712 224
danodonovan 26:12d0204be712 225 /*! Macro to calculate the number of elements in
danodonovan 26:12d0204be712 226 * a @ref ADI_SENSE_1000_LUT_2D_ES table */
danodonovan 26:12d0204be712 227 #define ADI_SENSE_1000_LUT_2D_ES_NELEMENTS(_t) \
danodonovan 26:12d0204be712 228 ((_t).nElementsX * (_t).nElementsX)
danodonovan 26:12d0204be712 229
danodonovan 26:12d0204be712 230 /*! Macro to calculate the number of elements in
danodonovan 26:12d0204be712 231 * a @ref ADI_SENSE_1000_LUT_2D_NES table */
danodonovan 26:12d0204be712 232 #define ADI_SENSE_1000_LUT_2D_NES_NELEMENTS(_t) \
danodonovan 26:12d0204be712 233 ((_t).nElementsX + (_t).nElementsY + ((_t).nElementsX * (_t).nElementsY))
danodonovan 26:12d0204be712 234
danodonovan 26:12d0204be712 235 /*! Macro to calculate the number of elements in
danodonovan 26:12d0204be712 236 * a @ref ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST table */
danodonovan 26:12d0204be712 237 #define ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_NELEMENTS(_t) \
danodonovan 26:12d0204be712 238 (((_t).maxDegree + 1) * ((_t).maxDegree + 2) / 2)
danodonovan 26:12d0204be712 239
danodonovan 26:12d0204be712 240 /*! Macro to calculate the storage size in bytes of
danodonovan 26:12d0204be712 241 * a @ref ADI_SENSE_1000_LUT_COEFF_LIST table */
danodonovan 26:12d0204be712 242 #define ADI_SENSE_1000_LUT_COEFF_LIST_SIZE(_t) \
danodonovan 26:12d0204be712 243 (sizeof(_t) + (sizeof(float64_t) * ADI_SENSE_1000_LUT_COEFF_LIST_NELEMENTS(_t)))
danodonovan 26:12d0204be712 244
danodonovan 26:12d0204be712 245 /*! Macro to calculate the storage size in bytes of
danodonovan 26:12d0204be712 246 * a @ref ADI_SENSE_1000_LUT_1D_ES table */
danodonovan 26:12d0204be712 247 #define ADI_SENSE_1000_LUT_1D_ES_SIZE(_t) \
danodonovan 26:12d0204be712 248 (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_1D_ES_NELEMENTS(_t)))
danodonovan 26:12d0204be712 249
danodonovan 26:12d0204be712 250 /*! Macro to calculate the storage size in bytes of
danodonovan 26:12d0204be712 251 * a @ref ADI_SENSE_1000_LUT_1D_NES table */
danodonovan 26:12d0204be712 252 #define ADI_SENSE_1000_LUT_1D_NES_SIZE(_t) \
danodonovan 26:12d0204be712 253 (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_1D_NES_NELEMENTS(_t)))
danodonovan 26:12d0204be712 254
danodonovan 26:12d0204be712 255 /*! Macro to calculate the storage size in bytes of
danodonovan 26:12d0204be712 256 * a @ref ADI_SENSE_1000_LUT_2D_ES table */
danodonovan 26:12d0204be712 257 #define ADI_SENSE_1000_LUT_2D_ES_SIZE(_t) \
danodonovan 26:12d0204be712 258 (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_2D_ES_NELEMENTS(_t)))
danodonovan 26:12d0204be712 259
danodonovan 26:12d0204be712 260 /*! Macro to calculate the storage size in bytes of
danodonovan 26:12d0204be712 261 * a @ref ADI_SENSE_1000_LUT_2D_NES table */
danodonovan 26:12d0204be712 262 #define ADI_SENSE_1000_LUT_2D_NES_SIZE(_t) \
danodonovan 26:12d0204be712 263 (sizeof(_t) + (sizeof(float32_t) * ADI_SENSE_1000_LUT_2D_NES_NELEMENTS(_t)))
danodonovan 26:12d0204be712 264
danodonovan 26:12d0204be712 265 /*! Macro to calculate the storage size in bytes of
danodonovan 26:12d0204be712 266 * a @ref ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST table */
danodonovan 26:12d0204be712 267 #define ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_SIZE(_t) \
danodonovan 26:12d0204be712 268 (sizeof(_t) + (sizeof(float64_t) * ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST_NELEMENTS(_t)))
danodonovan 26:12d0204be712 269
danodonovan 26:12d0204be712 270 /*! Look-Up Table descriptor */
danodonovan 26:12d0204be712 271 typedef union __attribute__((packed, aligned(4))) {
danodonovan 26:12d0204be712 272 struct {
danodonovan 26:12d0204be712 273 ADI_SENSE_1000_LUT_GEOMETRY geometry : 6;
danodonovan 26:12d0204be712 274 /**< Table geometry */
danodonovan 26:12d0204be712 275 ADI_SENSE_1000_LUT_EQUATION equation : 6;
danodonovan 26:12d0204be712 276 /**< Equation type */
danodonovan 26:12d0204be712 277 ADI_SENSE_1000_LUT_TC_DIRECTION dir : 4;
danodonovan 26:12d0204be712 278 /**< Thermocouple linearisation direction */
danodonovan 26:12d0204be712 279 ADI_SENSE_1000_ADC_SENSOR_TYPE sensor : 12;
danodonovan 26:12d0204be712 280 /**< Sensor Type ID */
danodonovan 26:12d0204be712 281 ADI_SENSE_1000_LUT_DATA_TYPE dataType : 4;
danodonovan 26:12d0204be712 282 /**< Table vector data type */
danodonovan 26:12d0204be712 283 uint16_t length;
danodonovan 26:12d0204be712 284 /**< Length in bytes of table data section
danodonovan 26:12d0204be712 285 * (excluding this header) */
danodonovan 26:12d0204be712 286 uint16_t crc16;
danodonovan 26:12d0204be712 287 /**< CRC-16-CCITT of the data */
danodonovan 26:12d0204be712 288 };
danodonovan 26:12d0204be712 289 uint64_t value64;
danodonovan 26:12d0204be712 290 } ADI_SENSE_1000_LUT_DESCRIPTOR;
danodonovan 26:12d0204be712 291
danodonovan 26:12d0204be712 292 /*! Look-Up Table geometry-specific data structures */
danodonovan 26:12d0204be712 293 typedef union {
danodonovan 26:12d0204be712 294 ADI_SENSE_1000_LUT_COEFF_LIST coeffList;
danodonovan 26:12d0204be712 295 /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_COEFFS geometry
danodonovan 26:12d0204be712 296 * except where equation is ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN */
danodonovan 26:12d0204be712 297 ADI_SENSE_1000_LUT_1D_ES lut1dEs;
danodonovan 26:12d0204be712 298 /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_ES_1D geometry */
danodonovan 26:12d0204be712 299 ADI_SENSE_1000_LUT_1D_NES lut1dNes;
danodonovan 26:12d0204be712 300 /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_NES_1D geometry */
danodonovan 26:12d0204be712 301 ADI_SENSE_1000_LUT_2D_ES lut2dEs;
danodonovan 26:12d0204be712 302 /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_ES_2D geometry */
danodonovan 26:12d0204be712 303 ADI_SENSE_1000_LUT_2D_NES lut2dNes;
danodonovan 26:12d0204be712 304 /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_NES_2D geometry */
danodonovan 26:12d0204be712 305 ADI_SENSE_1000_LUT_2D_POLYN_COEFF_LIST coeffList2d;
danodonovan 26:12d0204be712 306 /**< Data format for tables with ADI_SENSE_1000_LUT_GEOMETRY_COEFFS geometry
danodonovan 26:12d0204be712 307 * and ADI_SENSE_1000_LUT_EQUATION_BIVARIATE_POLYN equation */
danodonovan 26:12d0204be712 308 } ADI_SENSE_1000_LUT_TABLE_DATA;
danodonovan 26:12d0204be712 309
danodonovan 26:12d0204be712 310 /*! Look-Up Table structure */
danodonovan 26:12d0204be712 311 typedef struct __attribute__((packed, aligned(4))) {
danodonovan 26:12d0204be712 312 ADI_SENSE_1000_LUT_DESCRIPTOR descriptor;
danodonovan 26:12d0204be712 313 /**< Look-Up Table descriptor */
danodonovan 26:12d0204be712 314 ADI_SENSE_1000_LUT_TABLE_DATA data;
danodonovan 26:12d0204be712 315 /**< Look-Up Table data */
danodonovan 26:12d0204be712 316 } ADI_SENSE_1000_LUT_TABLE;
danodonovan 26:12d0204be712 317
danodonovan 26:12d0204be712 318 /*! LUT data format versions */
danodonovan 26:12d0204be712 319 typedef struct __attribute__((packed, aligned(4))) {
danodonovan 26:12d0204be712 320 uint8_t major; /*!< Major version number */
danodonovan 26:12d0204be712 321 uint8_t minor; /*!< Minor version number */
danodonovan 26:12d0204be712 322 } ADI_SENSE_1000_LUT_VERSION;
danodonovan 26:12d0204be712 323
danodonovan 26:12d0204be712 324 /*! LUT data header structure */
danodonovan 26:12d0204be712 325 typedef struct __attribute__((packed, aligned(4))) {
danodonovan 26:12d0204be712 326 uint32_t signature;
danodonovan 26:12d0204be712 327 /**< Hard-coded signature value (@ref ADI_SENSE_LUT_SIGNATURE) */
danodonovan 26:12d0204be712 328 ADI_SENSE_1000_LUT_VERSION version;
danodonovan 26:12d0204be712 329 /**< LUT data format version (@ref ADI_SENSE_LUT_VERSION) */
danodonovan 26:12d0204be712 330 uint16_t numTables;
danodonovan 26:12d0204be712 331 /**< Total number of tables */
danodonovan 26:12d0204be712 332 uint32_t totalLength;
danodonovan 26:12d0204be712 333 /**< Total length (in bytes) of all table descriptors and data
danodonovan 26:12d0204be712 334 * (excluding this header)
danodonovan 26:12d0204be712 335 * This, plus the header length, must not exceed ADI_SENSE_LUT_MAX_SIZE
danodonovan 26:12d0204be712 336 */
danodonovan 26:12d0204be712 337 } ADI_SENSE_1000_LUT_HEADER;
danodonovan 26:12d0204be712 338
danodonovan 26:12d0204be712 339 /*! LUT data top-level structure */
danodonovan 26:12d0204be712 340 typedef struct __attribute__((packed, aligned(4))) {
danodonovan 26:12d0204be712 341 ADI_SENSE_1000_LUT_HEADER header;
danodonovan 26:12d0204be712 342 /*!< LUT data top-level header structure */
danodonovan 26:12d0204be712 343 ADI_SENSE_1000_LUT_TABLE tables[];
danodonovan 26:12d0204be712 344 /*!< Variable-length array of one-or-more look-up table structures */
danodonovan 26:12d0204be712 345 } ADI_SENSE_1000_LUT;
danodonovan 26:12d0204be712 346
danodonovan 26:12d0204be712 347 /*! Alternative top-level structure for raw LUT data representation
danodonovan 26:12d0204be712 348 *
danodonovan 26:12d0204be712 349 * @note This is intended to be used for encapsulating the storage of static
danodonovan 26:12d0204be712 350 * LUT data declarations in C files. The rawTableData can be cast
kevin1990 28:4eb837cd71df 351 * to the ADI_SENSE_LUT type for further parsing/processing.
danodonovan 26:12d0204be712 352 */
danodonovan 26:12d0204be712 353 typedef struct __attribute__((packed, aligned(4))) {
danodonovan 26:12d0204be712 354 ADI_SENSE_1000_LUT_HEADER header;
danodonovan 26:12d0204be712 355 /*!< LUT data top-level header structure */
danodonovan 26:12d0204be712 356 uint8_t rawTableData[];
danodonovan 26:12d0204be712 357 /*!< Variable-length byte array of look-up tables in raw binary format */
danodonovan 26:12d0204be712 358 } ADI_SENSE_1000_LUT_RAW;
danodonovan 26:12d0204be712 359
danodonovan 26:12d0204be712 360 #ifdef __cplusplus
danodonovan 26:12d0204be712 361 }
danodonovan 26:12d0204be712 362 #endif
danodonovan 26:12d0204be712 363
danodonovan 26:12d0204be712 364 /*!
danodonovan 26:12d0204be712 365 * @}
danodonovan 26:12d0204be712 366 */
danodonovan 26:12d0204be712 367
danodonovan 26:12d0204be712 368 #endif /* __ADI_SENSE_1000_LUT_DATA_H__ */