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