Host API Example for the ADMW1001

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.c Source File

config.c

Go to the documentation of this file.
00001 /*!
00002 
00003  ******************************************************************************
00004 
00005  * @file:   config.c
00006 
00007  * @brief:
00008 
00009  *-----------------------------------------------------------------------------
00010 
00011  *
00012 
00013 Copyright (c) 2019 Analog Devices, Inc.
00014 
00015 
00016 
00017 All rights reserved.
00018 
00019 
00020 
00021 Redistribution and use in source and binary forms, with or without modification,
00022 
00023 are permitted provided that the following conditions are met:
00024 
00025   - Redistributions of source code must retain the above copyright notice,
00026 
00027     this list of conditions and the following disclaimer.
00028 
00029   - Redistributions in binary form must reproduce the above copyright notice,
00030 
00031     this list of conditions and the following disclaimer in the documentation
00032 
00033     and/or other materials provided with the distribution.
00034 
00035   - Modified versions of the software must be conspicuously marked as such.
00036 
00037   - This software is licensed solely and exclusively for use with processors
00038 
00039     manufactured by or for Analog Devices, Inc.
00040 
00041   - This software may not be combined or merged with other code in any manner
00042 
00043     that would cause the software to become subject to terms and conditions
00044 
00045     which differ from those listed here.
00046 
00047   - Neither the name of Analog Devices, Inc. nor the names of its
00048 
00049     contributors may be used to endorse or promote products derived
00050 
00051     from this software without specific prior written permission.
00052 
00053   - The use of this software may or may not infringe the patent rights of one
00054 
00055     or more patent holders.  This license does not release you from the
00056 
00057     requirement that you obtain separate licenses from these patent holders
00058 
00059     to use this software.
00060 
00061 
00062 
00063 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY
00064 
00065 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
00066 
00067 TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
00068 
00069 NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00070 
00071 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES
00072 
00073 (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL
00074 
00075 PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00076 
00077 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00078 
00079 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00080 
00081 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00082 
00083 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00084 
00085  *
00086 
00087  *****************************************************************************/
00088 
00089 
00090 
00091 #include "inc/admw_config_types.h"
00092 
00093 
00094 
00095 ADMW_CONFIG  config= {
00096 
00097     .versionId  = { .major  = 2, .minor = 0 },
00098 
00099     .productId = ADMW_PRODUCT_ID_ADMW1001 ,
00100 
00101     .admw1001 = {
00102 
00103         .power = {
00104 
00105             .powerMode = ADMW1001_POWER_MODE_ACTIVE ,
00106 
00107         },
00108 
00109         .measurement = {
00110 
00111             .operatingMode = ADMW1001_OPERATING_MODE_CONTINUOUS ,
00112 
00113             .dataReadyMode = ADMW1001_DATAREADY_PER_CYCLE , // FIX: Temporarily all values from json are hardcoded to this one in the Contracts.FileGenerator - > file translations!!
00114 
00115             .cycleInterval = 0,
00116 
00117             .vBiasEnable = true,
00118 
00119         },
00120 
00121         .diagnostics = {
00122 
00123             .disableGlobalDiag = true,
00124 
00125             .disableMeasurementDiag = true,
00126 
00127             .osdFrequency = ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED ,
00128 
00129         },
00130 
00131         .channels = {
00132 
00133             [ADMW1001_CH_ID_ANLG_1_UNIVERSAL ] = {
00134 
00135                 .enableChannel = true,
00136 
00137                 .disablePublishing = false,
00138 
00139                 .compensationChannel = ADMW1001_CH_ID_NONE ,
00140 
00141                 .lutSelect = ADMW1001_LUT_DEFAULT ,
00142 
00143                 .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS ,
00144 
00145                 .lowThreshold = -50,
00146 
00147                 .highThreshold = 250,
00148 
00149                 .offsetAdjustment = 0.0,
00150 
00151                 .gainAdjustment = 0.0,
00152 
00153                 .sensorParameter = 0.0,
00154 
00155                 .measurementsPerCycle = 1,
00156 
00157                 .cycleSkipCount = 0,
00158 
00159                 .extraSettlingTime = 0,
00160 
00161                 .priority = 0,
00162 
00163                 .adcChannelConfig = {
00164 
00165                     .sensor = ADMW1001_ADC_SENSOR_RTD_2WIRE_PT100 ,
00166 
00167                     .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN ,
00168 
00169                     .gain = ADMW1001_ADC_GAIN_2X ,
00170 
00171                     .current = {
00172 
00173                         .excitationState= ADMW1001_ADC_EXC_STATE_ALWAYS_ON ,
00174 
00175                         .outputLevel = ADMW1001_ADC_EXC_CURRENT_250uA ,
00176 
00177                         .diodeRatio = 0,
00178 
00179                     },
00180 
00181                     .filter = {
00182 
00183                         .type = ADMW1001_ADC_FILTER_SINC3 ,
00184 
00185                         .sf = ADMW1001_SF_8P24HZ ,
00186 
00187                         .chopMode = ADMW1001_CHOP_MD_SW ,
00188 
00189                         .notch1p2 = false,
00190 
00191                         .groundSwitch = ADMW1001_ADC_GND_SW_OPEN 
00192 
00193                     },
00194 
00195                     .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL ,
00196 
00197                 },
00198 
00199             },
00200 
00201             [ADMW1001_CH_ID_ANLG_1_DIFFERENTIAL ] = {
00202 
00203                 .enableChannel = true,
00204 
00205                 .disablePublishing = false,
00206 
00207                 .compensationChannel = ADMW1001_CH_ID_ANLG_1_UNIVERSAL ,
00208 
00209                 .lutSelect = ADMW1001_LUT_DEFAULT ,
00210 
00211                 .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS ,
00212 
00213                 .lowThreshold = -50,
00214 
00215                 .highThreshold = 250,
00216 
00217                 .offsetAdjustment = 0.0,
00218 
00219                 .gainAdjustment = 0.0,
00220 
00221                 .sensorParameter = 0.0,
00222 
00223                 .measurementsPerCycle = 1,
00224 
00225                 .cycleSkipCount = 0,
00226 
00227                 .extraSettlingTime = 4499.99986449257,
00228 
00229                 .priority = 0,
00230 
00231                 .adcChannelConfig = {
00232 
00233                     .sensor = ADMW1001_ADC_SENSOR_THERMOCOUPLE_K ,
00234 
00235                     .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN ,
00236 
00237                     .gain = 8,
00238 
00239                     .current = {
00240 
00241                         .excitationState= ADMW1001_ADC_EXC_STATE_CYCLE_POWER ,
00242 
00243                         .outputLevel = ADMW1001_ADC_EXC_CURRENT_EXTERNAL ,
00244 
00245                         .diodeRatio = 0,
00246 
00247                     },
00248 
00249                     .filter = {
00250 
00251                         .type = ADMW1001_ADC_FILTER_SINC3 ,
00252 
00253                         .sf = ADMW1001_SF_8P24HZ ,
00254 
00255                         .chopMode = ADMW1001_CHOP_MD_SW ,
00256 
00257                         .notch1p2 = false,
00258 
00259                         .groundSwitch = ADMW1001_ADC_GND_SW_OPEN 
00260 
00261                     },
00262 
00263                     .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL ,
00264 
00265                 },
00266 
00267             },
00268 
00269         },
00270 
00271     },
00272 
00273 };
00274