Complete sensor demo.

Dependencies:   modem_ref_helper X_NUCLEO_IKS01A1 DebouncedInterrupt

Committer:
Jeej
Date:
Thu Oct 11 15:15:30 2018 +0000
Revision:
14:8fd5405f7ab2
Parent:
0:87c57e1b1e1c
Relaxed modem version check.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeej 0:87c57e1b1e1c 1 #ifndef _FILES_H_
Jeej 0:87c57e1b1e1c 2 #define _FILES_H_
Jeej 0:87c57e1b1e1c 3
Jeej 0:87c57e1b1e1c 4 #include "mbed.h"
Jeej 0:87c57e1b1e1c 5 #include "revision.h"
Jeej 0:87c57e1b1e1c 6 #include "alp_spec.h"
Jeej 0:87c57e1b1e1c 7 #include "alp_helpers.h"
Jeej 0:87c57e1b1e1c 8 #include "modem_ref.h"
Jeej 0:87c57e1b1e1c 9
Jeej 0:87c57e1b1e1c 10 // Types of reporting
Jeej 0:87c57e1b1e1c 11 typedef enum
Jeej 0:87c57e1b1e1c 12 {
Jeej 0:87c57e1b1e1c 13 REPORT_ALWAYS,
Jeej 0:87c57e1b1e1c 14 REPORT_ON_DIFFERENCE,
Jeej 0:87c57e1b1e1c 15 REPORT_ON_THRESHOLD,
Jeej 0:87c57e1b1e1c 16 } report_type_t;
Jeej 0:87c57e1b1e1c 17
Jeej 0:87c57e1b1e1c 18 // Sensor reporting configuration
Jeej 0:87c57e1b1e1c 19 TYPEDEF_STRUCT_PACKED
Jeej 0:87c57e1b1e1c 20 {
Jeej 0:87c57e1b1e1c 21 uint8_t report_type; // Type of report asked
Jeej 0:87c57e1b1e1c 22 uint32_t read_period; // Measure period (ms)
Jeej 0:87c57e1b1e1c 23 uint32_t max_period; // Maximum time between reports (s)
Jeej 0:87c57e1b1e1c 24 uint32_t max_diff; // Maximum difference allowed between two reported values
Jeej 0:87c57e1b1e1c 25 int32_t threshold_high; // High threshold value triggering a report
Jeej 0:87c57e1b1e1c 26 int32_t threshold_low; // Low threshold value triggering a report
Jeej 0:87c57e1b1e1c 27 } sensor_config_t;
Jeej 0:87c57e1b1e1c 28
Jeej 0:87c57e1b1e1c 29 #define FID_HOST_REV 65
Jeej 0:87c57e1b1e1c 30 #define SIZE_HOST_REV sizeof(revision_t)
Jeej 0:87c57e1b1e1c 31 extern alp_file_header_t h_rev;
Jeej 0:87c57e1b1e1c 32 extern revision_t f_rev;
Jeej 0:87c57e1b1e1c 33
Jeej 0:87c57e1b1e1c 34 #define FID_ALARM 131
Jeej 0:87c57e1b1e1c 35 #define SIZE_ALARM sizeof(uint8_t)
Jeej 0:87c57e1b1e1c 36 extern alp_file_header_t h_alarm;
Jeej 0:87c57e1b1e1c 37 extern uint8_t f_alarm;
Jeej 0:87c57e1b1e1c 38
Jeej 0:87c57e1b1e1c 39 #define FILE_DECLARE_SENSOR_CONFIG(name) extern const alp_file_header_t h_sensor_config_##name;\
Jeej 0:87c57e1b1e1c 40 extern sensor_config_t f_sensor_config_##name
Jeej 0:87c57e1b1e1c 41
Jeej 0:87c57e1b1e1c 42 #define FILE_DECLARE_SENSOR_VALUE(name) extern const alp_file_header_t h_sensor_value_##name
Jeej 0:87c57e1b1e1c 43
Jeej 0:87c57e1b1e1c 44 #define FID_SENSOR_CONFIG_MAG 132
Jeej 0:87c57e1b1e1c 45 #define FID_SENSOR_CONFIG_ACC 133
Jeej 0:87c57e1b1e1c 46 #define FID_SENSOR_CONFIG_GYR 134
Jeej 0:87c57e1b1e1c 47 #define FID_SENSOR_CONFIG_PRE 135
Jeej 0:87c57e1b1e1c 48 #define FID_SENSOR_CONFIG_HUM 136
Jeej 0:87c57e1b1e1c 49 #define FID_SENSOR_CONFIG_TEM1 137
Jeej 0:87c57e1b1e1c 50 #define FID_SENSOR_CONFIG_TEM2 138
Jeej 0:87c57e1b1e1c 51 #define FID_SENSOR_CONFIG_LIGHT 139
Jeej 0:87c57e1b1e1c 52
Jeej 0:87c57e1b1e1c 53 #define FID_SENSOR_VALUE_MAG 150
Jeej 0:87c57e1b1e1c 54 #define FID_SENSOR_VALUE_ACC 151
Jeej 0:87c57e1b1e1c 55 #define FID_SENSOR_VALUE_GYR 152
Jeej 0:87c57e1b1e1c 56 #define FID_SENSOR_VALUE_PRE 153
Jeej 0:87c57e1b1e1c 57 #define FID_SENSOR_VALUE_HUM 154
Jeej 0:87c57e1b1e1c 58 #define FID_SENSOR_VALUE_TEM1 155
Jeej 0:87c57e1b1e1c 59 #define FID_SENSOR_VALUE_TEM2 156
Jeej 0:87c57e1b1e1c 60 #define FID_SENSOR_VALUE_LIGHT 157
Jeej 0:87c57e1b1e1c 61
Jeej 0:87c57e1b1e1c 62 FILE_DECLARE_SENSOR_CONFIG(mag);
Jeej 0:87c57e1b1e1c 63 FILE_DECLARE_SENSOR_CONFIG(acc);
Jeej 0:87c57e1b1e1c 64 FILE_DECLARE_SENSOR_CONFIG(gyr);
Jeej 0:87c57e1b1e1c 65 FILE_DECLARE_SENSOR_CONFIG(pre);
Jeej 0:87c57e1b1e1c 66 FILE_DECLARE_SENSOR_CONFIG(hum);
Jeej 0:87c57e1b1e1c 67 FILE_DECLARE_SENSOR_CONFIG(tem1);
Jeej 0:87c57e1b1e1c 68 FILE_DECLARE_SENSOR_CONFIG(tem2);
Jeej 0:87c57e1b1e1c 69 FILE_DECLARE_SENSOR_CONFIG(light);
Jeej 0:87c57e1b1e1c 70
Jeej 0:87c57e1b1e1c 71 FILE_DECLARE_SENSOR_VALUE(mag);
Jeej 0:87c57e1b1e1c 72 FILE_DECLARE_SENSOR_VALUE(acc);
Jeej 0:87c57e1b1e1c 73 FILE_DECLARE_SENSOR_VALUE(gyr);
Jeej 0:87c57e1b1e1c 74 FILE_DECLARE_SENSOR_VALUE(pre);
Jeej 0:87c57e1b1e1c 75 FILE_DECLARE_SENSOR_VALUE(hum);
Jeej 0:87c57e1b1e1c 76 FILE_DECLARE_SENSOR_VALUE(tem1);
Jeej 0:87c57e1b1e1c 77 FILE_DECLARE_SENSOR_VALUE(tem2);
Jeej 0:87c57e1b1e1c 78 FILE_DECLARE_SENSOR_VALUE(light);
Jeej 0:87c57e1b1e1c 79
Jeej 0:87c57e1b1e1c 80
Jeej 0:87c57e1b1e1c 81 #endif // _FILE_H_