A multifunctional and modular Firmware for Multitech's mDot based on ARM mBed provides a widerange of functionality for several Sensors such as MAX44009, BME280, MPU9250, SI1143 and uBlox. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

Dependencies:   mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed

LoRa-Sensornode Firmware for Multitech mDot

A multifunctional and modular Firmware for Multitech's mDot which provides a widerange of functionality for several Sensors. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

/media/uploads/mitea1/logo-lora-600x370.png /media/uploads/mitea1/mt_mdot_family_642px.png

Supported Sensors

Idea

The Firmware has some predefined Application Modes running different Tasks(Measurements). Each mode can be used in a different Scenario. Application_Modes define which sensors are used, how often they aquire data and how often the data has to be sent via LoRa. Lets say you just want to measure the Light then you choose an Application_Mode (or define one) that only runs TaskLight for light measurement. As a standard all measurements are taken every second and sent via LoRa but you can change that interval depending on your usage Scenario

Committer:
mitea1
Date:
Fri Nov 02 17:01:02 2018 +0000
Revision:
10:4051c38bf73f
Parent:
9:c4e378f4801d
wtf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 0:f2815503561f 1 /*
mitea1 0:f2815503561f 2 * ApplicationConfig.h
mitea1 0:f2815503561f 3 *
mitea1 0:f2815503561f 4 * Created on: Jun 3, 2016
mitea1 0:f2815503561f 5 * Author: Adrian
mitea1 0:f2815503561f 6 */
mitea1 0:f2815503561f 7 #include "BME280Config.h"
mitea1 0:f2815503561f 8 #include "MPU9250Config.h"
mitea1 0:f2815503561f 9 #include "uBloxConfig.h"
mitea1 0:f2815503561f 10 #include "MAX44009Config.h"
mitea1 0:f2815503561f 11 #include "SI1143Config.h"
mitea1 9:c4e378f4801d 12 #include "main.h"
mitea1 9:c4e378f4801d 13
mitea1 0:f2815503561f 14 #include "LoRaConfig.h"
mitea1 0:f2815503561f 15 #ifndef APPLICATIONCONFIG_H_
mitea1 0:f2815503561f 16 #define APPLICATIONCONFIG_H_
mitea1 0:f2815503561f 17
mitea1 0:f2815503561f 18 /**
mitea1 0:f2815503561f 19 * Application Modes. Modes define different Usages of the LoRa sensor node
mitea1 0:f2815503561f 20 */
mitea1 0:f2815503561f 21 enum APPLICATION_MODE {
mitea1 0:f2815503561f 22 APPLICATION_MODE_1, //!< APPLICATION_MODE_1
mitea1 0:f2815503561f 23 APPLICATION_MODE_2, //!< APPLICATION_MODE_2
mitea1 0:f2815503561f 24 APPLICATION_MODE_3, //!< APPLICATION_MODE_3
mitea1 0:f2815503561f 25 APPLICATION_MODE_4, //!< APPLICATION_MODE_4
mitea1 0:f2815503561f 26 APPLICATION_MODE_5, //!< APPLICATION_MODE_5
mitea1 0:f2815503561f 27 APPLICATION_MODE_6, //!< APPLICATION_MODE_6
mitea1 0:f2815503561f 28 APPLICATION_MODE_7, //!< APPLICATION_MODE_7
mitea1 0:f2815503561f 29 APPLICATION_MODE_8, //!< APPLICATION_MODE_8
mitea1 0:f2815503561f 30 APPLICATION_MODE_9, //!< APPLICATION_MODE_9
mitea1 0:f2815503561f 31 APPLICATION_MODE_10, //!< APPLICATION_MODE_10
mitea1 0:f2815503561f 32 APPLICATION_MODE_11, //!< APPLICATION_MODE_11
mitea1 0:f2815503561f 33 APPLICATION_MODE_99, //!< APPLICATION_MODE_99
mitea1 0:f2815503561f 34 APPLICATION_MODE_TEST, //!< APPLICATION_MODE_TEST
mitea1 0:f2815503561f 35 APPLICATION_MODE_TEST_MAX44009, //!< APPLICATION_MODE_TEST_MAX44009
mitea1 0:f2815503561f 36 APPLICATION_MODE_TEST_BME280, //!< APPLICATION_MODE_TEST_BME280
mitea1 0:f2815503561f 37 APPLICATION_MODE_TEST_MPU9250, //!< APPLICATION_MODE_TEST_MPU9250
mitea1 0:f2815503561f 38 APPLICATION_MODE_TEST_SI1143, //!< APPLICATION_MODE_TEST_SI1143
mitea1 0:f2815503561f 39 APPLICATION_MODE_TEST_uBlox, //!< APPLICATION_MODE_TEST_uBlox
mitea1 0:f2815503561f 40 APPLICATION_MODE_LORA_MEASUREMENT,//!< APPLICATION_MODE_LORA_MEASUREMENT
mitea1 0:f2815503561f 41 WEATHER_MEASUREMENT, //!< WEATHER_STATION
mitea1 0:f2815503561f 42 ORIENTATATION_MEASUREMENT, //!< ORIENTATATION_SENSOR
mitea1 0:f2815503561f 43 DISTANCE_MEASUREMENT, //!< DISTANCE_SENSOR
mitea1 0:f2815503561f 44 };
mitea1 0:f2815503561f 45
mitea1 0:f2815503561f 46
mitea1 0:f2815503561f 47 class ApplicationConfig {
mitea1 0:f2815503561f 48 public:
mitea1 0:f2815503561f 49 ApplicationConfig();
mitea1 0:f2815503561f 50 virtual ~ApplicationConfig();
mitea1 0:f2815503561f 51
mitea1 0:f2815503561f 52 /**
mitea1 0:f2815503561f 53 * @brief Generates a configuration according to the chosen APPLICATION_MODE
mitea1 0:f2815503561f 54 * @param desiredMode the mode to build the configuration according to
mitea1 0:f2815503561f 55 */
mitea1 0:f2815503561f 56 void build(APPLICATION_MODE desiredMode);
mitea1 0:f2815503561f 57
mitea1 0:f2815503561f 58
mitea1 0:f2815503561f 59 /**
mitea1 0:f2815503561f 60 * @brief Get Information about the MAX44009_MODE of the actual ApplicationConfig
mitea1 0:f2815503561f 61 * @return the actual MAX44009_MODE
mitea1 0:f2815503561f 62 */
mitea1 0:f2815503561f 63 MAX44009_MODE getMAX44009_MODE();
mitea1 0:f2815503561f 64
mitea1 0:f2815503561f 65 /**
mitea1 0:f2815503561f 66 * @brief Get Information about the BME280_MODE of the actual ApplicationConfig
mitea1 0:f2815503561f 67 * @return the actual BME280_MODE
mitea1 0:f2815503561f 68 */
mitea1 0:f2815503561f 69 BME280_MODE getBME280_MODE();
mitea1 0:f2815503561f 70
mitea1 0:f2815503561f 71 /**
mitea1 0:f2815503561f 72 * @brief Get Information about the MPU9250_MODE of the actual ApplicationConfig
mitea1 0:f2815503561f 73 * @return the actual MPU9250_MODE
mitea1 0:f2815503561f 74 */
mitea1 0:f2815503561f 75 MPU9250_MODE getMPU9250_MODE();
mitea1 0:f2815503561f 76
mitea1 0:f2815503561f 77 /**
mitea1 0:f2815503561f 78 * @brief Get Information about the SI1143_MODE of the actual ApplicationConfig
mitea1 0:f2815503561f 79 * @return the actual SI1143_MODE
mitea1 0:f2815503561f 80 */
mitea1 0:f2815503561f 81 SI1143_MODE getSI1143_MODE();
mitea1 0:f2815503561f 82
mitea1 0:f2815503561f 83 /**
mitea1 0:f2815503561f 84 * @brief Get Information about the uBLOX_MODE of the actual ApplicationConfig
mitea1 0:f2815503561f 85 * @return the actual uBLOX_MODE
mitea1 0:f2815503561f 86 */
mitea1 0:f2815503561f 87 uBLOX_MODE getuBlox_MODE();
mitea1 0:f2815503561f 88
mitea1 0:f2815503561f 89 /**
mitea1 0:f2815503561f 90 * @brief Get Information about the LORA_MODE of the actual ApplicationConfig
mitea1 0:f2815503561f 91 * @return the actual LORA_MODE
mitea1 0:f2815503561f 92 */
mitea1 0:f2815503561f 93 LORA_MODE getLORA_MODE();
mitea1 0:f2815503561f 94
mitea1 0:f2815503561f 95
mitea1 0:f2815503561f 96 /**
mitea1 0:f2815503561f 97 * @brief Get Information about the TASK_STATE of the TaskLight in the actual ApplicationConfig
mitea1 0:f2815503561f 98 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskLight
mitea1 0:f2815503561f 99 */
mitea1 0:f2815503561f 100 TASK_STATE getStateTaskLight();
mitea1 0:f2815503561f 101
mitea1 0:f2815503561f 102 /**
mitea1 0:f2815503561f 103 * @brief Get Information about the TASK_STATE of the TaskTemperature in the actual ApplicationConfig
mitea1 0:f2815503561f 104 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskTemperature
mitea1 0:f2815503561f 105 */
mitea1 0:f2815503561f 106 TASK_STATE getStateTaskTemperature();
mitea1 0:f2815503561f 107
mitea1 0:f2815503561f 108 /**
mitea1 0:f2815503561f 109 * @brief Get Information about the TASK_STATE of the TaskPressure in the actual ApplicationConfig
mitea1 0:f2815503561f 110 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskPressure
mitea1 0:f2815503561f 111 */
mitea1 0:f2815503561f 112 TASK_STATE getStateTaskPressure();
mitea1 0:f2815503561f 113
mitea1 0:f2815503561f 114 /**
mitea1 0:f2815503561f 115 * @brief Get Information about the TASK_STATE of the TaskHumidity in the actual ApplicationConfig
mitea1 0:f2815503561f 116 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskHumidity
mitea1 0:f2815503561f 117 */
mitea1 0:f2815503561f 118 TASK_STATE getStateTaskHumidity();
mitea1 0:f2815503561f 119
mitea1 0:f2815503561f 120 /**
mitea1 0:f2815503561f 121 * @brief Get Information about the TASK_STATE of the TaskAcceleration in the actual ApplicationConfig
mitea1 0:f2815503561f 122 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskAcceleration
mitea1 0:f2815503561f 123 */
mitea1 0:f2815503561f 124 TASK_STATE getStateTaskAcceleration();
mitea1 0:f2815503561f 125
mitea1 0:f2815503561f 126 /**
mitea1 0:f2815503561f 127 * @brief Get Information about the TASK_STATE of the TaskGyroscope in the actual ApplicationConfig
mitea1 0:f2815503561f 128 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskGyroscope
mitea1 0:f2815503561f 129 */
mitea1 0:f2815503561f 130 TASK_STATE getStateTaskGyroscope();
mitea1 0:f2815503561f 131
mitea1 0:f2815503561f 132 /**
mitea1 0:f2815503561f 133 * @brief Get Information about the TASK_STATE of the TaskTesla in the actual ApplicationConfig
mitea1 0:f2815503561f 134 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskTesla
mitea1 0:f2815503561f 135 */
mitea1 0:f2815503561f 136 TASK_STATE getStateTaskTesla();
mitea1 0:f2815503561f 137
mitea1 0:f2815503561f 138 /**
mitea1 0:f2815503561f 139 * @brief Get Information about the TASK_STATE of the TaskProximity in the actual ApplicationConfig
mitea1 0:f2815503561f 140 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskProximity
mitea1 0:f2815503561f 141 */
mitea1 0:f2815503561f 142 TASK_STATE getStateTaskProximity();
mitea1 0:f2815503561f 143
mitea1 0:f2815503561f 144 /**
mitea1 0:f2815503561f 145 * @brief Get Information about the TASK_STATE of the TaskGPS in the actual ApplicationConfig
mitea1 0:f2815503561f 146 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskGPS
mitea1 0:f2815503561f 147 */
mitea1 0:f2815503561f 148 TASK_STATE getStateTaskGPS();
mitea1 0:f2815503561f 149
mitea1 0:f2815503561f 150 /**
mitea1 9:c4e378f4801d 151 * @brief Get Information about the TASK_STATE of the TaskFlowMeter in the actual ApplicationConfig
mitea1 9:c4e378f4801d 152 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskFlowMeter
mitea1 9:c4e378f4801d 153 */
mitea1 9:c4e378f4801d 154 TASK_STATE getStateTaskFlowMeter();
mitea1 9:c4e378f4801d 155
mitea1 9:c4e378f4801d 156 /**
mitea1 0:f2815503561f 157 * @brief Get Information about the TASK_STATE of the TaskLoRaMeasurement in the actual ApplicationConfig
mitea1 0:f2815503561f 158 * @return the actual TASK_STATE (RUNNING,SLEEPING) of TaskLoRaMeasurement
mitea1 0:f2815503561f 159 */
mitea1 0:f2815503561f 160 TASK_STATE getStateTaskLoRaMeasurement();
mitea1 0:f2815503561f 161
mitea1 0:f2815503561f 162 /**
mitea1 0:f2815503561f 163 * @brief Get Information about the LORA_STATE of the LoRa Module in the actual ApplicationConfig
mitea1 0:f2815503561f 164 * @return the actual LORA_STATE (ON,OFF) of TaskLoRaMeasurement
mitea1 0:f2815503561f 165 */
mitea1 0:f2815503561f 166 LORA_STATE getStateLoRa();
mitea1 0:f2815503561f 167
mitea1 0:f2815503561f 168 private:
mitea1 0:f2815503561f 169 MAX44009_MODE max44009Mode;
mitea1 0:f2815503561f 170 BME280_MODE bme280Mode;
mitea1 0:f2815503561f 171 MPU9250_MODE mpu9250Mode;
mitea1 0:f2815503561f 172 SI1143_MODE si1143Mode;
mitea1 0:f2815503561f 173 uBLOX_MODE ubloxMode;
mitea1 0:f2815503561f 174 LORA_MODE loraMode;
mitea1 9:c4e378f4801d 175 //todo add Flowmeter Mode
mitea1 0:f2815503561f 176
mitea1 0:f2815503561f 177 TASK_STATE stateTaskLight;
mitea1 0:f2815503561f 178 TASK_STATE stateTaskTemperature;
mitea1 0:f2815503561f 179 TASK_STATE stateTaskPressure;
mitea1 0:f2815503561f 180 TASK_STATE stateTaskHumidity;
mitea1 0:f2815503561f 181 TASK_STATE stateTaskAcceleration;
mitea1 0:f2815503561f 182 TASK_STATE stateTaskGyroscope;
mitea1 0:f2815503561f 183 TASK_STATE stateTaskTesla;
mitea1 0:f2815503561f 184 TASK_STATE stateTaskProximity;
mitea1 0:f2815503561f 185 TASK_STATE stateTaskGPS;
mitea1 9:c4e378f4801d 186 TASK_STATE stateTaskFlowMeter;
mitea1 0:f2815503561f 187 TASK_STATE stateTaskLoraMeasurement;
mitea1 0:f2815503561f 188
mitea1 0:f2815503561f 189 LORA_STATE stateLoRa;
mitea1 0:f2815503561f 190
mitea1 0:f2815503561f 191 /**
mitea1 0:f2815503561f 192 * @brief Sets the MAX44009_MODE for that the MAX44009 Sensor has to be initialized for the actual ApplicationConfig
mitea1 0:f2815503561f 193 * @param the diseredMode
mitea1 0:f2815503561f 194 */
mitea1 0:f2815503561f 195 void setMAX44009_MODE(MAX44009_MODE desiredMode);
mitea1 0:f2815503561f 196
mitea1 0:f2815503561f 197 /**
mitea1 0:f2815503561f 198 * @brief Sets the BME280_MODE for that the BME280 Sensor has to be initialized for the actual ApplicationConfig
mitea1 0:f2815503561f 199 * @param the diseredMode
mitea1 0:f2815503561f 200 */
mitea1 0:f2815503561f 201 void setBME280_MODE(BME280_MODE desiredMode);
mitea1 0:f2815503561f 202
mitea1 0:f2815503561f 203 /**
mitea1 0:f2815503561f 204 * @brief Sets the MPU9250_MODE for that the MPU9250 Sensor has to be initialized for the actual ApplicationConfig
mitea1 0:f2815503561f 205 * @param the diseredMode
mitea1 0:f2815503561f 206 */
mitea1 0:f2815503561f 207 void setMPU9250_MODE(MPU9250_MODE desiredMode);
mitea1 0:f2815503561f 208
mitea1 0:f2815503561f 209 /**
mitea1 0:f2815503561f 210 * @brief Sets the SI1143_MODE for that the SI1143 Sensor has to be initialized for the actual ApplicationConfig
mitea1 0:f2815503561f 211 * @param the diseredMode
mitea1 0:f2815503561f 212 */
mitea1 0:f2815503561f 213 void setSI1143_MODE(SI1143_MODE desiredMode);
mitea1 0:f2815503561f 214
mitea1 0:f2815503561f 215 /**
mitea1 0:f2815503561f 216 * @brief Sets the uBLOX_MODE for that the uBlox Sensor has to be initialized for the actual ApplicationConfig
mitea1 0:f2815503561f 217 * @param the diseredMode
mitea1 0:f2815503561f 218 */
mitea1 0:f2815503561f 219 void setuBlox_MODE(uBLOX_MODE desiredMode);
mitea1 0:f2815503561f 220
mitea1 9:c4e378f4801d 221 //todo add setFlowMeterMode
mitea1 9:c4e378f4801d 222
mitea1 0:f2815503561f 223 /**
mitea1 0:f2815503561f 224 * @brief Sets the LORA_MODE for that the LORA device has to be initialized for the actual ApplicationConfig
mitea1 0:f2815503561f 225 * @param the diseredMode
mitea1 0:f2815503561f 226 */
mitea1 0:f2815503561f 227 void setLORA_MODE(LORA_MODE desiredMode);
mitea1 0:f2815503561f 228
mitea1 0:f2815503561f 229
mitea1 0:f2815503561f 230 /**
mitea1 0:f2815503561f 231 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskLight for the actual ApplicationConfig
mitea1 0:f2815503561f 232 * @param the desired State
mitea1 0:f2815503561f 233 */
mitea1 0:f2815503561f 234 void setStateTaskLight(TASK_STATE desiredState);
mitea1 0:f2815503561f 235
mitea1 0:f2815503561f 236 /**
mitea1 0:f2815503561f 237 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskTemperature for the actual ApplicationConfig
mitea1 0:f2815503561f 238 * @param the desired State
mitea1 0:f2815503561f 239 */
mitea1 0:f2815503561f 240 void setStateTaskTemperature(TASK_STATE desiredState);
mitea1 0:f2815503561f 241
mitea1 0:f2815503561f 242 /**
mitea1 0:f2815503561f 243 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskPressure for the actual ApplicationConfig
mitea1 0:f2815503561f 244 * @param the desired State
mitea1 0:f2815503561f 245 */
mitea1 0:f2815503561f 246 void setStateTaskPressure(TASK_STATE desiredState);
mitea1 0:f2815503561f 247
mitea1 0:f2815503561f 248 /**
mitea1 0:f2815503561f 249 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskHumidity for the actual ApplicationConfig
mitea1 0:f2815503561f 250 * @param the desired State
mitea1 0:f2815503561f 251 */
mitea1 0:f2815503561f 252 void setStateTaskHumidity(TASK_STATE desiredState);
mitea1 0:f2815503561f 253
mitea1 0:f2815503561f 254 /**
mitea1 0:f2815503561f 255 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskAcceleration for the actual ApplicationConfig
mitea1 0:f2815503561f 256 * @param the desired State
mitea1 0:f2815503561f 257 */
mitea1 0:f2815503561f 258 void setStateTaskAcceleration(TASK_STATE desiredState);
mitea1 0:f2815503561f 259
mitea1 0:f2815503561f 260 /**
mitea1 0:f2815503561f 261 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskGyroscope for the actual ApplicationConfig
mitea1 0:f2815503561f 262 * @param the desired State
mitea1 0:f2815503561f 263 */
mitea1 0:f2815503561f 264 void setStateTaskGyroscope(TASK_STATE desiredState);
mitea1 0:f2815503561f 265
mitea1 0:f2815503561f 266 /**
mitea1 0:f2815503561f 267 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskTesla for the actual ApplicationConfig
mitea1 0:f2815503561f 268 * @param the desired State
mitea1 0:f2815503561f 269 */
mitea1 0:f2815503561f 270 void setStateTaskTesla(TASK_STATE desiredState);
mitea1 0:f2815503561f 271
mitea1 0:f2815503561f 272 /**
mitea1 0:f2815503561f 273 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskProximity for the actual ApplicationConfig
mitea1 0:f2815503561f 274 * @param the desired State
mitea1 0:f2815503561f 275 */
mitea1 0:f2815503561f 276 void setStateTaskProximity(TASK_STATE desiredState);
mitea1 0:f2815503561f 277
mitea1 0:f2815503561f 278 /**
mitea1 0:f2815503561f 279 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskGPS for the actual ApplicationConfig
mitea1 0:f2815503561f 280 * @param the desired State
mitea1 0:f2815503561f 281 */
mitea1 0:f2815503561f 282 void setStateTaskGPS(TASK_STATE desiredState);
mitea1 0:f2815503561f 283
mitea1 0:f2815503561f 284 /**
mitea1 9:c4e378f4801d 285 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskFlowMeter for the actual ApplicationConfig
mitea1 9:c4e378f4801d 286 * @param the desired State
mitea1 9:c4e378f4801d 287 */
mitea1 9:c4e378f4801d 288 void setStateTaskFlowMeter(TASK_STATE desiredState);
mitea1 9:c4e378f4801d 289
mitea1 9:c4e378f4801d 290 /**
mitea1 0:f2815503561f 291 * @brief Sets the TASK_STATE (RUNNING,SLEEPING) of TaskLoRaMeasurement for the actual ApplicationConfig
mitea1 0:f2815503561f 292 * @param the desired State
mitea1 0:f2815503561f 293 */
mitea1 0:f2815503561f 294 void setStateTaskLoRaMeasurement(TASK_STATE desiredState);
mitea1 0:f2815503561f 295 /**
mitea1 0:f2815503561f 296 * @brief Sets the LORA_STATE (ON,OFF) of LoRa Device for the actual ApplicationConfig
mitea1 0:f2815503561f 297 * @param the desired State
mitea1 0:f2815503561f 298 */
mitea1 0:f2815503561f 299 void setStateLoRa(LORA_STATE);
mitea1 0:f2815503561f 300
mitea1 0:f2815503561f 301 };
mitea1 0:f2815503561f 302
mitea1 0:f2815503561f 303 #endif /* APPLICATIONCONFIG_H_ */