SDMP_IOT / Mbed OS AdiSense1000_SmartBabySeat

Fork of Babyseat_NewFirmware_copy_sean by Ross O'Halloran

Committer:
Ross_o_halloran
Date:
Fri Aug 24 10:46:38 2018 +0000
Revision:
36:7b89e52b48f6
Parent:
35:cc01f0766fc2

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ross_o_halloran 35:cc01f0766fc2 1 #include "adi_sense_1000_lut_data.h"
Ross_o_halloran 35:cc01f0766fc2 2 #include "adi_sense_1000_sensor_types.h"
Ross_o_halloran 35:cc01f0766fc2 3
Ross_o_halloran 35:cc01f0766fc2 4 /*
Ross_o_halloran 35:cc01f0766fc2 5 * The following example illustrates how individual tables can be declared, and
Ross_o_halloran 35:cc01f0766fc2 6 * later assembled into a complete LUT data structure using
Ross_o_halloran 35:cc01f0766fc2 7 * adi_sense_1000_AssembleLutData(). That LUT data structure can then be
Ross_o_halloran 35:cc01f0766fc2 8 * written to the ADI Sense 1000 device using adi_sense_1000_SetLutData().
Ross_o_halloran 35:cc01f0766fc2 9 */
Ross_o_halloran 35:cc01f0766fc2 10
Ross_o_halloran 35:cc01f0766fc2 11
Ross_o_halloran 35:cc01f0766fc2 12 /*
Ross_o_halloran 35:cc01f0766fc2 13 * The following table provide linearisation data for a 4-wire bridge sensor
Ross_o_halloran 35:cc01f0766fc2 14 * identified with the ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2
Ross_o_halloran 35:cc01f0766fc2 15 * sensor type. The Look-Up Table provided maps a range of input (X)
Ross_o_halloran 35:cc01f0766fc2 16 * values to a corresponding range of output (Y) values. In this example,
Ross_o_halloran 35:cc01f0766fc2 17 * the bridge sensor input in millivolts is effectively translated to volts.
Ross_o_halloran 35:cc01f0766fc2 18 */
Ross_o_halloran 35:cc01f0766fc2 19 ADI_SENSE_1000_LUT_DESCRIPTOR lc0 = {
Ross_o_halloran 35:cc01f0766fc2 20 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D,
Ross_o_halloran 35:cc01f0766fc2 21 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT,
Ross_o_halloran 35:cc01f0766fc2 22 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
Ross_o_halloran 35:cc01f0766fc2 23 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_1_DEF_L2,
Ross_o_halloran 35:cc01f0766fc2 24 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32,
Ross_o_halloran 35:cc01f0766fc2 25 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 26 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 27 };
Ross_o_halloran 35:cc01f0766fc2 28 ADI_SENSE_1000_LUT_1D_NES lc0Data = {
Ross_o_halloran 36:7b89e52b48f6 29 .nElements = 9,
Ross_o_halloran 35:cc01f0766fc2 30 .lut = {
Ross_o_halloran 35:cc01f0766fc2 31 -3300.0f, /* x(min) */
Ross_o_halloran 36:7b89e52b48f6 32 3.405f,
Ross_o_halloran 36:7b89e52b48f6 33 4.38f,
Ross_o_halloran 36:7b89e52b48f6 34 5.33f,
Ross_o_halloran 36:7b89e52b48f6 35 6.02f,
Ross_o_halloran 36:7b89e52b48f6 36 6.87f,
Ross_o_halloran 36:7b89e52b48f6 37 8.41f,
Ross_o_halloran 36:7b89e52b48f6 38 9.54f,
Ross_o_halloran 35:cc01f0766fc2 39 +3300.0f, /* x(max) */
Ross_o_halloran 36:7b89e52b48f6 40 -0.000001f, /* y(min) */
Ross_o_halloran 35:cc01f0766fc2 41 0.00f,
Ross_o_halloran 35:cc01f0766fc2 42 2.5f,
Ross_o_halloran 35:cc01f0766fc2 43 5.00f,
Ross_o_halloran 35:cc01f0766fc2 44 7.5f,
Ross_o_halloran 35:cc01f0766fc2 45 10.00f,
Ross_o_halloran 35:cc01f0766fc2 46 12.5,
Ross_o_halloran 35:cc01f0766fc2 47 15.00f,
Ross_o_halloran 35:cc01f0766fc2 48 +50.0f, /* y(max) */
Ross_o_halloran 35:cc01f0766fc2 49 },
Ross_o_halloran 35:cc01f0766fc2 50 };
Ross_o_halloran 35:cc01f0766fc2 51
Ross_o_halloran 35:cc01f0766fc2 52
Ross_o_halloran 35:cc01f0766fc2 53 ADI_SENSE_1000_LUT_DESCRIPTOR lc1 = {
Ross_o_halloran 35:cc01f0766fc2 54 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D,
Ross_o_halloran 35:cc01f0766fc2 55 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT,
Ross_o_halloran 35:cc01f0766fc2 56 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
Ross_o_halloran 35:cc01f0766fc2 57 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2,
Ross_o_halloran 35:cc01f0766fc2 58 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32,
Ross_o_halloran 35:cc01f0766fc2 59 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 60 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 61 };
Ross_o_halloran 35:cc01f0766fc2 62 ADI_SENSE_1000_LUT_1D_NES lc1Data = {
Ross_o_halloran 36:7b89e52b48f6 63 .nElements = 9,
Ross_o_halloran 35:cc01f0766fc2 64 .lut = {
Ross_o_halloran 35:cc01f0766fc2 65 -3300.0f, /* x(min) */
Ross_o_halloran 36:7b89e52b48f6 66 -3.91f,
Ross_o_halloran 36:7b89e52b48f6 67 -1.64f,
Ross_o_halloran 36:7b89e52b48f6 68 1.2f,
Ross_o_halloran 36:7b89e52b48f6 69 3.84f,
Ross_o_halloran 36:7b89e52b48f6 70 7.17f,
Ross_o_halloran 36:7b89e52b48f6 71 13.3f,
Ross_o_halloran 36:7b89e52b48f6 72 17.96f,
Ross_o_halloran 35:cc01f0766fc2 73 +3300.0f, /* x(max) */
Ross_o_halloran 36:7b89e52b48f6 74 -0.000001f, /* y(min) */
Ross_o_halloran 35:cc01f0766fc2 75 0.00f,
Ross_o_halloran 36:7b89e52b48f6 76 2.641f,
Ross_o_halloran 36:7b89e52b48f6 77 5.07f,
Ross_o_halloran 35:cc01f0766fc2 78 7.5f,
Ross_o_halloran 36:7b89e52b48f6 79 10.0f,
Ross_o_halloran 36:7b89e52b48f6 80 12.5f,
Ross_o_halloran 36:7b89e52b48f6 81 15.0f,
Ross_o_halloran 36:7b89e52b48f6 82 +50.0f,
Ross_o_halloran 35:cc01f0766fc2 83 },
Ross_o_halloran 35:cc01f0766fc2 84 };
Ross_o_halloran 35:cc01f0766fc2 85
Ross_o_halloran 35:cc01f0766fc2 86 ADI_SENSE_1000_LUT_DESCRIPTOR lc2 = {
Ross_o_halloran 35:cc01f0766fc2 87 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D,
Ross_o_halloran 35:cc01f0766fc2 88 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT,
Ross_o_halloran 35:cc01f0766fc2 89 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
Ross_o_halloran 35:cc01f0766fc2 90 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_3_DEF_L2,
Ross_o_halloran 35:cc01f0766fc2 91 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32,
Ross_o_halloran 35:cc01f0766fc2 92 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 93 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 94 };
Ross_o_halloran 35:cc01f0766fc2 95 ADI_SENSE_1000_LUT_1D_NES lc2Data = {
Ross_o_halloran 35:cc01f0766fc2 96 .nElements = 9,
Ross_o_halloran 35:cc01f0766fc2 97 .lut = {
Ross_o_halloran 35:cc01f0766fc2 98 -3300.0f, /* x(min) */
Ross_o_halloran 36:7b89e52b48f6 99 -1.08f,
Ross_o_halloran 36:7b89e52b48f6 100 1.24f,
Ross_o_halloran 36:7b89e52b48f6 101 3.39f,
Ross_o_halloran 36:7b89e52b48f6 102 5.95f,
Ross_o_halloran 36:7b89e52b48f6 103 8.38f,
Ross_o_halloran 36:7b89e52b48f6 104 11.08f,
Ross_o_halloran 36:7b89e52b48f6 105 14.79f,
Ross_o_halloran 35:cc01f0766fc2 106 +3300.0f, /* x(max) */
Ross_o_halloran 35:cc01f0766fc2 107 -0.000001f, /* y(min) */
Ross_o_halloran 35:cc01f0766fc2 108 0.00f,
Ross_o_halloran 36:7b89e52b48f6 109 2.641f,
Ross_o_halloran 36:7b89e52b48f6 110 5.07f,
Ross_o_halloran 35:cc01f0766fc2 111 7.5f,
Ross_o_halloran 35:cc01f0766fc2 112 10.0f,
Ross_o_halloran 35:cc01f0766fc2 113 12.5f,
Ross_o_halloran 35:cc01f0766fc2 114 15.0f,
Ross_o_halloran 35:cc01f0766fc2 115 +50.0f,
Ross_o_halloran 35:cc01f0766fc2 116 },
Ross_o_halloran 35:cc01f0766fc2 117 };
Ross_o_halloran 35:cc01f0766fc2 118
Ross_o_halloran 35:cc01f0766fc2 119 ADI_SENSE_1000_LUT_DESCRIPTOR lc3 = {
Ross_o_halloran 35:cc01f0766fc2 120 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D,
Ross_o_halloran 35:cc01f0766fc2 121 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT,
Ross_o_halloran 35:cc01f0766fc2 122 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
Ross_o_halloran 35:cc01f0766fc2 123 .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_4_DEF_L2,
Ross_o_halloran 35:cc01f0766fc2 124 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32,
Ross_o_halloran 35:cc01f0766fc2 125 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 126 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 35:cc01f0766fc2 127 };
Ross_o_halloran 35:cc01f0766fc2 128 ADI_SENSE_1000_LUT_1D_NES lc3Data = {
Ross_o_halloran 36:7b89e52b48f6 129 .nElements = 9,
Ross_o_halloran 35:cc01f0766fc2 130 .lut = {
Ross_o_halloran 36:7b89e52b48f6 131 -3300.0f, /* x(min) */
Ross_o_halloran 36:7b89e52b48f6 132 1.37f,
Ross_o_halloran 36:7b89e52b48f6 133 5.28f,
Ross_o_halloran 36:7b89e52b48f6 134 8.64f,
Ross_o_halloran 36:7b89e52b48f6 135 12.35f,
Ross_o_halloran 36:7b89e52b48f6 136 15.09f,
Ross_o_halloran 36:7b89e52b48f6 137 18.12f,
Ross_o_halloran 36:7b89e52b48f6 138 20.02f,
Ross_o_halloran 35:cc01f0766fc2 139 +3300.0f, /* x(max) */
Ross_o_halloran 36:7b89e52b48f6 140 -0.000001f, /* y(min) */
Ross_o_halloran 35:cc01f0766fc2 141 0.00f,
Ross_o_halloran 35:cc01f0766fc2 142 2.641f,
Ross_o_halloran 35:cc01f0766fc2 143 5.07f,
Ross_o_halloran 35:cc01f0766fc2 144 7.5f,
Ross_o_halloran 35:cc01f0766fc2 145 10.0f,
Ross_o_halloran 35:cc01f0766fc2 146 12.5f,
Ross_o_halloran 35:cc01f0766fc2 147 15.0f,
Ross_o_halloran 35:cc01f0766fc2 148 +50.0f,
Ross_o_halloran 36:7b89e52b48f6 149 },
Ross_o_halloran 36:7b89e52b48f6 150 };
Ross_o_halloran 36:7b89e52b48f6 151 ADI_SENSE_1000_LUT_DESCRIPTOR lc4 = {
Ross_o_halloran 36:7b89e52b48f6 152 .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D,
Ross_o_halloran 36:7b89e52b48f6 153 .equation = ADI_SENSE_1000_LUT_EQUATION_LUT,
Ross_o_halloran 36:7b89e52b48f6 154 .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
Ross_o_halloran 36:7b89e52b48f6 155 .sensor = ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_1_DEF_L2,
Ross_o_halloran 36:7b89e52b48f6 156 .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32,
Ross_o_halloran 36:7b89e52b48f6 157 .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 36:7b89e52b48f6 158 .crc16 = 0 /* Filled by adi_sense_1000_AssembleLutData() */
Ross_o_halloran 36:7b89e52b48f6 159 };
Ross_o_halloran 36:7b89e52b48f6 160 ADI_SENSE_1000_LUT_1D_NES lc4Data = {
Ross_o_halloran 36:7b89e52b48f6 161 .nElements = 7,
Ross_o_halloran 36:7b89e52b48f6 162 .lut = {
Ross_o_halloran 36:7b89e52b48f6 163 -3300.0f, /* y(min) */
Ross_o_halloran 36:7b89e52b48f6 164 500.0f,
Ross_o_halloran 36:7b89e52b48f6 165 1000.0f,
Ross_o_halloran 36:7b89e52b48f6 166 2000.0f,
Ross_o_halloran 36:7b89e52b48f6 167 3000.0f,
Ross_o_halloran 36:7b89e52b48f6 168 4000.0f,
Ross_o_halloran 36:7b89e52b48f6 169 +5000.0f, /* y (max) */
Ross_o_halloran 36:7b89e52b48f6 170 -3300.0f, /* x(min) */
Ross_o_halloran 36:7b89e52b48f6 171 1750.0f,
Ross_o_halloran 36:7b89e52b48f6 172 2250.0f,
Ross_o_halloran 36:7b89e52b48f6 173 2750.0f,
Ross_o_halloran 36:7b89e52b48f6 174 3050.0f,
Ross_o_halloran 36:7b89e52b48f6 175 3250.0f,
Ross_o_halloran 36:7b89e52b48f6 176 +3300.0f, /* x(max) */
Ross_o_halloran 35:cc01f0766fc2 177 },
Ross_o_halloran 35:cc01f0766fc2 178 };
Ross_o_halloran 35:cc01f0766fc2 179
Ross_o_halloran 35:cc01f0766fc2 180
Ross_o_halloran 35:cc01f0766fc2 181 /*
Ross_o_halloran 35:cc01f0766fc2 182 * The following variables can be passed as parameters to
Ross_o_halloran 35:cc01f0766fc2 183 * adi_sense_1000_AssembleLutData()
Ross_o_halloran 35:cc01f0766fc2 184 */
Ross_o_halloran 35:cc01f0766fc2 185 ADI_SENSE_1000_LUT_DESCRIPTOR *sample_lut_desc_list[] = {
Ross_o_halloran 35:cc01f0766fc2 186 &lc0,
Ross_o_halloran 36:7b89e52b48f6 187 &lc1,
Ross_o_halloran 35:cc01f0766fc2 188 &lc2,
Ross_o_halloran 36:7b89e52b48f6 189 &lc3,
Ross_o_halloran 36:7b89e52b48f6 190 &lc4,
Ross_o_halloran 35:cc01f0766fc2 191
Ross_o_halloran 35:cc01f0766fc2 192 };
Ross_o_halloran 35:cc01f0766fc2 193
Ross_o_halloran 35:cc01f0766fc2 194 ADI_SENSE_1000_LUT_TABLE_DATA *sample_lut_data_list[] = {
Ross_o_halloran 35:cc01f0766fc2 195 (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc0Data,
Ross_o_halloran 36:7b89e52b48f6 196 (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc1Data,
Ross_o_halloran 35:cc01f0766fc2 197 (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc2Data,
Ross_o_halloran 36:7b89e52b48f6 198 (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc3Data,
Ross_o_halloran 36:7b89e52b48f6 199 (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc4Data,
Ross_o_halloran 35:cc01f0766fc2 200 };
Ross_o_halloran 35:cc01f0766fc2 201
Ross_o_halloran 35:cc01f0766fc2 202 unsigned sample_lut_num_tables =
Ross_o_halloran 35:cc01f0766fc2 203 (sizeof(sample_lut_desc_list) / sizeof(sample_lut_desc_list[0]));
Ross_o_halloran 35:cc01f0766fc2 204