PoC_Team
/
ADMW1001_example_firmware
Host API Example for the ADMW1001
config.c@23:bb685f35b08b, 2019-09-26 (annotated)
- Committer:
- Vkadaba
- Date:
- Thu Sep 26 06:15:39 2019 +0000
- Revision:
- 23:bb685f35b08b
- Parent:
- 19:09d58952b65d
Fixing code alignment
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 | 23:bb685f35b08b | 103 | .power = { |
Vkadaba | 17:2f0028880874 | 104 | |
Vkadaba | 23:bb685f35b08b | 105 | .powerMode = ADMW1001_POWER_MODE_ACTIVE, |
Vkadaba | 17:2f0028880874 | 106 | |
Vkadaba | 23:bb685f35b08b | 107 | }, |
Vkadaba | 17:2f0028880874 | 108 | |
Vkadaba | 23:bb685f35b08b | 109 | .measurement = { |
Vkadaba | 17:2f0028880874 | 110 | |
Vkadaba | 23:bb685f35b08b | 111 | .operatingMode = ADMW1001_OPERATING_MODE_CONTINUOUS, |
Vkadaba | 17:2f0028880874 | 112 | |
Vkadaba | 23:bb685f35b08b | 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 | 23:bb685f35b08b | 115 | .cycleInterval = 0, |
Vkadaba | 17:2f0028880874 | 116 | |
Vkadaba | 23:bb685f35b08b | 117 | .vBiasEnable = true, |
Vkadaba | 17:2f0028880874 | 118 | |
Vkadaba | 23:bb685f35b08b | 119 | }, |
Vkadaba | 17:2f0028880874 | 120 | |
Vkadaba | 23:bb685f35b08b | 121 | .diagnostics = { |
Vkadaba | 17:2f0028880874 | 122 | |
Vkadaba | 23:bb685f35b08b | 123 | .disableGlobalDiag = true, |
Vkadaba | 17:2f0028880874 | 124 | |
Vkadaba | 23:bb685f35b08b | 125 | .disableMeasurementDiag = true, |
Vkadaba | 17:2f0028880874 | 126 | |
Vkadaba | 23:bb685f35b08b | 127 | .osdFrequency = ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED, |
Vkadaba | 17:2f0028880874 | 128 | |
Vkadaba | 23:bb685f35b08b | 129 | }, |
Vkadaba | 17:2f0028880874 | 130 | |
Vkadaba | 23:bb685f35b08b | 131 | .channels = { |
Vkadaba | 17:2f0028880874 | 132 | |
Vkadaba | 23:bb685f35b08b | 133 | [ADMW1001_CH_ID_ANLG_1_UNIVERSAL] = { |
Vkadaba | 17:2f0028880874 | 134 | |
Vkadaba | 23:bb685f35b08b | 135 | .enableChannel = true, |
Vkadaba | 17:2f0028880874 | 136 | |
Vkadaba | 23:bb685f35b08b | 137 | .disablePublishing = false, |
Vkadaba | 17:2f0028880874 | 138 | |
Vkadaba | 23:bb685f35b08b | 139 | .compensationChannel = ADMW1001_CH_ID_NONE, |
Vkadaba | 17:2f0028880874 | 140 | |
Vkadaba | 23:bb685f35b08b | 141 | .lutSelect = ADMW1001_LUT_DEFAULT, |
Vkadaba | 17:2f0028880874 | 142 | |
Vkadaba | 23:bb685f35b08b | 143 | .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS, |
Vkadaba | 17:2f0028880874 | 144 | |
Vkadaba | 23:bb685f35b08b | 145 | .lowThreshold = -50, |
Vkadaba | 17:2f0028880874 | 146 | |
Vkadaba | 23:bb685f35b08b | 147 | .highThreshold = 250, |
Vkadaba | 17:2f0028880874 | 148 | |
Vkadaba | 23:bb685f35b08b | 149 | .offsetAdjustment = 0.0, |
Vkadaba | 17:2f0028880874 | 150 | |
Vkadaba | 23:bb685f35b08b | 151 | .gainAdjustment = 0.0, |
Vkadaba | 17:2f0028880874 | 152 | |
Vkadaba | 23:bb685f35b08b | 153 | .sensorParameter = 0.0, |
Vkadaba | 17:2f0028880874 | 154 | |
Vkadaba | 23:bb685f35b08b | 155 | .measurementsPerCycle = 1, |
Vkadaba | 17:2f0028880874 | 156 | |
Vkadaba | 23:bb685f35b08b | 157 | .cycleSkipCount = 0, |
Vkadaba | 17:2f0028880874 | 158 | |
Vkadaba | 23:bb685f35b08b | 159 | .extraSettlingTime = 0, |
Vkadaba | 17:2f0028880874 | 160 | |
Vkadaba | 23:bb685f35b08b | 161 | .priority = 0, |
Vkadaba | 17:2f0028880874 | 162 | |
Vkadaba | 23:bb685f35b08b | 163 | .adcChannelConfig = { |
Vkadaba | 17:2f0028880874 | 164 | |
Vkadaba | 23:bb685f35b08b | 165 | .sensor = ADMW1001_ADC_SENSOR_RTD_2WIRE_PT100, |
Vkadaba | 17:2f0028880874 | 166 | |
Vkadaba | 23:bb685f35b08b | 167 | .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN, |
Vkadaba | 17:2f0028880874 | 168 | |
Vkadaba | 23:bb685f35b08b | 169 | .gain = ADMW1001_ADC_GAIN_2X, |
Vkadaba | 17:2f0028880874 | 170 | |
Vkadaba | 23:bb685f35b08b | 171 | .current = { |
Vkadaba | 17:2f0028880874 | 172 | |
Vkadaba | 23:bb685f35b08b | 173 | .excitationState= ADMW1001_ADC_EXC_STATE_ALWAYS_ON, |
Vkadaba | 17:2f0028880874 | 174 | |
Vkadaba | 23:bb685f35b08b | 175 | .outputLevel = ADMW1001_ADC_EXC_CURRENT_250uA, |
Vkadaba | 17:2f0028880874 | 176 | |
Vkadaba | 23:bb685f35b08b | 177 | .diodeRatio = 0, |
Vkadaba | 17:2f0028880874 | 178 | |
Vkadaba | 17:2f0028880874 | 179 | }, |
Vkadaba | 17:2f0028880874 | 180 | |
Vkadaba | 23:bb685f35b08b | 181 | .filter = { |
Vkadaba | 17:2f0028880874 | 182 | |
Vkadaba | 23:bb685f35b08b | 183 | .type = ADMW1001_ADC_FILTER_SINC3, |
Vkadaba | 17:2f0028880874 | 184 | |
Vkadaba | 23:bb685f35b08b | 185 | .sf = ADMW1001_SF_8P24HZ, |
Vkadaba | 17:2f0028880874 | 186 | |
Vkadaba | 23:bb685f35b08b | 187 | .chopMode = ADMW1001_CHOP_MD_SW, |
Vkadaba | 17:2f0028880874 | 188 | |
Vkadaba | 23:bb685f35b08b | 189 | .notch1p2 = false, |
Vkadaba | 17:2f0028880874 | 190 | |
Vkadaba | 23:bb685f35b08b | 191 | .groundSwitch = ADMW1001_ADC_GND_SW_OPEN |
Vkadaba | 17:2f0028880874 | 192 | |
Vkadaba | 17:2f0028880874 | 193 | }, |
Vkadaba | 17:2f0028880874 | 194 | |
Vkadaba | 23:bb685f35b08b | 195 | .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL, |
Vkadaba | 23:bb685f35b08b | 196 | |
Vkadaba | 17:2f0028880874 | 197 | }, |
Vkadaba | 17:2f0028880874 | 198 | |
Vkadaba | 17:2f0028880874 | 199 | }, |
Vkadaba | 17:2f0028880874 | 200 | |
Vkadaba | 23:bb685f35b08b | 201 | [ADMW1001_CH_ID_ANLG_1_DIFFERENTIAL] = { |
Vkadaba | 23:bb685f35b08b | 202 | |
Vkadaba | 23:bb685f35b08b | 203 | .enableChannel = true, |
Vkadaba | 23:bb685f35b08b | 204 | |
Vkadaba | 23:bb685f35b08b | 205 | .disablePublishing = false, |
Vkadaba | 23:bb685f35b08b | 206 | |
Vkadaba | 23:bb685f35b08b | 207 | .compensationChannel = ADMW1001_CH_ID_ANLG_1_UNIVERSAL, |
Vkadaba | 23:bb685f35b08b | 208 | |
Vkadaba | 23:bb685f35b08b | 209 | .lutSelect = ADMW1001_LUT_DEFAULT, |
Vkadaba | 23:bb685f35b08b | 210 | |
Vkadaba | 23:bb685f35b08b | 211 | .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS, |
Vkadaba | 23:bb685f35b08b | 212 | |
Vkadaba | 23:bb685f35b08b | 213 | .lowThreshold = -50, |
Vkadaba | 23:bb685f35b08b | 214 | |
Vkadaba | 23:bb685f35b08b | 215 | .highThreshold = 250, |
Vkadaba | 23:bb685f35b08b | 216 | |
Vkadaba | 23:bb685f35b08b | 217 | .offsetAdjustment = 0.0, |
Vkadaba | 23:bb685f35b08b | 218 | |
Vkadaba | 23:bb685f35b08b | 219 | .gainAdjustment = 0.0, |
Vkadaba | 23:bb685f35b08b | 220 | |
Vkadaba | 23:bb685f35b08b | 221 | .sensorParameter = 0.0, |
Vkadaba | 23:bb685f35b08b | 222 | |
Vkadaba | 23:bb685f35b08b | 223 | .measurementsPerCycle = 1, |
Vkadaba | 23:bb685f35b08b | 224 | |
Vkadaba | 23:bb685f35b08b | 225 | .cycleSkipCount = 0, |
Vkadaba | 23:bb685f35b08b | 226 | |
Vkadaba | 23:bb685f35b08b | 227 | .extraSettlingTime = 4499.99986449257, |
Vkadaba | 23:bb685f35b08b | 228 | |
Vkadaba | 23:bb685f35b08b | 229 | .priority = 0, |
Vkadaba | 23:bb685f35b08b | 230 | |
Vkadaba | 23:bb685f35b08b | 231 | .adcChannelConfig = { |
Vkadaba | 23:bb685f35b08b | 232 | |
Vkadaba | 23:bb685f35b08b | 233 | .sensor = ADMW1001_ADC_SENSOR_THERMOCOUPLE_K, |
Vkadaba | 23:bb685f35b08b | 234 | |
Vkadaba | 23:bb685f35b08b | 235 | .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN, |
Vkadaba | 23:bb685f35b08b | 236 | |
Vkadaba | 23:bb685f35b08b | 237 | .gain = 8, |
Vkadaba | 23:bb685f35b08b | 238 | |
Vkadaba | 23:bb685f35b08b | 239 | .current = { |
Vkadaba | 23:bb685f35b08b | 240 | |
Vkadaba | 23:bb685f35b08b | 241 | .excitationState= ADMW1001_ADC_EXC_STATE_CYCLE_POWER, |
Vkadaba | 23:bb685f35b08b | 242 | |
Vkadaba | 23:bb685f35b08b | 243 | .outputLevel = ADMW1001_ADC_EXC_CURRENT_EXTERNAL, |
Vkadaba | 23:bb685f35b08b | 244 | |
Vkadaba | 23:bb685f35b08b | 245 | .diodeRatio = 0, |
Vkadaba | 23:bb685f35b08b | 246 | |
Vkadaba | 23:bb685f35b08b | 247 | }, |
Vkadaba | 23:bb685f35b08b | 248 | |
Vkadaba | 23:bb685f35b08b | 249 | .filter = { |
Vkadaba | 23:bb685f35b08b | 250 | |
Vkadaba | 23:bb685f35b08b | 251 | .type = ADMW1001_ADC_FILTER_SINC3, |
Vkadaba | 23:bb685f35b08b | 252 | |
Vkadaba | 23:bb685f35b08b | 253 | .sf = ADMW1001_SF_8P24HZ, |
Vkadaba | 23:bb685f35b08b | 254 | |
Vkadaba | 23:bb685f35b08b | 255 | .chopMode = ADMW1001_CHOP_MD_SW, |
Vkadaba | 23:bb685f35b08b | 256 | |
Vkadaba | 23:bb685f35b08b | 257 | .notch1p2 = false, |
Vkadaba | 23:bb685f35b08b | 258 | |
Vkadaba | 23:bb685f35b08b | 259 | .groundSwitch = ADMW1001_ADC_GND_SW_OPEN |
Vkadaba | 23:bb685f35b08b | 260 | |
Vkadaba | 23:bb685f35b08b | 261 | }, |
Vkadaba | 23:bb685f35b08b | 262 | |
Vkadaba | 23:bb685f35b08b | 263 | .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL, |
Vkadaba | 23:bb685f35b08b | 264 | |
Vkadaba | 23:bb685f35b08b | 265 | }, |
Vkadaba | 23:bb685f35b08b | 266 | |
Vkadaba | 23:bb685f35b08b | 267 | }, |
Vkadaba | 23:bb685f35b08b | 268 | |
Vkadaba | 23:bb685f35b08b | 269 | }, |
Vkadaba | 23:bb685f35b08b | 270 | |
Vkadaba | 17:2f0028880874 | 271 | }, |
Vkadaba | 17:2f0028880874 | 272 | |
Vkadaba | 17:2f0028880874 | 273 | }; |
Vkadaba | 17:2f0028880874 | 274 |