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