Complete sensor demo.

Dependencies:   modem_ref_helper CRC X_NUCLEO_IKS01A1 DebouncedInterrupt

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers files.h Source File

files.h

00001 #ifndef _FILES_H_
00002 #define _FILES_H_
00003 
00004 #include "mbed.h"
00005 #include "revision.h"
00006 #include "alp_spec.h"
00007 #include "alp_helpers.h"
00008 #include "modem_ref.h"
00009 
00010 TYPEDEF_STRUCT_PACKED {
00011     uint8_t fid;
00012     uint32_t offset;
00013     uint32_t length;
00014 } touch_t;
00015 
00016 extern Queue<touch_t, 8> g_file_modified;
00017 
00018 // Types of reporting
00019 typedef enum 
00020 {
00021     REPORT_ALWAYS,
00022     REPORT_ON_DIFFERENCE,
00023     REPORT_ON_THRESHOLD,
00024 } report_type_t;
00025 
00026 // Sensor reporting configuration
00027 TYPEDEF_STRUCT_PACKED 
00028 {
00029     uint8_t  report_type;       // Type of report asked
00030     uint32_t read_period;       // Measure period (ms)
00031     uint32_t max_period;        // Maximum time between reports (s)
00032     uint32_t max_diff;          // Maximum difference allowed between two reported values
00033     int32_t  threshold_high;    // High threshold value triggering a report
00034     int32_t  threshold_low;     // Low threshold value triggering a report
00035 } sensor_config_t;
00036 
00037 #define FID_HOST_REV            65
00038 #define SIZE_HOST_REV           sizeof(revision_t)
00039 extern alp_file_header_t        h_rev;
00040 extern revision_t               f_rev;
00041 
00042 #define FID_ALARM               131
00043 #define SIZE_ALARM              sizeof(uint8_t)
00044 extern alp_file_header_t        h_alarm;
00045 extern uint8_t                  f_alarm;
00046 
00047 #define FILE_DECLARE_SENSOR_CONFIG(name) extern const alp_file_header_t h_sensor_config_##name;\
00048     extern sensor_config_t f_sensor_config_##name
00049 
00050 #define FILE_DECLARE_SENSOR_VALUE(name) extern const alp_file_header_t h_sensor_value_##name;\
00051     extern int32_t f_sensor_value_##name[]
00052 
00053 #define FID_SENSOR_CONFIG_MAG           132
00054 #define FID_SENSOR_CONFIG_ACC           133
00055 #define FID_SENSOR_CONFIG_GYR           134
00056 #define FID_SENSOR_CONFIG_PRE           135
00057 #define FID_SENSOR_CONFIG_HUM           136
00058 #define FID_SENSOR_CONFIG_TEM1          137
00059 #define FID_SENSOR_CONFIG_TEM2          138
00060 #define FID_SENSOR_CONFIG_LIGHT         139
00061 
00062 #define FID_SENSOR_VALUE_MAG            150
00063 #define FID_SENSOR_VALUE_ACC            151
00064 #define FID_SENSOR_VALUE_GYR            152
00065 #define FID_SENSOR_VALUE_PRE            153
00066 #define FID_SENSOR_VALUE_HUM            154
00067 #define FID_SENSOR_VALUE_TEM1           155
00068 #define FID_SENSOR_VALUE_TEM2           156
00069 #define FID_SENSOR_VALUE_LIGHT          157
00070 
00071 FILE_DECLARE_SENSOR_CONFIG(mag);
00072 FILE_DECLARE_SENSOR_CONFIG(acc);
00073 FILE_DECLARE_SENSOR_CONFIG(gyr);
00074 FILE_DECLARE_SENSOR_CONFIG(pre);
00075 FILE_DECLARE_SENSOR_CONFIG(hum);
00076 FILE_DECLARE_SENSOR_CONFIG(tem1);
00077 FILE_DECLARE_SENSOR_CONFIG(tem2);
00078 FILE_DECLARE_SENSOR_CONFIG(light);
00079 
00080 FILE_DECLARE_SENSOR_VALUE(mag);
00081 FILE_DECLARE_SENSOR_VALUE(acc);
00082 FILE_DECLARE_SENSOR_VALUE(gyr);
00083 FILE_DECLARE_SENSOR_VALUE(pre);
00084 FILE_DECLARE_SENSOR_VALUE(hum);
00085 FILE_DECLARE_SENSOR_VALUE(tem1);
00086 FILE_DECLARE_SENSOR_VALUE(tem2);
00087 FILE_DECLARE_SENSOR_VALUE(light);
00088 
00089 
00090 #endif // _FILE_H_