Code clean up and handling FIFO errors

Committer:
Vkadaba
Date:
Tue Dec 10 09:00:11 2019 +0000
Revision:
42:c9c5a22e539e
Parent:
37:6acfbb4405cd
Child:
43:e1789b7214cf
Printing correct firmware version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vkadaba 27:4c8d8ee6fcbd 1 /*
Vkadaba 27:4c8d8ee6fcbd 2 Copyright 2019 (c) Analog Devices, Inc.
Vkadaba 27:4c8d8ee6fcbd 3
Vkadaba 27:4c8d8ee6fcbd 4 All rights reserved.
Vkadaba 27:4c8d8ee6fcbd 5
Vkadaba 27:4c8d8ee6fcbd 6 Redistribution and use in source and binary forms, with or without
Vkadaba 27:4c8d8ee6fcbd 7 modification, are permitted provided that the following conditions are met:
Vkadaba 27:4c8d8ee6fcbd 8 - Redistributions of source code must retain the above copyright
Vkadaba 27:4c8d8ee6fcbd 9 notice, this list of conditions and the following disclaimer.
Vkadaba 27:4c8d8ee6fcbd 10 - Redistributions in binary form must reproduce the above copyright
Vkadaba 27:4c8d8ee6fcbd 11 notice, this list of conditions and the following disclaimer in
Vkadaba 27:4c8d8ee6fcbd 12 the documentation and/or other materials provided with the
Vkadaba 27:4c8d8ee6fcbd 13 distribution.
Vkadaba 27:4c8d8ee6fcbd 14 - Neither the name of Analog Devices, Inc. nor the names of its
Vkadaba 27:4c8d8ee6fcbd 15 contributors may be used to endorse or promote products derived
Vkadaba 27:4c8d8ee6fcbd 16 from this software without specific prior written permission.
Vkadaba 27:4c8d8ee6fcbd 17 - The use of this software may or may not infringe the patent rights
Vkadaba 27:4c8d8ee6fcbd 18 of one or more patent holders. This license does not release you
Vkadaba 27:4c8d8ee6fcbd 19 from the requirement that you obtain separate licenses from these
Vkadaba 27:4c8d8ee6fcbd 20 patent holders to use this software.
Vkadaba 27:4c8d8ee6fcbd 21 - Use of the software either in source or binary form, must be run
Vkadaba 27:4c8d8ee6fcbd 22 on or directly connected to an Analog Devices Inc. component.
Vkadaba 27:4c8d8ee6fcbd 23
Vkadaba 27:4c8d8ee6fcbd 24 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
Vkadaba 27:4c8d8ee6fcbd 25 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Vkadaba 27:4c8d8ee6fcbd 26 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Vkadaba 27:4c8d8ee6fcbd 27 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
Vkadaba 27:4c8d8ee6fcbd 28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Vkadaba 27:4c8d8ee6fcbd 29 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
Vkadaba 27:4c8d8ee6fcbd 30 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Vkadaba 27:4c8d8ee6fcbd 31 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Vkadaba 27:4c8d8ee6fcbd 32 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Vkadaba 27:4c8d8ee6fcbd 33 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Vkadaba 27:4c8d8ee6fcbd 34 *
Vkadaba 27:4c8d8ee6fcbd 35 *****************************************************************************/
Vkadaba 27:4c8d8ee6fcbd 36
Vkadaba 27:4c8d8ee6fcbd 37 /*!
Vkadaba 27:4c8d8ee6fcbd 38 ******************************************************************************
Vkadaba 27:4c8d8ee6fcbd 39 * @file:
Vkadaba 27:4c8d8ee6fcbd 40 * @brief:
Vkadaba 27:4c8d8ee6fcbd 41 *-----------------------------------------------------------------------------
Vkadaba 27:4c8d8ee6fcbd 42 */
Vkadaba 27:4c8d8ee6fcbd 43 #include "admw_config_types.h"
Vkadaba 27:4c8d8ee6fcbd 44
Vkadaba 27:4c8d8ee6fcbd 45 ADMW_CONFIG rtd_4w_config = {
Vkadaba 37:6acfbb4405cd 46 .versionId = { .major = 2, .minor = 0 },
Vkadaba 27:4c8d8ee6fcbd 47 .productId = ADMW_PRODUCT_ID_ADMW1001,
Vkadaba 27:4c8d8ee6fcbd 48 .admw1001 = {
Vkadaba 27:4c8d8ee6fcbd 49 .power = {
Vkadaba 27:4c8d8ee6fcbd 50 .powerMode = ADMW1001_POWER_MODE_ACTIVE,
Vkadaba 27:4c8d8ee6fcbd 51 },
Vkadaba 27:4c8d8ee6fcbd 52 .measurement = {
Vkadaba 37:6acfbb4405cd 53 .externalRefVoltage = 0.0,
Vkadaba 42:c9c5a22e539e 54 .operatingMode = ADMW1001_OPERATING_MODE_SINGLECYCLE,
Vkadaba 27:4c8d8ee6fcbd 55 .dataReadyMode = ADMW1001_DATAREADY_PER_CYCLE, // FIX: Temporarily all values from json are hardcoded to this one in the Contracts.FileGenerator - > file translations!!
Vkadaba 27:4c8d8ee6fcbd 56 .cycleInterval = 0,
Vkadaba 37:6acfbb4405cd 57 .RSenseValue = 1000.0,
Vkadaba 27:4c8d8ee6fcbd 58 },
Vkadaba 27:4c8d8ee6fcbd 59 .diagnostics = {
Vkadaba 27:4c8d8ee6fcbd 60 .disableGlobalDiag = true,
Vkadaba 27:4c8d8ee6fcbd 61 .disableMeasurementDiag = true,
Vkadaba 27:4c8d8ee6fcbd 62 .osdFrequency = ADMW1001_OPEN_SENSOR_DIAGNOSTICS_DISABLED,
Vkadaba 27:4c8d8ee6fcbd 63 },
Vkadaba 27:4c8d8ee6fcbd 64 .channels = {
Vkadaba 27:4c8d8ee6fcbd 65 [ADMW1001_CH_ID_ANLG_1_UNIVERSAL] = {
Vkadaba 27:4c8d8ee6fcbd 66 .enableChannel = true,
Vkadaba 27:4c8d8ee6fcbd 67 .disablePublishing = false,
Vkadaba 27:4c8d8ee6fcbd 68 .compensationChannel = ADMW1001_CH_ID_NONE,
Vkadaba 27:4c8d8ee6fcbd 69 .lutSelect = ADMW1001_LUT_DEFAULT,
Vkadaba 27:4c8d8ee6fcbd 70 .measurementUnit = ADMW1001_MEASUREMENT_UNIT_CELSIUS,
Vkadaba 27:4c8d8ee6fcbd 71 .lowThreshold = -50,
Vkadaba 27:4c8d8ee6fcbd 72 .highThreshold = 250,
Vkadaba 27:4c8d8ee6fcbd 73 .offsetAdjustment = 0.0,
Vkadaba 27:4c8d8ee6fcbd 74 .gainAdjustment = 0.0,
Vkadaba 27:4c8d8ee6fcbd 75 .sensorParameter = 0.0,
Vkadaba 27:4c8d8ee6fcbd 76 .measurementsPerCycle = 1,
Vkadaba 27:4c8d8ee6fcbd 77 .cycleSkipCount = 0,
Vkadaba 27:4c8d8ee6fcbd 78 .extraSettlingTime = 4499.99986449257,
Vkadaba 27:4c8d8ee6fcbd 79 .priority = 0,
Vkadaba 27:4c8d8ee6fcbd 80 .adcChannelConfig = {
Vkadaba 27:4c8d8ee6fcbd 81 .sensor = ADMW1001_ADC_SENSOR_RTD_4WIRE_PT100,
Vkadaba 27:4c8d8ee6fcbd 82 .gain = ADMW1001_ADC_GAIN_1X,
Vkadaba 27:4c8d8ee6fcbd 83 .current = {
Vkadaba 27:4c8d8ee6fcbd 84 .excitationState= ADMW1001_ADC_EXC_STATE_ALWAYS_ON,
Vkadaba 27:4c8d8ee6fcbd 85 .outputLevel = ADMW1001_ADC_EXC_CURRENT_250uA,
Vkadaba 27:4c8d8ee6fcbd 86 .diodeRatio = 0,
Vkadaba 27:4c8d8ee6fcbd 87 },
Vkadaba 27:4c8d8ee6fcbd 88 .rtdCurve = ADMW1001_ADC_RTD_CURVE_EUROPEAN,
Vkadaba 27:4c8d8ee6fcbd 89 .filter = {
Vkadaba 27:4c8d8ee6fcbd 90 .type = ADMW1001_ADC_FILTER_SINC3,
Vkadaba 27:4c8d8ee6fcbd 91 .sf = ADMW1001_SF_8P24HZ,
Vkadaba 27:4c8d8ee6fcbd 92 .chopMode = ADMW1001_CHOP_MD_SW,
Vkadaba 27:4c8d8ee6fcbd 93 .notch1p2 = true,
Vkadaba 27:4c8d8ee6fcbd 94 .groundSwitch = ADMW1001_ADC_GND_SW_OPEN
Vkadaba 27:4c8d8ee6fcbd 95 },
Vkadaba 27:4c8d8ee6fcbd 96 .reference = ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL,
Vkadaba 37:6acfbb4405cd 97 .bufferBypass = ADMW1001_BUFFER_BYPASSS_DISABLED,
Vkadaba 27:4c8d8ee6fcbd 98 },
Vkadaba 27:4c8d8ee6fcbd 99 },
Vkadaba 27:4c8d8ee6fcbd 100 },
Vkadaba 27:4c8d8ee6fcbd 101 },
Vkadaba 27:4c8d8ee6fcbd 102 };