Temperature (cjc0, sensor0) Humidity I2C_0 Accelerometer SPI_0

Fork of ADISense1000_Example_FW by Analog Devices

Committer:
nfathurr
Date:
Fri Aug 24 09:01:59 2018 +0000
Revision:
1:982f6f565e14
Parent:
0:76fed7dd9235
Prosiwft with Temperature, Humidity, and Accelerometer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nfathurr 1:982f6f565e14 1 /*!
nfathurr 1:982f6f565e14 2 ******************************************************************************
nfathurr 1:982f6f565e14 3 * @file: config.c
nfathurr 1:982f6f565e14 4 * @brief:
nfathurr 1:982f6f565e14 5 *-----------------------------------------------------------------------------
nfathurr 1:982f6f565e14 6 *
nfathurr 1:982f6f565e14 7 Copyright (c) 2018 Analog Devices, Inc.
nfathurr 1:982f6f565e14 8
nfathurr 1:982f6f565e14 9 All rights reserved.
nfathurr 1:982f6f565e14 10
nfathurr 1:982f6f565e14 11 Redistribution and use in source and binary forms, with or without modification,
nfathurr 1:982f6f565e14 12 are permitted provided that the following conditions are met:
nfathurr 1:982f6f565e14 13 - Redistributions of source code must retain the above copyright notice,
nfathurr 1:982f6f565e14 14 this list of conditions and the following disclaimer.
nfathurr 1:982f6f565e14 15 - Redistributions in binary form must reproduce the above copyright notice,
nfathurr 1:982f6f565e14 16 this list of conditions and the following disclaimer in the documentation
nfathurr 1:982f6f565e14 17 and/or other materials provided with the distribution.
nfathurr 1:982f6f565e14 18 - Modified versions of the software must be conspicuously marked as such.
nfathurr 1:982f6f565e14 19 - This software is licensed solely and exclusively for use with processors
nfathurr 1:982f6f565e14 20 manufactured by or for Analog Devices, Inc.
nfathurr 1:982f6f565e14 21 - This software may not be combined or merged with other code in any manner
nfathurr 1:982f6f565e14 22 that would cause the software to become subject to terms and conditions
nfathurr 1:982f6f565e14 23 which differ from those listed here.
nfathurr 1:982f6f565e14 24 - Neither the name of Analog Devices, Inc. nor the names of its
nfathurr 1:982f6f565e14 25 contributors may be used to endorse or promote products derived
nfathurr 1:982f6f565e14 26 from this software without specific prior written permission.
nfathurr 1:982f6f565e14 27 - The use of this software may or may not infringe the patent rights of one
nfathurr 1:982f6f565e14 28 or more patent holders. This license does not release you from the
nfathurr 1:982f6f565e14 29 requirement that you obtain separate licenses from these patent holders
nfathurr 1:982f6f565e14 30 to use this software.
nfathurr 1:982f6f565e14 31
nfathurr 1:982f6f565e14 32 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY
nfathurr 1:982f6f565e14 33 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
nfathurr 1:982f6f565e14 34 TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
nfathurr 1:982f6f565e14 35 NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
nfathurr 1:982f6f565e14 36 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES
nfathurr 1:982f6f565e14 37 (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL
nfathurr 1:982f6f565e14 38 PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
nfathurr 1:982f6f565e14 39 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
nfathurr 1:982f6f565e14 40 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
nfathurr 1:982f6f565e14 41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
nfathurr 1:982f6f565e14 42 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nfathurr 1:982f6f565e14 43 *
nfathurr 1:982f6f565e14 44 *****************************************************************************/
nfathurr 1:982f6f565e14 45
nfathurr 1:982f6f565e14 46 #include "inc/adi_sense_config_types.h"
seanwilson10 0:76fed7dd9235 47
nfathurr 1:982f6f565e14 48 ADI_SENSE_CONFIG config = {
nfathurr 1:982f6f565e14 49 .versionId = { .major = 1, .minor = 4 },
nfathurr 1:982f6f565e14 50 .productId = ADI_SENSE_PRODUCT_ID_1000,
nfathurr 1:982f6f565e14 51 .adisense1000 = {
nfathurr 1:982f6f565e14 52 .power = {
nfathurr 1:982f6f565e14 53 .powerMode = ADI_SENSE_1000_POWER_MODE_FULL,
nfathurr 1:982f6f565e14 54 .supplyVoltage = 3.3,
nfathurr 1:982f6f565e14 55 },
nfathurr 1:982f6f565e14 56 .measurement = {
nfathurr 1:982f6f565e14 57 .operatingMode = ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS,
nfathurr 1:982f6f565e14 58 .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE,
nfathurr 1:982f6f565e14 59 .cycleInterval = 0,
nfathurr 1:982f6f565e14 60 },
nfathurr 1:982f6f565e14 61 .channels = {
nfathurr 1:982f6f565e14 62 //RTD PT100
nfathurr 1:982f6f565e14 63 [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = {
nfathurr 1:982f6f565e14 64 .enableChannel = true,
nfathurr 1:982f6f565e14 65 .disablePublishing = false,
nfathurr 1:982f6f565e14 66 .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
nfathurr 1:982f6f565e14 67 .measurementsPerCycle = 1,
nfathurr 1:982f6f565e14 68 .extraSettlingTime = 0.0000,
nfathurr 1:982f6f565e14 69 .measurementUnit = ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS,
nfathurr 1:982f6f565e14 70 .adcChannelConfig = {
nfathurr 1:982f6f565e14 71 .sensor = ADI_SENSE_1000_ADC_SENSOR_RTD_2WIRE_PT100_DEF_L1,
nfathurr 1:982f6f565e14 72 .gain = ADI_SENSE_1000_ADC_GAIN_32X,
nfathurr 1:982f6f565e14 73 .current = {
nfathurr 1:982f6f565e14 74 .outputLevel = ADI_SENSE_1000_ADC_EXC_CURRENT_500uA,
nfathurr 1:982f6f565e14 75 .swapOption = ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_NONE,
nfathurr 1:982f6f565e14 76 },
nfathurr 1:982f6f565e14 77 .filter = {
nfathurr 1:982f6f565e14 78 .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS,
nfathurr 1:982f6f565e14 79 .fs = 0,
nfathurr 1:982f6f565e14 80 //.type = ADI_SENSE_1000_ADC_FILTER_SINC4,
nfathurr 1:982f6f565e14 81 //.fs = 1920,
nfathurr 1:982f6f565e14 82 },
nfathurr 1:982f6f565e14 83 .reference = {
nfathurr 1:982f6f565e14 84 .type = ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_1,
nfathurr 1:982f6f565e14 85 .disableBuffer = false,
nfathurr 1:982f6f565e14 86 },
nfathurr 1:982f6f565e14 87 .enableVbias = false,
nfathurr 1:982f6f565e14 88 },
nfathurr 1:982f6f565e14 89 },
nfathurr 1:982f6f565e14 90 //THERMOCOUPLE
nfathurr 1:982f6f565e14 91 [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = {
nfathurr 1:982f6f565e14 92 .enableChannel = true,
nfathurr 1:982f6f565e14 93 .disablePublishing = false,
nfathurr 1:982f6f565e14 94 .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_CJC_0,
nfathurr 1:982f6f565e14 95 .measurementsPerCycle = 1,
nfathurr 1:982f6f565e14 96 .extraSettlingTime = 0.0000,
nfathurr 1:982f6f565e14 97 .measurementUnit = ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS,
nfathurr 1:982f6f565e14 98 .adcChannelConfig = {
nfathurr 1:982f6f565e14 99 .sensor = ADI_SENSE_1000_ADC_SENSOR_THERMOCOUPLE_K_DEF_L1,
nfathurr 1:982f6f565e14 100 .gain = ADI_SENSE_1000_ADC_GAIN_128X,
nfathurr 1:982f6f565e14 101 .current = {
nfathurr 1:982f6f565e14 102 .outputLevel = ADI_SENSE_1000_ADC_EXC_CURRENT_NONE,
nfathurr 1:982f6f565e14 103 .swapOption = ADI_SENSE_1000_ADC_EXC_CURRENT_SWAP_NONE,
nfathurr 1:982f6f565e14 104 },
nfathurr 1:982f6f565e14 105 .filter = {
nfathurr 1:982f6f565e14 106 //.type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS,
nfathurr 1:982f6f565e14 107 //.fs = 0,
nfathurr 1:982f6f565e14 108 .type = ADI_SENSE_1000_ADC_FILTER_SINC4,
nfathurr 1:982f6f565e14 109 .fs = 1920,
nfathurr 1:982f6f565e14 110 },
nfathurr 1:982f6f565e14 111 .reference = {
nfathurr 1:982f6f565e14 112 .type = ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL,
nfathurr 1:982f6f565e14 113 .disableBuffer = false,
nfathurr 1:982f6f565e14 114 },
nfathurr 1:982f6f565e14 115 .enableVbias = true,
nfathurr 1:982f6f565e14 116 },
nfathurr 1:982f6f565e14 117 },
nfathurr 1:982f6f565e14 118 //HUMIDITY SENSOR
nfathurr 1:982f6f565e14 119 [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = {
nfathurr 1:982f6f565e14 120 .enableChannel = true,
nfathurr 1:982f6f565e14 121 .disablePublishing = false,
nfathurr 1:982f6f565e14 122 .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
nfathurr 1:982f6f565e14 123 .measurementsPerCycle = 1,
nfathurr 1:982f6f565e14 124 .extraSettlingTime = 0.0000,
nfathurr 1:982f6f565e14 125 .i2cChannelConfig = {
nfathurr 1:982f6f565e14 126 .sensor = ADI_SENSE_1000_I2C_SENSOR_HUMIDITY_SENSIRION_SHT3X,
nfathurr 1:982f6f565e14 127 .deviceAddress = 0x44,
nfathurr 1:982f6f565e14 128 },
nfathurr 1:982f6f565e14 129 },
nfathurr 1:982f6f565e14 130 //ACCELEROMETER
nfathurr 1:982f6f565e14 131 [ADI_SENSE_1000_CHANNEL_ID_SPI_0] = { //X-Axis
nfathurr 1:982f6f565e14 132 .enableChannel = true,
nfathurr 1:982f6f565e14 133 .disablePublishing = false,
nfathurr 1:982f6f565e14 134 .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
nfathurr 1:982f6f565e14 135 .measurementsPerCycle = 1,
nfathurr 1:982f6f565e14 136 .extraSettlingTime = 1000,
nfathurr 1:982f6f565e14 137 .offsetAdjustment = +0.03,
nfathurr 1:982f6f565e14 138
nfathurr 1:982f6f565e14 139 .lowThreshold = -6.0,
nfathurr 1:982f6f565e14 140 .highThreshold = 6.0,
nfathurr 1:982f6f565e14 141 .spiChannelConfig = {
nfathurr 1:982f6f565e14 142 .sensor = ADI_SENSE_1000_SPI_SENSOR_ACCELEROMETER_ADI_ADXL362,
nfathurr 1:982f6f565e14 143 .configurationCommand = {
nfathurr 1:982f6f565e14 144 .command = { 0x0A, 0x2C, 0x03 },
nfathurr 1:982f6f565e14 145 .commandLength = 3,
nfathurr 1:982f6f565e14 146 },
nfathurr 1:982f6f565e14 147 },
nfathurr 1:982f6f565e14 148 },
nfathurr 1:982f6f565e14 149 [ADI_SENSE_1000_CHANNEL_ID_SPI_1] = { //Y-Axis
nfathurr 1:982f6f565e14 150 .enableChannel = true,
nfathurr 1:982f6f565e14 151 .offsetAdjustment = -0.014,
nfathurr 1:982f6f565e14 152
nfathurr 1:982f6f565e14 153 .lowThreshold = -6.0,
nfathurr 1:982f6f565e14 154 .highThreshold = 6.0,
nfathurr 1:982f6f565e14 155 },
nfathurr 1:982f6f565e14 156 [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = { //Z-Axis
nfathurr 1:982f6f565e14 157
nfathurr 1:982f6f565e14 158 .enableChannel = true,
nfathurr 1:982f6f565e14 159
nfathurr 1:982f6f565e14 160 .offsetAdjustment = -0.23,
nfathurr 1:982f6f565e14 161 .lowThreshold = -6,
nfathurr 1:982f6f565e14 162 .highThreshold = 6,
nfathurr 1:982f6f565e14 163 },
nfathurr 1:982f6f565e14 164 },
nfathurr 1:982f6f565e14 165 },
nfathurr 1:982f6f565e14 166 };
nfathurr 1:982f6f565e14 167