pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT
Dependencies: mbed MMA8451Q USBDevice WakeUp vt100
Fork of afero_node_suntory_2017_06_15 by
preferences/Preferences.hpp@23:e4d2316383a1, 2017-10-18 (annotated)
- Committer:
- Rhyme
- Date:
- Wed Oct 18 00:31:13 2017 +0000
- Revision:
- 23:e4d2316383a1
- Parent:
- 22:44b33ef643b9
pwm period is now 200us from default 20ms; veml6040->setCOLORCOnf is now AF_BIT | TRIG_BIT from 0x00;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wataloh | 1:b2a9a6f2c30e | 1 | #ifndef _PREFERENCES_HPP_ |
wataloh | 1:b2a9a6f2c30e | 2 | #define _PREFERENCES_HPP_ |
wataloh | 1:b2a9a6f2c30e | 3 | |
wataloh | 1:b2a9a6f2c30e | 4 | #include "mbed.h" |
wataloh | 1:b2a9a6f2c30e | 5 | |
wataloh | 1:b2a9a6f2c30e | 6 | typedef union |
wataloh | 1:b2a9a6f2c30e | 7 | { |
wataloh | 1:b2a9a6f2c30e | 8 | bool b; |
wataloh | 1:b2a9a6f2c30e | 9 | int16_t i_16; |
wataloh | 1:b2a9a6f2c30e | 10 | uint16_t ui_16; |
wataloh | 1:b2a9a6f2c30e | 11 | struct |
wataloh | 1:b2a9a6f2c30e | 12 | { |
wataloh | 1:b2a9a6f2c30e | 13 | short X, Y, Z; |
wataloh | 1:b2a9a6f2c30e | 14 | }; |
wataloh | 1:b2a9a6f2c30e | 15 | struct |
wataloh | 1:b2a9a6f2c30e | 16 | { |
wataloh | 1:b2a9a6f2c30e | 17 | uint16_t R, G, B; |
wataloh | 1:b2a9a6f2c30e | 18 | }; |
wataloh | 1:b2a9a6f2c30e | 19 | } VAR; |
wataloh | 1:b2a9a6f2c30e | 20 | |
wataloh | 1:b2a9a6f2c30e | 21 | template<typename A> struct SENSORS_BASE |
wataloh | 1:b2a9a6f2c30e | 22 | { |
wataloh | 1:b2a9a6f2c30e | 23 | enum INDEX |
wataloh | 1:b2a9a6f2c30e | 24 | { |
wataloh | 1:b2a9a6f2c30e | 25 | ACCELEROMETER = 0, |
wataloh | 1:b2a9a6f2c30e | 26 | COLOR, |
wataloh | 1:b2a9a6f2c30e | 27 | PRESSURE, |
wataloh | 1:b2a9a6f2c30e | 28 | CURRENT_TRANS, |
wataloh | 1:b2a9a6f2c30e | 29 | TEMPERATURE, |
wataloh | 1:b2a9a6f2c30e | 30 | SIZE, |
wataloh | 1:b2a9a6f2c30e | 31 | }; |
wataloh | 1:b2a9a6f2c30e | 32 | static bool ACTIVE[SIZE]; |
wataloh | 5:9d5c7ee80f3b | 33 | static bool DELTA[SIZE]; |
wataloh | 1:b2a9a6f2c30e | 34 | }; |
wataloh | 1:b2a9a6f2c30e | 35 | |
wataloh | 1:b2a9a6f2c30e | 36 | struct SENSORS : public SENSORS_BASE<SENSORS> |
wataloh | 1:b2a9a6f2c30e | 37 | { |
wataloh | 1:b2a9a6f2c30e | 38 | template<typename A> struct COMMONPARAMS; |
wataloh | 1:b2a9a6f2c30e | 39 | struct MAX44008; |
wataloh | 2:dfe671e31221 | 40 | struct VEML6040; |
wataloh | 1:b2a9a6f2c30e | 41 | struct MMA8451Q; |
wataloh | 1:b2a9a6f2c30e | 42 | template<typename A> struct SEMITEC_502AT_11_CALIB; |
wataloh | 5:9d5c7ee80f3b | 43 | template<typename A> struct DEV_TEMP; |
wataloh | 5:9d5c7ee80f3b | 44 | struct DEV_TEMP_INST; |
wataloh | 1:b2a9a6f2c30e | 45 | struct SEMITEC_502AT_11; |
wataloh | 1:b2a9a6f2c30e | 46 | struct SR_3702_150N_14Z; |
wataloh | 1:b2a9a6f2c30e | 47 | template<typename A> struct KEYENCE_PRESSURE_COMMON_PARAMS; |
wataloh | 1:b2a9a6f2c30e | 48 | struct AP_53A_KEYENCE; //AP-53A KEYENCE gas |
wataloh | 1:b2a9a6f2c30e | 49 | struct GP_M010_KEYENCE; //"GP-M010 KEYENCE" liquid |
wataloh | 5:9d5c7ee80f3b | 50 | struct NXP_LM75B; |
wataloh | 1:b2a9a6f2c30e | 51 | }; |
wataloh | 1:b2a9a6f2c30e | 52 | |
wataloh | 2:dfe671e31221 | 53 | template<typename A> struct SENSORS::COMMONPARAMS |
wataloh | 2:dfe671e31221 | 54 | { |
wataloh | 2:dfe671e31221 | 55 | static char* TYPE; |
wataloh | 2:dfe671e31221 | 56 | static char* PN; |
wataloh | 2:dfe671e31221 | 57 | static char* UNIT; |
wataloh | 2:dfe671e31221 | 58 | static char* JSON_FMT; |
wataloh | 2:dfe671e31221 | 59 | }; |
wataloh | 2:dfe671e31221 | 60 | |
wataloh | 1:b2a9a6f2c30e | 61 | template<typename A> struct SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS |
wataloh | 1:b2a9a6f2c30e | 62 | { |
wataloh | 1:b2a9a6f2c30e | 63 | static float V_REF; |
wataloh | 1:b2a9a6f2c30e | 64 | static float PRESSURE_INTERVAL; |
wataloh | 1:b2a9a6f2c30e | 65 | static float SHUNT_R; |
wataloh | 1:b2a9a6f2c30e | 66 | static float LOWEST_CUR; |
wataloh | 1:b2a9a6f2c30e | 67 | static float PRESSURE_COEF; |
wataloh | 1:b2a9a6f2c30e | 68 | }; |
wataloh | 1:b2a9a6f2c30e | 69 | |
wataloh | 1:b2a9a6f2c30e | 70 | template<typename A> float SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<A>::V_REF = 3.3; |
wataloh | 1:b2a9a6f2c30e | 71 | template<typename A> float SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<A>::PRESSURE_INTERVAL = 1.0; |
wataloh | 1:b2a9a6f2c30e | 72 | template<typename A> float SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<A>::SHUNT_R = 165; |
wataloh | 1:b2a9a6f2c30e | 73 | template<typename A> float SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<A>::LOWEST_CUR = 0.004; |
wataloh | 1:b2a9a6f2c30e | 74 | template<typename A> float SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<A>::PRESSURE_COEF = 62500; |
wataloh | 1:b2a9a6f2c30e | 75 | |
wataloh | 1:b2a9a6f2c30e | 76 | struct SENSORS::MAX44008 : public SENSORS::COMMONPARAMS<SENSORS::MAX44008> |
wataloh | 1:b2a9a6f2c30e | 77 | { |
wataloh | 1:b2a9a6f2c30e | 78 | enum |
wataloh | 1:b2a9a6f2c30e | 79 | { |
wataloh | 1:b2a9a6f2c30e | 80 | ADDRESS = 0x41, |
wataloh | 1:b2a9a6f2c30e | 81 | AMB_CONFIG = 0x00, // most sensitive gain |
wataloh | 2:dfe671e31221 | 82 | RAW_MODE = 0x20, // MODE_CLEAR_RGB_IR |
wataloh | 2:dfe671e31221 | 83 | PWM_LED_B = 0x96 |
wataloh | 1:b2a9a6f2c30e | 84 | }; |
wataloh | 1:b2a9a6f2c30e | 85 | struct TRIM |
wataloh | 1:b2a9a6f2c30e | 86 | { |
wataloh | 1:b2a9a6f2c30e | 87 | enum |
wataloh | 1:b2a9a6f2c30e | 88 | { |
wataloh | 1:b2a9a6f2c30e | 89 | R = 0x50, |
wataloh | 1:b2a9a6f2c30e | 90 | G = 0x01, |
wataloh | 1:b2a9a6f2c30e | 91 | B = 0x20 |
wataloh | 1:b2a9a6f2c30e | 92 | }; |
wataloh | 1:b2a9a6f2c30e | 93 | }; |
wataloh | 1:b2a9a6f2c30e | 94 | }; |
wataloh | 1:b2a9a6f2c30e | 95 | |
wataloh | 1:b2a9a6f2c30e | 96 | template<> char* SENSORS::COMMONPARAMS<SENSORS::MAX44008>::TYPE = "COLOR"; |
wataloh | 1:b2a9a6f2c30e | 97 | template<> char* SENSORS::COMMONPARAMS<SENSORS::MAX44008>::PN = "MAX44008"; |
wataloh | 1:b2a9a6f2c30e | 98 | template<> char* SENSORS::COMMONPARAMS<SENSORS::MAX44008>::UNIT = "mW/cm2"; |
wataloh | 1:b2a9a6f2c30e | 99 | template<> char* SENSORS::COMMONPARAMS<SENSORS::MAX44008>::JSON_FMT( |
wataloh | 1:b2a9a6f2c30e | 100 | "{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"DATA\":[{\"TIME\":\"%ld\",\"VAL\":\"%d\",\"UNIT\":\"%s\"}]}" |
wataloh | 1:b2a9a6f2c30e | 101 | ); |
wataloh | 1:b2a9a6f2c30e | 102 | |
wataloh | 2:dfe671e31221 | 103 | |
wataloh | 2:dfe671e31221 | 104 | struct SENSORS::VEML6040 : public SENSORS::COMMONPARAMS<SENSORS::VEML6040> |
wataloh | 2:dfe671e31221 | 105 | { |
wataloh | 2:dfe671e31221 | 106 | enum |
wataloh | 2:dfe671e31221 | 107 | { |
wataloh | 2:dfe671e31221 | 108 | ADDRESS = 0x10, |
wataloh | 2:dfe671e31221 | 109 | AMB_CONFIG = 0x00, // most sensitive gain |
wataloh | 2:dfe671e31221 | 110 | RAW_MODE = 0x20, // MODE_CLEAR_RGB_IR |
wataloh | 5:9d5c7ee80f3b | 111 | PWM_LED_B = 0xFA, |
wataloh | 10:02e481a80843 | 112 | PWM_LED_R_UI16 = 0x5FA2, |
wataloh | 10:02e481a80843 | 113 | PWM_LED_G_UI16 = 0xB09B, |
wataloh | 10:02e481a80843 | 114 | PWM_LED_B_UI16 = 0x83EF |
wataloh | 2:dfe671e31221 | 115 | }; |
wataloh | 2:dfe671e31221 | 116 | struct TRIM |
wataloh | 2:dfe671e31221 | 117 | { |
wataloh | 2:dfe671e31221 | 118 | enum |
wataloh | 2:dfe671e31221 | 119 | { |
wataloh | 2:dfe671e31221 | 120 | R = 0x50, |
wataloh | 2:dfe671e31221 | 121 | G = 0x01, |
wataloh | 2:dfe671e31221 | 122 | B = 0x20 |
wataloh | 2:dfe671e31221 | 123 | }; |
wataloh | 2:dfe671e31221 | 124 | }; |
wataloh | 2:dfe671e31221 | 125 | }; |
wataloh | 2:dfe671e31221 | 126 | |
wataloh | 2:dfe671e31221 | 127 | template<> char* SENSORS::COMMONPARAMS<SENSORS::VEML6040>::JSON_FMT( |
wataloh | 20:47ca1cd230e6 | 128 | "{\"DEVICE\":\"COLOR\",\"PN\":\"VEML6040\",\"VAL_R\":\"%d\",\"VAL_G\":\"%d\",\"VAL_B\":\"%d\",\"UNIT\":\"mW/cm2\",\"S\":\"%d\",\"E\":\"%d\"}" |
wataloh | 2:dfe671e31221 | 129 | ); |
wataloh | 2:dfe671e31221 | 130 | |
wataloh | 2:dfe671e31221 | 131 | struct SENSORS::MMA8451Q : public SENSORS::COMMONPARAMS<SENSORS::MMA8451Q> |
wataloh | 1:b2a9a6f2c30e | 132 | { |
wataloh | 1:b2a9a6f2c30e | 133 | enum |
wataloh | 1:b2a9a6f2c30e | 134 | { |
wataloh | 1:b2a9a6f2c30e | 135 | #if defined (TARGET_KL25Z) |
wataloh | 1:b2a9a6f2c30e | 136 | ADDRESS = 0x1D |
wataloh | 1:b2a9a6f2c30e | 137 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 1:b2a9a6f2c30e | 138 | ADDRESS = 0x1C |
wataloh | 1:b2a9a6f2c30e | 139 | #endif |
wataloh | 1:b2a9a6f2c30e | 140 | }; |
wataloh | 1:b2a9a6f2c30e | 141 | }; |
wataloh | 5:9d5c7ee80f3b | 142 | |
wataloh | 5:9d5c7ee80f3b | 143 | template<> char* SENSORS::COMMONPARAMS<SENSORS::MMA8451Q>::JSON_FMT( |
wataloh | 14:b205267fa5f6 | 144 | // "{\"DEVICE\":\"ACCEL\",\"PN\":\"MMA8451Q\",\"VAL_X\":\"%.3f\",\"VAL_Y\":\"%.3f\",\"VAL_Z\":\"%.3f\",\"UNIT\":\"g\",\"N\":\"%d\",\"RET\":\"%d\"}" |
wataloh | 14:b205267fa5f6 | 145 | "{\"DEVICE\":\"ACCEL\",\"PN\":\"MMA8451Q\",\"VAL_X\":\"%.3f\",\"VAL_Y\":\"0\",\"VAL_Z\":\"0\",\"UNIT\":\"g\",\"S\":\"%d\",\"E\":\"%d\"}" |
wataloh | 5:9d5c7ee80f3b | 146 | ); |
wataloh | 1:b2a9a6f2c30e | 147 | |
wataloh | 1:b2a9a6f2c30e | 148 | template<typename A> struct SENSORS::SEMITEC_502AT_11_CALIB |
wataloh | 1:b2a9a6f2c30e | 149 | { |
wataloh | 1:b2a9a6f2c30e | 150 | static float B; |
wataloh | 1:b2a9a6f2c30e | 151 | static float T0; |
wataloh | 1:b2a9a6f2c30e | 152 | static float R0; |
wataloh | 1:b2a9a6f2c30e | 153 | static float R1; |
wataloh | 1:b2a9a6f2c30e | 154 | }; |
wataloh | 1:b2a9a6f2c30e | 155 | template<> float SENSORS::SEMITEC_502AT_11_CALIB<SENSORS::SEMITEC_502AT_11>::B = 3324; |
wataloh | 1:b2a9a6f2c30e | 156 | template<> float SENSORS::SEMITEC_502AT_11_CALIB<SENSORS::SEMITEC_502AT_11>::T0 = 298.15; |
wataloh | 1:b2a9a6f2c30e | 157 | template<> float SENSORS::SEMITEC_502AT_11_CALIB<SENSORS::SEMITEC_502AT_11>::R0 = 5.0; //kOhm |
wataloh | 1:b2a9a6f2c30e | 158 | template<> float SENSORS::SEMITEC_502AT_11_CALIB<SENSORS::SEMITEC_502AT_11>::R1 = 4.95; //kOhm |
wataloh | 1:b2a9a6f2c30e | 159 | |
wataloh | 5:9d5c7ee80f3b | 160 | template<typename A> struct SENSORS::DEV_TEMP |
wataloh | 5:9d5c7ee80f3b | 161 | { |
wataloh | 5:9d5c7ee80f3b | 162 | enum |
wataloh | 5:9d5c7ee80f3b | 163 | { |
wataloh | 5:9d5c7ee80f3b | 164 | TUBE = 0, |
wataloh | 5:9d5c7ee80f3b | 165 | BEFORE_COOLING, |
wataloh | 5:9d5c7ee80f3b | 166 | AFTER_COOLING, |
wataloh | 5:9d5c7ee80f3b | 167 | SIZE |
wataloh | 5:9d5c7ee80f3b | 168 | }; |
wataloh | 5:9d5c7ee80f3b | 169 | static char* JSON_FMT; |
wataloh | 5:9d5c7ee80f3b | 170 | static char* SUFFIXES[SIZE]; |
wataloh | 5:9d5c7ee80f3b | 171 | static char* PART_NUMBERS[SIZE]; |
wataloh | 5:9d5c7ee80f3b | 172 | static char* POSITION[SIZE]; |
wataloh | 5:9d5c7ee80f3b | 173 | static char* STATUS[SIZE]; |
wataloh | 5:9d5c7ee80f3b | 174 | }; |
wataloh | 5:9d5c7ee80f3b | 175 | |
wataloh | 5:9d5c7ee80f3b | 176 | struct SENSORS::DEV_TEMP_INST : |
wataloh | 5:9d5c7ee80f3b | 177 | public SENSORS::DEV_TEMP<SENSORS::DEV_TEMP_INST> |
wataloh | 5:9d5c7ee80f3b | 178 | { |
wataloh | 5:9d5c7ee80f3b | 179 | }; |
wataloh | 5:9d5c7ee80f3b | 180 | |
wataloh | 5:9d5c7ee80f3b | 181 | template<> char* SENSORS::DEV_TEMP<SENSORS::DEV_TEMP_INST>::SUFFIXES[SIZE] = { |
wataloh | 5:9d5c7ee80f3b | 182 | "01", "02", "03" |
wataloh | 5:9d5c7ee80f3b | 183 | }; |
wataloh | 5:9d5c7ee80f3b | 184 | |
wataloh | 5:9d5c7ee80f3b | 185 | template<> char* SENSORS::DEV_TEMP<SENSORS::DEV_TEMP_INST>::POSITION[SIZE] = { |
wataloh | 5:9d5c7ee80f3b | 186 | "NOT COOLED", "NOT COOLED", "BEING COOLED" |
wataloh | 5:9d5c7ee80f3b | 187 | }; |
wataloh | 5:9d5c7ee80f3b | 188 | |
wataloh | 5:9d5c7ee80f3b | 189 | template<> char* SENSORS::DEV_TEMP<SENSORS::DEV_TEMP_INST>::STATUS[SIZE] = { |
wataloh | 5:9d5c7ee80f3b | 190 | "TUBE", "IN", "IN" |
wataloh | 5:9d5c7ee80f3b | 191 | }; |
wataloh | 5:9d5c7ee80f3b | 192 | |
wataloh | 5:9d5c7ee80f3b | 193 | template<> char* SENSORS::DEV_TEMP<SENSORS::DEV_TEMP_INST>::PART_NUMBERS[SIZE] = { |
wataloh | 5:9d5c7ee80f3b | 194 | "LM75B", "SEMITEC 502AT-11", "SEMITEC 502AT-11" |
wataloh | 5:9d5c7ee80f3b | 195 | }; |
wataloh | 5:9d5c7ee80f3b | 196 | |
wataloh | 5:9d5c7ee80f3b | 197 | template<> char* SENSORS::DEV_TEMP<SENSORS::DEV_TEMP_INST>::JSON_FMT( |
wataloh | 5:9d5c7ee80f3b | 198 | // "{\"DEVICE\":\"TEMP%s\",\"PN\":\"%s\",\"VAL\":\"%0.1f\",\"UNIT\":\"degC\"}" |
wataloh | 14:b205267fa5f6 | 199 | // "{\"DEVICE\":\"TEMP%s\",\"PN\":\"%s\",\"POS\":\"%s\",\"STAT\":\"%s\",\"VAL\":\"%0.1f\",\"UNIT\":\"degC\"}" |
wataloh | 14:b205267fa5f6 | 200 | "{\"DEVICE\":\"TEMP%s\",\"PN\":\"%s\",\"POS\":\"%s\",\"STAT\":\"%s\",\"VAL\":\"%0.1f\",\"UNIT\":\"degC\",\"S\":\"%d\",\"E\":\"%d\"}" |
wataloh | 1:b2a9a6f2c30e | 201 | ); |
wataloh | 1:b2a9a6f2c30e | 202 | |
wataloh | 5:9d5c7ee80f3b | 203 | struct SENSORS::SEMITEC_502AT_11 : |
wataloh | 5:9d5c7ee80f3b | 204 | public SENSORS::COMMONPARAMS<SENSORS::SEMITEC_502AT_11>, |
wataloh | 5:9d5c7ee80f3b | 205 | public SENSORS::SEMITEC_502AT_11_CALIB<SENSORS::SEMITEC_502AT_11> |
wataloh | 5:9d5c7ee80f3b | 206 | { |
wataloh | 5:9d5c7ee80f3b | 207 | }; |
wataloh | 5:9d5c7ee80f3b | 208 | |
wataloh | 5:9d5c7ee80f3b | 209 | //template<> char* SENSORS::COMMONPARAMS<SENSORS::SEMITEC_502AT_11>::TYPE = "TEMP"; |
wataloh | 5:9d5c7ee80f3b | 210 | template<> char* SENSORS::COMMONPARAMS<SENSORS::SEMITEC_502AT_11>::PN = "SEMITEC 502AT-11"; |
wataloh | 5:9d5c7ee80f3b | 211 | //template<> char* SENSORS::COMMONPARAMS<SENSORS::SEMITEC_502AT_11>::UNIT = "degC"; |
wataloh | 5:9d5c7ee80f3b | 212 | |
wataloh | 5:9d5c7ee80f3b | 213 | //template<> char* SENSORS::COMMONPARAMS<SENSORS::SEMITEC_502AT_11>::JSON_FMT( |
wataloh | 5:9d5c7ee80f3b | 214 | // "{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"DATA\":[{\"TIME\":\"%ld\",\"VAL\":\"%0.1f\",\"UNIT\":\"%s\",\"POS\":\"%s\"}]}" |
wataloh | 5:9d5c7ee80f3b | 215 | //); |
wataloh | 5:9d5c7ee80f3b | 216 | |
wataloh | 5:9d5c7ee80f3b | 217 | struct SENSORS::NXP_LM75B : |
wataloh | 5:9d5c7ee80f3b | 218 | public SENSORS::COMMONPARAMS<SENSORS::NXP_LM75B> |
wataloh | 5:9d5c7ee80f3b | 219 | { |
wataloh | 5:9d5c7ee80f3b | 220 | enum |
wataloh | 5:9d5c7ee80f3b | 221 | { |
wataloh | 5:9d5c7ee80f3b | 222 | ADDRESS = 0x48, |
wataloh | 5:9d5c7ee80f3b | 223 | REG_Conf = 0x01, |
wataloh | 5:9d5c7ee80f3b | 224 | REG_Temp = 0x00, |
wataloh | 5:9d5c7ee80f3b | 225 | REG_Tos = 0x03, |
wataloh | 5:9d5c7ee80f3b | 226 | REG_Thyst = 0x02 |
wataloh | 5:9d5c7ee80f3b | 227 | }; |
wataloh | 5:9d5c7ee80f3b | 228 | }; |
wataloh | 5:9d5c7ee80f3b | 229 | |
wataloh | 5:9d5c7ee80f3b | 230 | template<> char* SENSORS::COMMONPARAMS<SENSORS::NXP_LM75B>::PN = "LM75B"; |
wataloh | 5:9d5c7ee80f3b | 231 | |
wataloh | 1:b2a9a6f2c30e | 232 | struct SENSORS::SR_3702_150N_14Z : public SENSORS::COMMONPARAMS<SENSORS::SR_3702_150N_14Z>{}; |
wataloh | 5:9d5c7ee80f3b | 233 | |
wataloh | 1:b2a9a6f2c30e | 234 | template<> char* SENSORS::COMMONPARAMS<SENSORS::SR_3702_150N_14Z>::TYPE = "CURRENT_TRANS";; |
wataloh | 1:b2a9a6f2c30e | 235 | template<> char* SENSORS::COMMONPARAMS<SENSORS::SR_3702_150N_14Z>::PN = "SR-3702-150N/14Z"; |
wataloh | 1:b2a9a6f2c30e | 236 | template<> char* SENSORS::COMMONPARAMS<SENSORS::SR_3702_150N_14Z>::UNIT = "V"; |
wataloh | 1:b2a9a6f2c30e | 237 | template<> char* SENSORS::COMMONPARAMS<SENSORS::SR_3702_150N_14Z>::JSON_FMT( |
wataloh | 1:b2a9a6f2c30e | 238 | "{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"DATA\":[{\"TIME\":\"%ld\",\"VAL\":\"%0.1f\",\"UNIT\":\"%s\"}]}" |
wataloh | 1:b2a9a6f2c30e | 239 | ); |
wataloh | 1:b2a9a6f2c30e | 240 | struct SENSORS::AP_53A_KEYENCE : |
wataloh | 1:b2a9a6f2c30e | 241 | public SENSORS::COMMONPARAMS<SENSORS::AP_53A_KEYENCE>, |
wataloh | 1:b2a9a6f2c30e | 242 | public SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<SENSORS::AP_53A_KEYENCE> {}; |
wataloh | 1:b2a9a6f2c30e | 243 | template<> char *SENSORS::COMMONPARAMS<SENSORS::AP_53A_KEYENCE>::TYPE = "GAS PRESSURE"; |
wataloh | 1:b2a9a6f2c30e | 244 | template<> char *SENSORS::COMMONPARAMS<SENSORS::AP_53A_KEYENCE>::PN = "AP-53A KEYENCE"; |
wataloh | 1:b2a9a6f2c30e | 245 | template<> char *SENSORS::COMMONPARAMS<SENSORS::AP_53A_KEYENCE>::UNIT = "KPa"; |
wataloh | 1:b2a9a6f2c30e | 246 | template<> char* SENSORS::COMMONPARAMS<SENSORS::AP_53A_KEYENCE>::JSON_FMT( |
wataloh | 5:9d5c7ee80f3b | 247 | //"{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"DATA\":[{\"TIME\":\"%ld\",\"VAL\":\"%0.1f\",\"UNIT\":\"%s\"}]}" |
wataloh | 5:9d5c7ee80f3b | 248 | "{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"VAL\":\"%0.1f\"}" |
wataloh | 1:b2a9a6f2c30e | 249 | ); |
wataloh | 1:b2a9a6f2c30e | 250 | |
wataloh | 1:b2a9a6f2c30e | 251 | struct SENSORS::GP_M010_KEYENCE : |
wataloh | 1:b2a9a6f2c30e | 252 | public SENSORS::COMMONPARAMS<SENSORS::GP_M010_KEYENCE>, |
wataloh | 1:b2a9a6f2c30e | 253 | public SENSORS::KEYENCE_PRESSURE_COMMON_PARAMS<SENSORS::GP_M010_KEYENCE> {}; |
wataloh | 1:b2a9a6f2c30e | 254 | template<> char *SENSORS::COMMONPARAMS<SENSORS::GP_M010_KEYENCE>::TYPE = "LIQUID PRESSURE"; |
wataloh | 1:b2a9a6f2c30e | 255 | template<> char *SENSORS::COMMONPARAMS<SENSORS::GP_M010_KEYENCE>::PN = "AGP-M010 KEYENCE"; |
wataloh | 1:b2a9a6f2c30e | 256 | template<> char *SENSORS::COMMONPARAMS<SENSORS::GP_M010_KEYENCE>::UNIT = "KPa"; |
wataloh | 1:b2a9a6f2c30e | 257 | template<> char* SENSORS::COMMONPARAMS<SENSORS::GP_M010_KEYENCE>::JSON_FMT( |
wataloh | 5:9d5c7ee80f3b | 258 | //"{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"DATA\":[{\"TIME\":\"%ld\",\"VAL\":\"%0.1f\",\"UNIT\":\"%s\"}]}" |
wataloh | 5:9d5c7ee80f3b | 259 | "{\"DEVICE\":\"%s\",\"PN\":\"%s\",\"VAL\":\"%0.1f\"}" |
wataloh | 1:b2a9a6f2c30e | 260 | ); |
wataloh | 1:b2a9a6f2c30e | 261 | |
wataloh | 1:b2a9a6f2c30e | 262 | struct PINS |
wataloh | 1:b2a9a6f2c30e | 263 | { |
wataloh | 1:b2a9a6f2c30e | 264 | struct LED_4_COLOR; |
wataloh | 1:b2a9a6f2c30e | 265 | struct COLOR; |
wataloh | 1:b2a9a6f2c30e | 266 | struct ACCELEROMETER; |
wataloh | 1:b2a9a6f2c30e | 267 | struct CURRENT_TRANS; |
wataloh | 1:b2a9a6f2c30e | 268 | struct TEMPERATURE; |
wataloh | 1:b2a9a6f2c30e | 269 | struct UART; |
wataloh | 1:b2a9a6f2c30e | 270 | struct ASR_1; |
wataloh | 1:b2a9a6f2c30e | 271 | struct GAS; |
wataloh | 1:b2a9a6f2c30e | 272 | struct LIQUID; |
wataloh | 1:b2a9a6f2c30e | 273 | }; |
wataloh | 1:b2a9a6f2c30e | 274 | |
wataloh | 1:b2a9a6f2c30e | 275 | struct PINS::LED_4_COLOR |
wataloh | 1:b2a9a6f2c30e | 276 | { |
wataloh | 1:b2a9a6f2c30e | 277 | enum |
wataloh | 1:b2a9a6f2c30e | 278 | { |
wataloh | 1:b2a9a6f2c30e | 279 | R = PTA5, |
wataloh | 1:b2a9a6f2c30e | 280 | G = PTA4, |
wataloh | 1:b2a9a6f2c30e | 281 | B = PTA12 |
wataloh | 1:b2a9a6f2c30e | 282 | }; |
wataloh | 1:b2a9a6f2c30e | 283 | }; |
wataloh | 1:b2a9a6f2c30e | 284 | |
wataloh | 1:b2a9a6f2c30e | 285 | struct PINS::COLOR |
wataloh | 1:b2a9a6f2c30e | 286 | { |
wataloh | 1:b2a9a6f2c30e | 287 | enum |
wataloh | 1:b2a9a6f2c30e | 288 | { |
wataloh | 1:b2a9a6f2c30e | 289 | SDA = PTE0, |
wataloh | 1:b2a9a6f2c30e | 290 | SCL = PTE1 |
wataloh | 1:b2a9a6f2c30e | 291 | }; |
wataloh | 1:b2a9a6f2c30e | 292 | }; |
wataloh | 1:b2a9a6f2c30e | 293 | |
wataloh | 1:b2a9a6f2c30e | 294 | struct PINS::ACCELEROMETER |
wataloh | 1:b2a9a6f2c30e | 295 | { |
wataloh | 1:b2a9a6f2c30e | 296 | enum |
wataloh | 1:b2a9a6f2c30e | 297 | { |
wataloh | 1:b2a9a6f2c30e | 298 | #if defined (TARGET_KL25Z) |
wataloh | 1:b2a9a6f2c30e | 299 | SDA = PTE25, |
wataloh | 1:b2a9a6f2c30e | 300 | SCL = PTE24 |
wataloh | 1:b2a9a6f2c30e | 301 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 1:b2a9a6f2c30e | 302 | SDA = PTB3, |
wataloh | 1:b2a9a6f2c30e | 303 | SCL = PTB2 |
wataloh | 1:b2a9a6f2c30e | 304 | #endif |
wataloh | 1:b2a9a6f2c30e | 305 | }; |
wataloh | 1:b2a9a6f2c30e | 306 | }; |
wataloh | 1:b2a9a6f2c30e | 307 | |
wataloh | 1:b2a9a6f2c30e | 308 | struct PINS::CURRENT_TRANS |
wataloh | 1:b2a9a6f2c30e | 309 | { |
wataloh | 1:b2a9a6f2c30e | 310 | enum |
wataloh | 1:b2a9a6f2c30e | 311 | { |
wataloh | 1:b2a9a6f2c30e | 312 | AIN = PTB0 |
wataloh | 1:b2a9a6f2c30e | 313 | }; |
wataloh | 1:b2a9a6f2c30e | 314 | }; |
wataloh | 1:b2a9a6f2c30e | 315 | |
wataloh | 1:b2a9a6f2c30e | 316 | struct PINS::TEMPERATURE |
wataloh | 1:b2a9a6f2c30e | 317 | { |
wataloh | 1:b2a9a6f2c30e | 318 | enum |
wataloh | 1:b2a9a6f2c30e | 319 | { |
wataloh | 22:44b33ef643b9 | 320 | BEFORE_COOLING = PTB0, // la suno shield |
wataloh | 22:44b33ef643b9 | 321 | // BEFORE_COOLING = PTC2, // Hibiki only |
wataloh | 5:9d5c7ee80f3b | 322 | AFTER_COOLING = PTB1, |
wataloh | 5:9d5c7ee80f3b | 323 | SDA = PTE0, |
wataloh | 5:9d5c7ee80f3b | 324 | SCL = PTE1 |
wataloh | 1:b2a9a6f2c30e | 325 | }; |
wataloh | 1:b2a9a6f2c30e | 326 | }; |
wataloh | 1:b2a9a6f2c30e | 327 | |
wataloh | 1:b2a9a6f2c30e | 328 | struct PINS::GAS |
wataloh | 1:b2a9a6f2c30e | 329 | { |
wataloh | 1:b2a9a6f2c30e | 330 | enum |
wataloh | 1:b2a9a6f2c30e | 331 | { |
wataloh | 1:b2a9a6f2c30e | 332 | AIN = PTB2 |
wataloh | 1:b2a9a6f2c30e | 333 | }; |
wataloh | 1:b2a9a6f2c30e | 334 | }; |
wataloh | 1:b2a9a6f2c30e | 335 | |
wataloh | 1:b2a9a6f2c30e | 336 | struct PINS::LIQUID |
wataloh | 1:b2a9a6f2c30e | 337 | { |
wataloh | 1:b2a9a6f2c30e | 338 | enum |
wataloh | 1:b2a9a6f2c30e | 339 | { |
wataloh | 1:b2a9a6f2c30e | 340 | AIN = PTB3 |
wataloh | 1:b2a9a6f2c30e | 341 | }; |
wataloh | 1:b2a9a6f2c30e | 342 | }; |
wataloh | 1:b2a9a6f2c30e | 343 | |
wataloh | 1:b2a9a6f2c30e | 344 | struct PINS::ASR_1 |
wataloh | 1:b2a9a6f2c30e | 345 | { |
wataloh | 1:b2a9a6f2c30e | 346 | struct SPI; |
wataloh | 1:b2a9a6f2c30e | 347 | enum |
wataloh | 1:b2a9a6f2c30e | 348 | { |
wataloh | 1:b2a9a6f2c30e | 349 | #if defined (TARGET_KL25Z) |
wataloh | 6:88cc04eb613a | 350 | RESET = PTC9 //PSOC |
wataloh | 6:88cc04eb613a | 351 | //RESET = PTA20 |
wataloh | 1:b2a9a6f2c30e | 352 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 1:b2a9a6f2c30e | 353 | RESET = PTD6 |
wataloh | 1:b2a9a6f2c30e | 354 | #endif |
wataloh | 1:b2a9a6f2c30e | 355 | }; |
wataloh | 1:b2a9a6f2c30e | 356 | struct SIG |
wataloh | 1:b2a9a6f2c30e | 357 | { |
wataloh | 1:b2a9a6f2c30e | 358 | template<typename A> struct RESET_BASE |
wataloh | 1:b2a9a6f2c30e | 359 | { |
wataloh | 1:b2a9a6f2c30e | 360 | static time_t INTERVAL; |
wataloh | 1:b2a9a6f2c30e | 361 | }; |
wataloh | 1:b2a9a6f2c30e | 362 | struct RESET : public RESET_BASE<RESET> |
wataloh | 1:b2a9a6f2c30e | 363 | { |
wataloh | 1:b2a9a6f2c30e | 364 | enum |
wataloh | 1:b2a9a6f2c30e | 365 | { |
wataloh | 1:b2a9a6f2c30e | 366 | ASSERT = 0, |
wataloh | 1:b2a9a6f2c30e | 367 | DEASSERT = 1 |
wataloh | 1:b2a9a6f2c30e | 368 | }; |
wataloh | 1:b2a9a6f2c30e | 369 | }; |
wataloh | 1:b2a9a6f2c30e | 370 | }; |
wataloh | 1:b2a9a6f2c30e | 371 | }; |
wataloh | 1:b2a9a6f2c30e | 372 | |
wataloh | 1:b2a9a6f2c30e | 373 | template<> time_t PINS::ASR_1::SIG::RESET_BASE<PINS::ASR_1::SIG::RESET>::INTERVAL = 60*5; |
wataloh | 1:b2a9a6f2c30e | 374 | |
wataloh | 1:b2a9a6f2c30e | 375 | struct PINS::ASR_1::SPI |
wataloh | 1:b2a9a6f2c30e | 376 | { |
wataloh | 1:b2a9a6f2c30e | 377 | enum |
wataloh | 1:b2a9a6f2c30e | 378 | { |
wataloh | 1:b2a9a6f2c30e | 379 | #if defined (TARGET_KL25Z) |
wataloh | 1:b2a9a6f2c30e | 380 | MOSI = PTD2, |
wataloh | 1:b2a9a6f2c30e | 381 | MISO = PTD3, |
wataloh | 1:b2a9a6f2c30e | 382 | SCK = PTD1, |
wataloh | 1:b2a9a6f2c30e | 383 | CS = PTD0, |
wataloh | 1:b2a9a6f2c30e | 384 | SR = PTD4 // request from slave |
wataloh | 1:b2a9a6f2c30e | 385 | #elif defined (TARGET_TEENSY3_1) |
wataloh | 1:b2a9a6f2c30e | 386 | MOSI = PTC6, |
wataloh | 1:b2a9a6f2c30e | 387 | MISO = PTC7, |
wataloh | 1:b2a9a6f2c30e | 388 | SCK = PTC5, |
wataloh | 1:b2a9a6f2c30e | 389 | CS = PTC4, |
wataloh | 1:b2a9a6f2c30e | 390 | SR = PTD1 // request from slave |
wataloh | 1:b2a9a6f2c30e | 391 | #endif |
wataloh | 1:b2a9a6f2c30e | 392 | }; |
wataloh | 1:b2a9a6f2c30e | 393 | struct SIG |
wataloh | 1:b2a9a6f2c30e | 394 | { |
wataloh | 1:b2a9a6f2c30e | 395 | struct CS |
wataloh | 1:b2a9a6f2c30e | 396 | { |
wataloh | 1:b2a9a6f2c30e | 397 | enum |
wataloh | 1:b2a9a6f2c30e | 398 | { |
wataloh | 1:b2a9a6f2c30e | 399 | ASSERT = 0, |
wataloh | 1:b2a9a6f2c30e | 400 | DEASSERT = 1 |
wataloh | 1:b2a9a6f2c30e | 401 | }; |
wataloh | 1:b2a9a6f2c30e | 402 | }; |
wataloh | 1:b2a9a6f2c30e | 403 | }; |
wataloh | 1:b2a9a6f2c30e | 404 | enum |
wataloh | 1:b2a9a6f2c30e | 405 | { |
wataloh | 1:b2a9a6f2c30e | 406 | NUM_BITS_PER_FRAME = 8, |
wataloh | 1:b2a9a6f2c30e | 407 | MODE_0 = 0, |
wataloh | 1:b2a9a6f2c30e | 408 | FREQUENCY = 1*1000*1000 |
wataloh | 1:b2a9a6f2c30e | 409 | }; |
wataloh | 1:b2a9a6f2c30e | 410 | }; |
wataloh | 1:b2a9a6f2c30e | 411 | |
wataloh | 1:b2a9a6f2c30e | 412 | struct PINS::UART |
wataloh | 1:b2a9a6f2c30e | 413 | { |
wataloh | 2:dfe671e31221 | 414 | enum |
wataloh | 2:dfe671e31221 | 415 | { |
wataloh | 2:dfe671e31221 | 416 | BAUD_RATE = 115200 |
wataloh | 2:dfe671e31221 | 417 | }; |
wataloh | 1:b2a9a6f2c30e | 418 | #if defined (TARGET_TEENSY3_1) |
wataloh | 1:b2a9a6f2c30e | 419 | enum |
wataloh | 1:b2a9a6f2c30e | 420 | { |
wataloh | 1:b2a9a6f2c30e | 421 | uart0_tx = PTA2, |
wataloh | 1:b2a9a6f2c30e | 422 | uart0_rx = PTA1 |
wataloh | 1:b2a9a6f2c30e | 423 | }; |
wataloh | 1:b2a9a6f2c30e | 424 | #endif |
wataloh | 1:b2a9a6f2c30e | 425 | #if defined (TARGET_KL25Z) && (WICED_SMART_UART_CONNECTION) |
wataloh | 1:b2a9a6f2c30e | 426 | struct WICED |
wataloh | 1:b2a9a6f2c30e | 427 | { |
wataloh | 1:b2a9a6f2c30e | 428 | struct TAG3 |
wataloh | 1:b2a9a6f2c30e | 429 | { |
wataloh | 1:b2a9a6f2c30e | 430 | enum |
wataloh | 1:b2a9a6f2c30e | 431 | { |
wataloh | 1:b2a9a6f2c30e | 432 | TO_RX = PTE22 // -> TAG3 J7-1 |
wataloh | 1:b2a9a6f2c30e | 433 | ,TO_TX = PTE23 // -> TAG3 J8-5 |
wataloh | 1:b2a9a6f2c30e | 434 | //power 3v3 -> TAG J9-1 |
wataloh | 1:b2a9a6f2c30e | 435 | //GND -> TAGJ9-4 |
wataloh | 1:b2a9a6f2c30e | 436 | }; |
wataloh | 1:b2a9a6f2c30e | 437 | }; |
wataloh | 1:b2a9a6f2c30e | 438 | }; |
wataloh | 1:b2a9a6f2c30e | 439 | #endif |
wataloh | 1:b2a9a6f2c30e | 440 | }; |
wataloh | 1:b2a9a6f2c30e | 441 | |
wataloh | 1:b2a9a6f2c30e | 442 | template<typename A> struct PREFERENCES_BASE |
wataloh | 1:b2a9a6f2c30e | 443 | { |
wataloh | 2:dfe671e31221 | 444 | static int32_t SENSING_INTERVAL[SENSORS::SIZE]; |
wataloh | 1:b2a9a6f2c30e | 445 | static time_t EPOCH_UTC; |
wataloh | 1:b2a9a6f2c30e | 446 | typedef union |
wataloh | 1:b2a9a6f2c30e | 447 | { |
wataloh | 1:b2a9a6f2c30e | 448 | uint32_t ui32; |
wataloh | 1:b2a9a6f2c30e | 449 | uint8_t ui8[sizeof(uint32_t)]; |
wataloh | 1:b2a9a6f2c30e | 450 | } _crc32; |
wataloh | 1:b2a9a6f2c30e | 451 | static _crc32 CRC32; |
wataloh | 2:dfe671e31221 | 452 | static bool FLOW_CONTROL; |
wataloh | 5:9d5c7ee80f3b | 453 | static bool DBG_PRINT_ENABLED; |
wataloh | 5:9d5c7ee80f3b | 454 | static bool DBG_PRINT_ASR_ENABLED; |
wataloh | 2:dfe671e31221 | 455 | struct AFERO_ATTRIBUTE |
wataloh | 2:dfe671e31221 | 456 | { |
wataloh | 2:dfe671e31221 | 457 | uint32_t ATTR_CRC32; |
wataloh | 2:dfe671e31221 | 458 | }; |
wataloh | 1:b2a9a6f2c30e | 459 | }; |
wataloh | 1:b2a9a6f2c30e | 460 | |
wataloh | 1:b2a9a6f2c30e | 461 | struct PREFERENCES : PREFERENCES_BASE<PREFERENCES> |
wataloh | 1:b2a9a6f2c30e | 462 | { |
wataloh | 1:b2a9a6f2c30e | 463 | struct NOTIFICATION; |
wataloh | 1:b2a9a6f2c30e | 464 | struct DATA_TRANSFER_MODE |
wataloh | 1:b2a9a6f2c30e | 465 | { |
wataloh | 1:b2a9a6f2c30e | 466 | enum |
wataloh | 1:b2a9a6f2c30e | 467 | { |
wataloh | 1:b2a9a6f2c30e | 468 | JSON = 0, |
wataloh | 1:b2a9a6f2c30e | 469 | BASE64 = 1 |
wataloh | 1:b2a9a6f2c30e | 470 | }; |
wataloh | 1:b2a9a6f2c30e | 471 | }; |
wataloh | 1:b2a9a6f2c30e | 472 | struct THRESHOLD |
wataloh | 1:b2a9a6f2c30e | 473 | { |
wataloh | 1:b2a9a6f2c30e | 474 | struct RANGE |
wataloh | 1:b2a9a6f2c30e | 475 | { |
wataloh | 1:b2a9a6f2c30e | 476 | enum |
wataloh | 1:b2a9a6f2c30e | 477 | { |
wataloh | 1:b2a9a6f2c30e | 478 | MIN = 0, |
wataloh | 1:b2a9a6f2c30e | 479 | MAX, |
wataloh | 1:b2a9a6f2c30e | 480 | DELTA, |
wataloh | 1:b2a9a6f2c30e | 481 | SIZE |
wataloh | 1:b2a9a6f2c30e | 482 | }; |
wataloh | 1:b2a9a6f2c30e | 483 | }; |
wataloh | 1:b2a9a6f2c30e | 484 | }; |
wataloh | 1:b2a9a6f2c30e | 485 | template<typename A> struct NOTIFICATION_BASE |
wataloh | 1:b2a9a6f2c30e | 486 | { |
wataloh | 1:b2a9a6f2c30e | 487 | static bool ENABLED[SENSORS::SIZE][THRESHOLD::RANGE::SIZE]; |
wataloh | 1:b2a9a6f2c30e | 488 | static VAR THRESHOLD[SENSORS::SIZE][THRESHOLD::RANGE::SIZE]; // not used ... for now. |
wataloh | 1:b2a9a6f2c30e | 489 | }; |
wataloh | 1:b2a9a6f2c30e | 490 | }; |
wataloh | 1:b2a9a6f2c30e | 491 | |
wataloh | 2:dfe671e31221 | 492 | template<> int32_t PREFERENCES_BASE<PREFERENCES>::SENSING_INTERVAL[SENSORS::SIZE] = { 30, 30, 30, 30, 30 }; |
wataloh | 1:b2a9a6f2c30e | 493 | template<> time_t PREFERENCES_BASE<PREFERENCES>::EPOCH_UTC = 0; |
wataloh | 2:dfe671e31221 | 494 | template<> PREFERENCES_BASE<PREFERENCES>::_crc32 PREFERENCES_BASE<PREFERENCES>::CRC32 = { 0 }; |
wataloh | 2:dfe671e31221 | 495 | |
wataloh | 2:dfe671e31221 | 496 | template<> bool PREFERENCES_BASE<PREFERENCES>::FLOW_CONTROL = false; |
wataloh | 2:dfe671e31221 | 497 | |
wataloh | 5:9d5c7ee80f3b | 498 | template<> bool PREFERENCES_BASE<PREFERENCES>::DBG_PRINT_ENABLED = true; |
wataloh | 5:9d5c7ee80f3b | 499 | template<> bool PREFERENCES_BASE<PREFERENCES>::DBG_PRINT_ASR_ENABLED = true; |
wataloh | 1:b2a9a6f2c30e | 500 | |
wataloh | 1:b2a9a6f2c30e | 501 | struct PREFERENCES::NOTIFICATION : public PREFERENCES::NOTIFICATION_BASE<PREFERENCES::NOTIFICATION> |
wataloh | 1:b2a9a6f2c30e | 502 | { |
wataloh | 1:b2a9a6f2c30e | 503 | }; |
wataloh | 1:b2a9a6f2c30e | 504 | |
wataloh | 1:b2a9a6f2c30e | 505 | template<> bool PREFERENCES::NOTIFICATION_BASE<PREFERENCES::NOTIFICATION>::ENABLED[SENSORS::SIZE][THRESHOLD::RANGE::SIZE]; |
wataloh | 1:b2a9a6f2c30e | 506 | template<> VAR PREFERENCES::NOTIFICATION_BASE<PREFERENCES::NOTIFICATION>::THRESHOLD[SENSORS::SIZE][THRESHOLD::RANGE::SIZE]; |
wataloh | 1:b2a9a6f2c30e | 507 | |
wataloh | 1:b2a9a6f2c30e | 508 | typedef union |
wataloh | 1:b2a9a6f2c30e | 509 | { |
wataloh | 1:b2a9a6f2c30e | 510 | typedef struct |
wataloh | 1:b2a9a6f2c30e | 511 | { |
wataloh | 1:b2a9a6f2c30e | 512 | time_t timeStamp; |
wataloh | 1:b2a9a6f2c30e | 513 | SENSORS::INDEX index; |
wataloh | 1:b2a9a6f2c30e | 514 | } PACKET_BASE; |
wataloh | 1:b2a9a6f2c30e | 515 | struct : PACKET_BASE |
wataloh | 1:b2a9a6f2c30e | 516 | { |
wataloh | 1:b2a9a6f2c30e | 517 | short x,y,z; |
wataloh | 1:b2a9a6f2c30e | 518 | } accelerometer; |
wataloh | 1:b2a9a6f2c30e | 519 | struct : PACKET_BASE |
wataloh | 1:b2a9a6f2c30e | 520 | { |
wataloh | 1:b2a9a6f2c30e | 521 | uint16_t R, G, B; |
wataloh | 1:b2a9a6f2c30e | 522 | } color; |
wataloh | 1:b2a9a6f2c30e | 523 | struct : PACKET_BASE |
wataloh | 1:b2a9a6f2c30e | 524 | { |
wataloh | 1:b2a9a6f2c30e | 525 | float val; |
wataloh | 1:b2a9a6f2c30e | 526 | } temperature; |
wataloh | 1:b2a9a6f2c30e | 527 | struct : PACKET_BASE |
wataloh | 1:b2a9a6f2c30e | 528 | { |
wataloh | 1:b2a9a6f2c30e | 529 | float val; |
wataloh | 1:b2a9a6f2c30e | 530 | } current_trans; |
wataloh | 1:b2a9a6f2c30e | 531 | struct : PACKET_BASE |
wataloh | 1:b2a9a6f2c30e | 532 | { |
wataloh | 1:b2a9a6f2c30e | 533 | float val; |
wataloh | 1:b2a9a6f2c30e | 534 | } pressure; |
wataloh | 1:b2a9a6f2c30e | 535 | } PACKET; |
wataloh | 1:b2a9a6f2c30e | 536 | |
wataloh | 5:9d5c7ee80f3b | 537 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, false, false, false, true }; // temperature |
wataloh | 5:9d5c7ee80f3b | 538 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, true, false, false, false }; // color |
wataloh | 10:02e481a80843 | 539 | template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { true, true, false, false, true }; // color + temp + accelerometer |
wataloh | 14:b205267fa5f6 | 540 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { true, false, false, false, true }; // temp + accelerometer |
wataloh | 6:88cc04eb613a | 541 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, true, false, false, true }; // color + temp |
wataloh | 5:9d5c7ee80f3b | 542 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, true, false, true, true }; // sensor box |
wataloh | 5:9d5c7ee80f3b | 543 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, false, true, false, false }; // pressure |
wataloh | 10:02e481a80843 | 544 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { true, false, false, false, false }; // accelerometer |
wataloh | 5:9d5c7ee80f3b | 545 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, true, false, false, false }; // color only ... sensor box |
wataloh | 5:9d5c7ee80f3b | 546 | //template<> bool SENSORS_BASE<SENSORS>::ACTIVE[SENSORS::SIZE] = { false, false, false, true, false }; // CT only ... sensor box |
wataloh | 5:9d5c7ee80f3b | 547 | |
wataloh | 5:9d5c7ee80f3b | 548 | template<> bool SENSORS_BASE<SENSORS>::DELTA[SENSORS::SIZE] = { true, false, false, false, false }; // accelerometer |
wataloh | 5:9d5c7ee80f3b | 549 | |
wataloh | 1:b2a9a6f2c30e | 550 | #endif //_PREFERENCES_HPP_ |