SDMP_IOT / Mbed OS AdiSense1000_SmartBabySeat

Fork of Babyseat_NewFirmware_copy_sean by Ross O'Halloran

Files at this revision

API Documentation at this revision

Comitter:
Ross_o_halloran
Date:
Fri Aug 24 10:46:38 2018 +0000
Parent:
35:cc01f0766fc2
Commit message:

Changed in this revision

babyseat_conf.c Show annotated file Show diff for this revision Revisions of this file
load_cell_lut_data.c Show annotated file Show diff for this revision Revisions of this file
--- a/babyseat_conf.c	Fri Aug 17 15:46:16 2018 +0000
+++ b/babyseat_conf.c	Fri Aug 24 10:46:38 2018 +0000
@@ -52,10 +52,30 @@
         .measurement = {
             .operatingMode = ADI_SENSE_1000_OPERATING_MODE_CONTINUOUS,
             .dataReadyMode = ADI_SENSE_1000_DATAREADY_PER_CYCLE,
-            .cycleInterval = 1000000,
+            .cycleInterval = 50000,
         },
         .channels = {
-             [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = {
+               [ADI_SENSE_1000_CHANNEL_ID_CJC_0] = {
+                .enableChannel = false,
+                .disablePublishing = false,
+                .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
+                .measurementUnit = ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS,
+                .measurementsPerCycle = 1,
+                .extraSettlingTime = 0,
+                .adcChannelConfig = {
+                    .sensor = ADI_SENSE_1000_ADC_SENSOR_THERMISTOR_B_10K_DEF_L1,
+                    .gain = ADI_SENSE_1000_ADC_GAIN_1X,
+                    .filter = {
+                        .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS,
+                    },
+                    .reference = {
+                        .type = ADI_SENSE_1000_ADC_REFERENCE_RESISTOR_INTERNAL_2,
+                        .disableBuffer = true,
+                    },
+                    .enableVbias = false,
+                },
+            },
+              [ADI_SENSE_1000_CHANNEL_ID_SENSOR_0] = {
                     .enableChannel = true,
                     .disablePublishing = false,
                     .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
@@ -73,26 +93,27 @@
                         },
                         .enableVbias = false,
                             },
+                }, 
+                [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = {
+                .enableChannel = false,
+                .disablePublishing = false,
+                .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
+                .measurementUnit = ADI_SENSE_1000_MEASUREMENT_UNIT_CELSIUS,
+                .measurementsPerCycle = 1,
+                .extraSettlingTime = 0,
+                .adcChannelConfig = {
+                    .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2,
+                    .gain = ADI_SENSE_1000_ADC_GAIN_1X,
+                    .filter = {
+                        .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS,
+                    },
+                    .reference = {
+                        .type = ADI_SENSE_1000_ADC_REFERENCE_BRIDGE_EXCITATION,
+                        .disableBuffer = true,
+                    },
+                    .enableVbias = false,
                 },
-                    [ADI_SENSE_1000_CHANNEL_ID_SENSOR_1] = {
-                        .enableChannel = false,
-                        .disablePublishing = false,
-                        .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
-                        .measurementsPerCycle = 1,
-                        .extraSettlingTime = 25000,
-                        .adcChannelConfig = {
-                            .sensor = ADI_SENSE_1000_ADC_SENSOR_BRIDGE_4WIRE_2_DEF_L2,
-                            .gain = ADI_SENSE_1000_ADC_GAIN_1X,
-                            .filter = {
-                                .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS,
-                            },
-                            .reference = {
-                                .type = ADI_SENSE_1000_ADC_REFERENCE_BRIDGE_EXCITATION,
-                                .disableBuffer = false,
-                            },
-                            .enableVbias = false,
-                                },
-                },
+            },
                 [ADI_SENSE_1000_CHANNEL_ID_SENSOR_2] = {
                             .enableChannel = false,
                             .disablePublishing = false,
@@ -130,7 +151,26 @@
                                 },
                                 .enableVbias = false,
                                 },
-            },
+            }, 
+               [ADI_SENSE_1000_CHANNEL_ID_VOLTAGE_0] = {
+                .enableChannel = false,
+                .disablePublishing = false,
+                .compensationChannel = ADI_SENSE_1000_CHANNEL_ID_NONE,
+                .measurementsPerCycle = 1,
+                .extraSettlingTime = 0,
+                .adcChannelConfig = {
+                    .sensor =  ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_1_DEF_L2,
+                    .gain = ADI_SENSE_1000_ADC_GAIN_1X,
+                    .filter = {
+                        .type = ADI_SENSE_1000_ADC_FILTER_FIR_25SPS,
+                    },
+                    .reference = {
+                        .type = ADI_SENSE_1000_ADC_REFERENCE_VOLTAGE_INTERNAL,
+                        .disableBuffer = true,
+                    },
+                    .enableVbias = false,
+                },
+            }, 
                 [ADI_SENSE_1000_CHANNEL_ID_I2C_0] = {
                 .enableChannel = false,
                 .disablePublishing = false,
@@ -150,8 +190,8 @@
                 .measurementsPerCycle = 1,
                 .extraSettlingTime = 10000,
                 /* Optional threshold limits applied to the processed measurement results */
-                .lowThreshold = -6.0,
-                .highThreshold = 6.0,
+                .lowThreshold = -60.0,
+                .highThreshold = 60.0,
                 .spiChannelConfig = {
                     .sensor = ADI_SENSE_1000_SPI_SENSOR_ACCELEROMETER_A_DEF_L1,
                 },
@@ -160,8 +200,8 @@
                 /* Accelerometer Y-Axis (virtual channel) */
                 .enableChannel = false,
                 /* Optional threshold limits applied to the processed measurement results */
-                .lowThreshold = -6.0,
-                .highThreshold = 6.0,
+                .lowThreshold = -60.0,
+                .highThreshold = 60.0,
             },
             [ADI_SENSE_1000_CHANNEL_ID_SPI_2] = {
                 /* Accelerometer Z-Axis (virtual channel) */
@@ -169,8 +209,8 @@
                 /* Optional adjustment applied to the processed measurement result */
                 .offsetAdjustment = -0.2,
                 /* Optional threshold limits applied to the processed measurement results */
-                .lowThreshold = -1.5,
-                .highThreshold = 1.5,
+                .lowThreshold = -10.5,
+                .highThreshold = 10.5,
                               },
                          },
                     },
--- a/load_cell_lut_data.c	Fri Aug 17 15:46:16 2018 +0000
+++ b/load_cell_lut_data.c	Fri Aug 24 10:46:38 2018 +0000
@@ -26,18 +26,18 @@
     .crc16 = 0   /* Filled by adi_sense_1000_AssembleLutData() */
 };
 ADI_SENSE_1000_LUT_1D_NES lc0Data = {
-    .nElements = 9,
+   .nElements = 9,
     .lut = {
         -3300.0f, /* x(min) */
-        3.852f,
-        5.42f,
-        6.71f,
-        9.61f,
-        12.67f,
-        16.29f,
-        19.6f,
+        3.405f,
+        4.38f,
+        5.33f,
+        6.02f,
+        6.87f,
+        8.41f,
+        9.54f,
         +3300.0f, /* x(max) */
-       -0.0001f,    /* y(min) */
+       -0.000001f,    /* y(min) */
         0.00f,
         2.5f,
         5.00f,
@@ -60,26 +60,26 @@
     .crc16 = 0   /* Filled by adi_sense_1000_AssembleLutData() */
 };
 ADI_SENSE_1000_LUT_1D_NES lc1Data = {
-            .nElements = 9,
+      .nElements = 9,
     .lut = {
         -3300.0f, /* x(min) */
-        -4.45f,
-        -2.42f,
-        1.08f,
-        7.52f,
-        12.15f,
-        18.33f,
-        23.93f,
+        -3.91f,
+        -1.64f,
+        1.2f,
+        3.84f,
+        7.17f,
+        13.3f,
+        17.96f,
         +3300.0f, /* x(max) */
-       -0.0001f,    /* y(min) */
+     -0.000001f,    /* y(min) */
         0.00f,
-        2.5f,
-        5.00f,
+        2.641f,
+        5.07f,
         7.5f,
-        10.00f,
-        12.5,
-        15.00f,
-        +50.0f,    /* y(max) */
+        10.0f,
+        12.5f,
+        15.0f,
+        +50.0f, 
     },
 };
 
@@ -96,18 +96,18 @@
     .nElements = 9,
     .lut = {
         -3300.0f, /* x(min) */
-        0.097f,
-        2.03f,
-        4.45f,
-        6.95f,
-        9.49f,
-        14.02f,
-        18.73f,
+        -1.08f,
+        1.24f,
+        3.39f,
+        5.95f,
+        8.38f,
+        11.08f,
+        14.79f,
         +3300.0f, /* x(max) */
         -0.000001f,    /* y(min) */
         0.00f,
-        2.51f,
-        5.00f,
+        2.641f,
+        5.07f,
         7.5f,
         10.0f,
         12.5f,
@@ -126,18 +126,18 @@
     .crc16 = 0   /* Filled by adi_sense_1000_AssembleLutData() */
 };
 ADI_SENSE_1000_LUT_1D_NES lc3Data = {
-     .nElements = 9,
+      .nElements = 9,
     .lut = {
-       -3300.0f, /* x(min) */
-        3.129f,
-        5.75f,
-        9.43f,
-        13.31f,
-        17.18f,
-        21.04f,
-        24.77f,
+        -3300.0f, /* x(min) */
+        1.37f,
+        5.28f,
+        8.64f,
+        12.35f,
+        15.09f,
+        18.12f,
+        20.02f,
         +3300.0f, /* x(max) */
-        -0.000001f,    /* y(min) */
+          -0.000001f,    /* y(min) */
         0.00f,
         2.641f,
         5.07f,
@@ -146,7 +146,34 @@
         12.5f,
         15.0f,
         +50.0f, 
-
+    },
+};
+ ADI_SENSE_1000_LUT_DESCRIPTOR lc4 = {
+    .geometry = ADI_SENSE_1000_LUT_GEOMETRY_NES_1D,
+    .equation = ADI_SENSE_1000_LUT_EQUATION_LUT,
+    .dir = ADI_SENSE_1000_LUT_TC_DIRECTION_FORWARD,
+    .sensor = ADI_SENSE_1000_ADC_SENSOR_VOLTAGE_PRESSURE_1_DEF_L2,
+    .dataType = ADI_SENSE_1000_LUT_DATA_TYPE_FLOAT32,
+    .length = 0, /* Filled by adi_sense_1000_AssembleLutData() */
+    .crc16 = 0   /* Filled by adi_sense_1000_AssembleLutData() */
+};
+ADI_SENSE_1000_LUT_1D_NES lc4Data = {
+   .nElements = 7,
+    .lut = {
+         -3300.0f, /* y(min) */
+         500.0f,
+         1000.0f,
+         2000.0f,
+         3000.0f,
+         4000.0f,
+        +5000.0f, /* y (max) */
+          -3300.0f, /* x(min) */
+        1750.0f,
+        2250.0f,
+        2750.0f,
+        3050.0f,
+        3250.0f,
+        +3300.0f, /* x(max) */
     },
 };
 
@@ -157,17 +184,19 @@
  */
 ADI_SENSE_1000_LUT_DESCRIPTOR *sample_lut_desc_list[] = {
     &lc0,
-   /* &lc1,
+    &lc1,
     &lc2,
-    &lc3,   */
+    &lc3,   
+    &lc4, 
 
 };
 
 ADI_SENSE_1000_LUT_TABLE_DATA *sample_lut_data_list[] = {
     (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc0Data,
-   /* (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc1Data,
+    (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc1Data,
     (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc2Data,
-    (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc3Data, */
+    (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc3Data, 
+     (ADI_SENSE_1000_LUT_TABLE_DATA *) &lc4Data, 
 };
 
 unsigned sample_lut_num_tables =