read and push

Dependencies:   X_NUCLEO_IKS01A1 MLX90614 d7a_1x wizzi-utils

Fork of D7A_1x_demo_sensors_OS5 by WizziLab

Revision:
7:8de29807f970
Parent:
0:7e1fdc4d6e1c
Child:
8:01f0225408cf
--- a/files.h	Thu Feb 02 15:36:51 2017 +0000
+++ b/files.h	Thu Feb 02 17:30:47 2017 +0000
@@ -3,8 +3,6 @@
 
 #include "mbed.h"
 #include "d7a.h"
-#include "sensors.h"
-
 
 enum {
     ALARM_FILE_ID = 224,
@@ -26,7 +24,6 @@
     TEM2_VALUE_FILE_ID, // 253
 };
 
-
 #define GENERIC_FILE(name,data)         TYPEDEF_STRUCT_PACKED{\
                                             data\
                                         } name##_t;\
@@ -38,13 +35,30 @@
                                         
 #define GENERIC_FILE_MAP(fid,name)      { (void*)fid, (void*)&f_##name }
 
+// Types of reporting
+typedef enum 
+{
+    REPORT_ALWAYS,
+    REPORT_ON_DIFFERENCE,
+    REPORT_ON_THRESHOLD,
+    
+} report_type_t;
 
+// Sensor reporting configuration
+TYPEDEF_STRUCT_PACKED 
+{
+    uint8_t  report_type;       // Type of report asked
+    uint32_t period;            // Measure period (ms)
+    uint32_t max_period;        // Maximum time between reports (s)
+    uint32_t max_diff;          // Maximum difference allowed between two reported values
+    int32_t  threshold_high;    // High threshold value triggering a report
+    int32_t  threshold_low;     // Low threshold value triggering a report
+    
+} sensor_config_t;
 
 // Firmware revision for the Dash7board
 GENERIC_FILE(dev_rev, d7a_revision_t rev;);
-
 GENERIC_FILE(simul, uint32_t divider;);
-
 GENERIC_FILE(mag_cfg, sensor_config_t cfg;);
 GENERIC_FILE(acc_cfg, sensor_config_t cfg;);
 GENERIC_FILE(gyr_cfg, sensor_config_t cfg;);