PoC_Team
/
ADMW1001_example_firmware
Host API Example for the ADMW1001
config.c@19:09d58952b65d, 2019-09-09 (annotated)
- Committer:
- Vkadaba
- Date:
- Mon Sep 09 05:57:43 2019 +0000
- Revision:
- 19:09d58952b65d
- Parent:
- 17:2f0028880874
- Child:
- 23:bb685f35b08b
AdSense, ADI Sense, ADISNS1000 are replaced with ADMW1001
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vkadaba | 17:2f0028880874 | 1 | /*! |
Vkadaba | 17:2f0028880874 | 2 | |
Vkadaba | 17:2f0028880874 | 3 | ****************************************************************************** |
Vkadaba | 17:2f0028880874 | 4 | |
Vkadaba | 17:2f0028880874 | 5 | * @file: config.c |
Vkadaba | 17:2f0028880874 | 6 | |
Vkadaba | 17:2f0028880874 | 7 | * @brief: |
Vkadaba | 17:2f0028880874 | 8 | |
Vkadaba | 17:2f0028880874 | 9 | *----------------------------------------------------------------------------- |
Vkadaba | 17:2f0028880874 | 10 | |
Vkadaba | 17:2f0028880874 | 11 | * |
Vkadaba | 17:2f0028880874 | 12 | |
Vkadaba | 19:09d58952b65d | 13 | Copyright (c) 2019 Analog Devices, Inc. |
Vkadaba | 17:2f0028880874 | 14 | |
Vkadaba | 17:2f0028880874 | 15 | |
Vkadaba | 17:2f0028880874 | 16 | |
Vkadaba | 17:2f0028880874 | 17 | All rights reserved. |
Vkadaba | 17:2f0028880874 | 18 | |
Vkadaba | 17:2f0028880874 | 19 | |
Vkadaba | 17:2f0028880874 | 20 | |
Vkadaba | 17:2f0028880874 | 21 | Redistribution and use in source and binary forms, with or without modification, |
Vkadaba | 17:2f0028880874 | 22 | |
Vkadaba | 17:2f0028880874 | 23 | are permitted provided that the following conditions are met: |
Vkadaba | 17:2f0028880874 | 24 | |
Vkadaba | 17:2f0028880874 | 25 | - Redistributions of source code must retain the above copyright notice, |
Vkadaba | 17:2f0028880874 | 26 | |
Vkadaba | 17:2f0028880874 | 27 | this list of conditions and the following disclaimer. |
Vkadaba | 17:2f0028880874 | 28 | |
Vkadaba | 17:2f0028880874 | 29 | - Redistributions in binary form must reproduce the above copyright notice, |
Vkadaba | 17:2f0028880874 | 30 | |
Vkadaba | 17:2f0028880874 | 31 | this list of conditions and the following disclaimer in the documentation |
Vkadaba | 17:2f0028880874 | 32 | |
Vkadaba | 17:2f0028880874 | 33 | and/or other materials provided with the distribution. |
Vkadaba | 17:2f0028880874 | 34 | |
Vkadaba | 17:2f0028880874 | 35 | - Modified versions of the software must be conspicuously marked as such. |
Vkadaba | 17:2f0028880874 | 36 | |
Vkadaba | 17:2f0028880874 | 37 | - This software is licensed solely and exclusively for use with processors |
Vkadaba | 17:2f0028880874 | 38 | |
Vkadaba | 17:2f0028880874 | 39 | manufactured by or for Analog Devices, Inc. |
Vkadaba | 17:2f0028880874 | 40 | |
Vkadaba | 17:2f0028880874 | 41 | - This software may not be combined or merged with other code in any manner |
Vkadaba | 17:2f0028880874 | 42 | |
Vkadaba | 17:2f0028880874 | 43 | that would cause the software to become subject to terms and conditions |
Vkadaba | 17:2f0028880874 | 44 | |
Vkadaba | 17:2f0028880874 | 45 | which differ from those listed here. |
Vkadaba | 17:2f0028880874 | 46 | |
Vkadaba | 17:2f0028880874 | 47 | - Neither the name of Analog Devices, Inc. nor the names of its |
Vkadaba | 17:2f0028880874 | 48 | |
Vkadaba | 17:2f0028880874 | 49 | contributors may be used to endorse or promote products derived |
Vkadaba | 17:2f0028880874 | 50 | |
Vkadaba | 17:2f0028880874 | 51 | from this software without specific prior written permission. |
Vkadaba | 17:2f0028880874 | 52 | |
Vkadaba | 17:2f0028880874 | 53 | - The use of this software may or may not infringe the patent rights of one |
Vkadaba | 17:2f0028880874 | 54 | |
Vkadaba | 17:2f0028880874 | 55 | or more patent holders. This license does not release you from the |
Vkadaba | 17:2f0028880874 | 56 | |
Vkadaba | 17:2f0028880874 | 57 | requirement that you obtain separate licenses from these patent holders |
Vkadaba | 17:2f0028880874 | 58 | |
Vkadaba | 17:2f0028880874 | 59 | to use this software. |
Vkadaba | 17:2f0028880874 | 60 | |
Vkadaba | 17:2f0028880874 | 61 | |
Vkadaba | 17:2f0028880874 | 62 | |
Vkadaba | 17:2f0028880874 | 63 | THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY |
Vkadaba | 17:2f0028880874 | 64 | |
Vkadaba | 17:2f0028880874 | 65 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
Vkadaba | 17:2f0028880874 | 66 | |
Vkadaba | 17:2f0028880874 | 67 | TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
Vkadaba | 17:2f0028880874 | 68 | |
Vkadaba | 17:2f0028880874 | 69 | NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
Vkadaba | 17:2f0028880874 | 70 | |
Vkadaba | 17:2f0028880874 | 71 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES |
Vkadaba | 17:2f0028880874 | 72 | |
Vkadaba | 17:2f0028880874 | 73 | (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL |
Vkadaba | 17:2f0028880874 | 74 | |
Vkadaba | 17:2f0028880874 | 75 | PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
Vkadaba | 17:2f0028880874 | 76 | |
Vkadaba | 17:2f0028880874 | 77 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
Vkadaba | 17:2f0028880874 | 78 | |
Vkadaba | 17:2f0028880874 | 79 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
Vkadaba | 17:2f0028880874 | 80 | |
Vkadaba | 17:2f0028880874 | 81 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
Vkadaba | 17:2f0028880874 | 82 | |
Vkadaba | 17:2f0028880874 | 83 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Vkadaba | 17:2f0028880874 | 84 | |
Vkadaba | 17:2f0028880874 | 85 | * |
Vkadaba | 17:2f0028880874 | 86 | |
Vkadaba | 17:2f0028880874 | 87 | *****************************************************************************/ |
Vkadaba | 17:2f0028880874 | 88 | |
Vkadaba | 17:2f0028880874 | 89 | |
Vkadaba | 17:2f0028880874 | 90 | |
Vkadaba | 17:2f0028880874 | 91 | #include "inc/admw_config_types.h" |
Vkadaba | 17:2f0028880874 | 92 | |
Vkadaba | 17:2f0028880874 | 93 | |
Vkadaba | 17:2f0028880874 | 94 | |
Vkadaba | 17:2f0028880874 | 95 | ADMW_CONFIG config= { |
Vkadaba | 17:2f0028880874 | 96 | |
Vkadaba | 17:2f0028880874 | 97 | .versionId = { .major = 2, .minor = 0 }, |
Vkadaba | 17:2f0028880874 | 98 | |
Vkadaba | 17:2f0028880874 | 99 | .productId = ADMW_PRODUCT_ID_ADMW1001, |
Vkadaba | 17:2f0028880874 | 100 | |
Vkadaba | 17:2f0028880874 | 101 | .admw1001 = { |
Vkadaba | 17:2f0028880874 | 102 | |
Vkadaba | 17:2f0028880874 | 103 | .power = { |
Vkadaba | 17:2f0028880874 | 104 | |
Vkadaba | 17:2f0028880874 | 105 | .powerMode = ADMW1001_POWER_MODE_ACTIVE, |
Vkadaba | 17:2f0028880874 | 106 | |
Vkadaba | 17:2f0028880874 | 107 | }, |
Vkadaba | 17:2f0028880874 | 108 | |
Vkadaba | 17:2f0028880874 | 109 | .measurement = { |
Vkadaba | 17:2f0028880874 | 110 | |
Vkadaba | 17:2f0028880874 | 111 | .operatingMode = ADMW1001_OPERATING_MODE_CONTINUOUS, |
Vkadaba | 17:2f0028880874 | 112 | |
Vkadaba | 17:2f0028880874 | 113 | .dataReadyMode = ADMW1001_DATAREADY_PER_CYCLE, // FIX: Temporarily all values from json are hardcoded to this one in the Contracts.FileGenerator - > file translations!! |
Vkadaba | 17:2f0028880874 | 114 | |
Vkadaba | 17:2f0028880874 | 115 | .cycleInterval = 0, |
Vkadaba | 17:2f0028880874 | 116 | |
Vkadaba | 17:2f0028880874 | 117 | .vBiasEnable = true, |
Vkadaba | 17:2f0028880874 | 118 | |
Vkadaba | 17:2f0028880874 | 119 | }, |
Vkadaba | 17:2f0028880874 | 120 | |
Vkadaba | 17:2f0028880874 | 121 | .diagnostics = { |
Vkadaba | 17:2f0028880874 | 122 | |
Vkadaba | 17:2f0028880874 | 123 | .disableGlobalDiag = true, |
Vkadaba | 17:2f0028880874 | 124 | |
Vkadaba | 17:2f0028880874 | 125 | .disableMeasurementDiag = true, |
Vkadaba | 17:2f0028880874 | 126 | |
Vkadaba | 17:2f0028880874 | 127 | .osdFrequency = ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED, |
Vkadaba | 17:2f0028880874 | 128 | |
Vkadaba | 17:2f0028880874 | 129 | }, |
Vkadaba | 17:2f0028880874 | 130 | |
Vkadaba | 17:2f0028880874 | 131 | .channels = { |
Vkadaba | 17:2f0028880874 | 132 | |
Vkadaba | 17:2f0028880874 | 133 | [ADMW1001_CH_ID_ANLG_1_UNIVERSAL] = { |
Vkadaba | 17:2f0028880874 | 134 | |
Vkadaba | 17:2f0028880874 | 135 | .enableChannel = true, |
Vkadaba | 17:2f0028880874 | 136 | |
Vkadaba | 17:2f0028880874 | 137 | .disablePublishing = false, |
Vkadaba | 17:2f0028880874 | 138 | |
Vkadaba | 17:2f0028880874 | 139 | .compensationChannel = ADMW1001_CH_ID_NONE, |
Vkadaba | 17:2f0028880874 | 140 | |
Vkadaba | 17:2f0028880874 | 141 | .lutSelect = ADMW1001_LUT_DEFAULT, |
Vkadaba | 17:2f0028880874 | 142 | |
Vkadaba | 17:2f0028880874 | 143 | .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS, |
Vkadaba | 17:2f0028880874 | 144 | |
Vkadaba | 17:2f0028880874 | 145 | .lowThreshold = -50, |
Vkadaba | 17:2f0028880874 | 146 | |
Vkadaba | 17:2f0028880874 | 147 | .highThreshold = 250, |
Vkadaba | 17:2f0028880874 | 148 | |
Vkadaba | 17:2f0028880874 | 149 | .offsetAdjustment = 0.0, |
Vkadaba | 17:2f0028880874 | 150 | |
Vkadaba | 17:2f0028880874 | 151 | .gainAdjustment = 0.0, |
Vkadaba | 17:2f0028880874 | 152 | |
Vkadaba | 17:2f0028880874 | 153 | .sensorParameter = 0.0, |
Vkadaba | 17:2f0028880874 | 154 | |
Vkadaba | 17:2f0028880874 | 155 | .measurementsPerCycle = 1, |
Vkadaba | 17:2f0028880874 | 156 | |
Vkadaba | 17:2f0028880874 | 157 | .cycleSkipCount = 0, |
Vkadaba | 17:2f0028880874 | 158 | |
Vkadaba | 17:2f0028880874 | 159 | .extraSettlingTime = 0, |
Vkadaba | 17:2f0028880874 | 160 | |
Vkadaba | 17:2f0028880874 | 161 | .priority = 0, |
Vkadaba | 17:2f0028880874 | 162 | |
Vkadaba | 17:2f0028880874 | 163 | .adcChannelConfig = { |
Vkadaba | 17:2f0028880874 | 164 | |
Vkadaba | 17:2f0028880874 | 165 | .sensor = ADMW1001_ADC_SENSOR_RTD_2WIRE_PT100, |
Vkadaba | 17:2f0028880874 | 166 | |
Vkadaba | 17:2f0028880874 | 167 | .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN, |
Vkadaba | 17:2f0028880874 | 168 | |
Vkadaba | 17:2f0028880874 | 169 | .gain = ADMW1001_ADC_GAIN_2X, |
Vkadaba | 17:2f0028880874 | 170 | |
Vkadaba | 17:2f0028880874 | 171 | .current = { |
Vkadaba | 17:2f0028880874 | 172 | |
Vkadaba | 17:2f0028880874 | 173 | .excitationState= ADMW1001_ADC_EXC_STATE_ALWAYS_ON, |
Vkadaba | 17:2f0028880874 | 174 | |
Vkadaba | 17:2f0028880874 | 175 | .outputLevel = ADMW1001_ADC_EXC_CURRENT_250uA, |
Vkadaba | 17:2f0028880874 | 176 | |
Vkadaba | 17:2f0028880874 | 177 | .diodeRatio = 0, |
Vkadaba | 17:2f0028880874 | 178 | |
Vkadaba | 17:2f0028880874 | 179 | }, |
Vkadaba | 17:2f0028880874 | 180 | |
Vkadaba | 17:2f0028880874 | 181 | .filter = { |
Vkadaba | 17:2f0028880874 | 182 | |
Vkadaba | 17:2f0028880874 | 183 | .type = ADMW1001_ADC_FILTER_SINC3, |
Vkadaba | 17:2f0028880874 | 184 | |
Vkadaba | 17:2f0028880874 | 185 | .sf = ADMW1001_SF_8P24HZ, |
Vkadaba | 17:2f0028880874 | 186 | |
Vkadaba | 17:2f0028880874 | 187 | .chopMode = ADMW1001_CHOP_MD_SW, |
Vkadaba | 17:2f0028880874 | 188 | |
Vkadaba | 17:2f0028880874 | 189 | .notch1p2 = false, |
Vkadaba | 17:2f0028880874 | 190 | |
Vkadaba | 17:2f0028880874 | 191 | .groundSwitch = ADMW1001_ADC_GND_SW_OPEN |
Vkadaba | 17:2f0028880874 | 192 | |
Vkadaba | 17:2f0028880874 | 193 | }, |
Vkadaba | 17:2f0028880874 | 194 | |
Vkadaba | 17:2f0028880874 | 195 | .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL, |
Vkadaba | 17:2f0028880874 | 196 | |
Vkadaba | 17:2f0028880874 | 197 | }, |
Vkadaba | 17:2f0028880874 | 198 | |
Vkadaba | 17:2f0028880874 | 199 | }, |
Vkadaba | 17:2f0028880874 | 200 | |
Vkadaba | 17:2f0028880874 | 201 | [ADMW1001_CH_ID_ANLG_1_DIFFERENTIAL] = { |
Vkadaba | 17:2f0028880874 | 202 | |
Vkadaba | 17:2f0028880874 | 203 | .enableChannel = true, |
Vkadaba | 17:2f0028880874 | 204 | |
Vkadaba | 17:2f0028880874 | 205 | .disablePublishing = false, |
Vkadaba | 17:2f0028880874 | 206 | |
Vkadaba | 17:2f0028880874 | 207 | .compensationChannel = ADMW1001_CH_ID_ANLG_1_UNIVERSAL, |
Vkadaba | 17:2f0028880874 | 208 | |
Vkadaba | 17:2f0028880874 | 209 | .lutSelect = ADMW1001_LUT_DEFAULT, |
Vkadaba | 17:2f0028880874 | 210 | |
Vkadaba | 17:2f0028880874 | 211 | .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS, |
Vkadaba | 17:2f0028880874 | 212 | |
Vkadaba | 17:2f0028880874 | 213 | .lowThreshold = -50, |
Vkadaba | 17:2f0028880874 | 214 | |
Vkadaba | 17:2f0028880874 | 215 | .highThreshold = 250, |
Vkadaba | 17:2f0028880874 | 216 | |
Vkadaba | 17:2f0028880874 | 217 | .offsetAdjustment = 0.0, |
Vkadaba | 17:2f0028880874 | 218 | |
Vkadaba | 17:2f0028880874 | 219 | .gainAdjustment = 0.0, |
Vkadaba | 17:2f0028880874 | 220 | |
Vkadaba | 17:2f0028880874 | 221 | .sensorParameter = 0.0, |
Vkadaba | 17:2f0028880874 | 222 | |
Vkadaba | 17:2f0028880874 | 223 | .measurementsPerCycle = 1, |
Vkadaba | 17:2f0028880874 | 224 | |
Vkadaba | 17:2f0028880874 | 225 | .cycleSkipCount = 0, |
Vkadaba | 17:2f0028880874 | 226 | |
Vkadaba | 17:2f0028880874 | 227 | .extraSettlingTime = 4499.99986449257, |
Vkadaba | 17:2f0028880874 | 228 | |
Vkadaba | 17:2f0028880874 | 229 | .priority = 0, |
Vkadaba | 17:2f0028880874 | 230 | |
Vkadaba | 17:2f0028880874 | 231 | .adcChannelConfig = { |
Vkadaba | 17:2f0028880874 | 232 | |
Vkadaba | 17:2f0028880874 | 233 | .sensor = ADMW1001_ADC_SENSOR_THERMOCOUPLE_K, |
Vkadaba | 17:2f0028880874 | 234 | |
Vkadaba | 17:2f0028880874 | 235 | .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN, |
Vkadaba | 17:2f0028880874 | 236 | |
Vkadaba | 17:2f0028880874 | 237 | .gain = 8, |
Vkadaba | 17:2f0028880874 | 238 | |
Vkadaba | 17:2f0028880874 | 239 | .current = { |
Vkadaba | 17:2f0028880874 | 240 | |
Vkadaba | 17:2f0028880874 | 241 | .excitationState= ADMW1001_ADC_EXC_STATE_CYCLE_POWER, |
Vkadaba | 17:2f0028880874 | 242 | |
Vkadaba | 17:2f0028880874 | 243 | .outputLevel = ADMW1001_ADC_EXC_CURRENT_EXTERNAL, |
Vkadaba | 17:2f0028880874 | 244 | |
Vkadaba | 17:2f0028880874 | 245 | .diodeRatio = 0, |
Vkadaba | 17:2f0028880874 | 246 | |
Vkadaba | 17:2f0028880874 | 247 | }, |
Vkadaba | 17:2f0028880874 | 248 | |
Vkadaba | 17:2f0028880874 | 249 | .filter = { |
Vkadaba | 17:2f0028880874 | 250 | |
Vkadaba | 17:2f0028880874 | 251 | .type = ADMW1001_ADC_FILTER_SINC3, |
Vkadaba | 17:2f0028880874 | 252 | |
Vkadaba | 17:2f0028880874 | 253 | .sf = ADMW1001_SF_8P24HZ, |
Vkadaba | 17:2f0028880874 | 254 | |
Vkadaba | 17:2f0028880874 | 255 | .chopMode = ADMW1001_CHOP_MD_SW, |
Vkadaba | 17:2f0028880874 | 256 | |
Vkadaba | 17:2f0028880874 | 257 | .notch1p2 = false, |
Vkadaba | 17:2f0028880874 | 258 | |
Vkadaba | 17:2f0028880874 | 259 | .groundSwitch = ADMW1001_ADC_GND_SW_OPEN |
Vkadaba | 17:2f0028880874 | 260 | |
Vkadaba | 17:2f0028880874 | 261 | }, |
Vkadaba | 17:2f0028880874 | 262 | |
Vkadaba | 17:2f0028880874 | 263 | .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL, |
Vkadaba | 17:2f0028880874 | 264 | |
Vkadaba | 17:2f0028880874 | 265 | }, |
Vkadaba | 17:2f0028880874 | 266 | |
Vkadaba | 17:2f0028880874 | 267 | }, |
Vkadaba | 17:2f0028880874 | 268 | |
Vkadaba | 17:2f0028880874 | 269 | }, |
Vkadaba | 17:2f0028880874 | 270 | |
Vkadaba | 17:2f0028880874 | 271 | }, |
Vkadaba | 17:2f0028880874 | 272 | |
Vkadaba | 17:2f0028880874 | 273 | }; |
Vkadaba | 17:2f0028880874 | 274 |