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
Application.h
00001 /* 00002 * Application.h 00003 * 00004 * Created on: Jun 3, 2016 00005 * Author: Adrian 00006 */ 00007 00008 #include "ApplicationConfig.h" 00009 #include "mbed.h" 00010 #include "rtos.h" 00011 #include "I2C_RT.h " 00012 #include "MAX44009.h " 00013 #include "BME280.h" 00014 #include "MPU9250.h " 00015 #include "SI1143.h " 00016 #include "uBlox.h " 00017 #include "FlowMeter.h" 00018 #include "mDot.h" 00019 #include "TaskLight.h " 00020 #include "TaskTemperature.h " 00021 #include "TaskHumidity.h" 00022 #include "TaskPressure.h " 00023 #include "TaskAcceleration.h " 00024 #include "TaskGyroscope.h " 00025 #include "TaskTesla.h " 00026 #include "TaskProximity.h " 00027 #include "TaskGPS.h " 00028 #include "TaskFlowMeter.h" 00029 #include "TaskLoRaMeasurement.h " 00030 #include "TaskDatahandler.h " 00031 #include "main.h" 00032 #include "LoRa.h " 00033 00034 #ifndef SENSORHANDLER_H_ 00035 #define SENSORHANDLER_H_ 00036 00037 class Application { 00038 public: 00039 Application(); 00040 virtual ~Application(); 00041 00042 /** 00043 * @brief Start the Application in the desired Mode 00044 * @return 00045 */ 00046 void init(APPLICATION_MODE desiredMode); 00047 00048 private: 00049 RawSerial* uart; 00050 RawSerial* debugSerial; 00051 I2C_RT* i2c_rt; 00052 InterruptIn* pulseInput; 00053 mDot* dot; 00054 LoRa* lora; 00055 00056 TaskLight* taskLight; 00057 TaskTemperature* taskTemperature; 00058 TaskPressure* taskPressure; 00059 TaskHumidity* taskHumidity; 00060 TaskAcceleration* taskAcceleration; 00061 TaskGyroscope* taskGyroscope; 00062 TaskTesla* taskTesla; 00063 TaskProximity* taskProximity; 00064 TaskGPS* taskGps; 00065 TaskFlowMeter* taskFlowMeter; 00066 TaskLoRaMeasurement* taskLoRaMeasurement; 00067 TaskDatahandler* taskDataHandler; 00068 00069 rtos::Mutex* mutexI2C; 00070 rtos::Mutex* mutexUART1; 00071 rtos::Mutex mutexBME280; 00072 rtos::Mutex mutexMAX44009; 00073 rtos::Mutex mutexMPU9250; 00074 rtos::Mutex mutexSi4103; 00075 rtos::Mutex mutexUBlox; 00076 rtos::Mutex* mutexFlowMeter; 00077 rtos::Mutex* mutexLoRa; 00078 00079 Queue<MAX44009Message,LIGHT_QUEUE_LENGHT> queueLight; 00080 Queue<BME280TemperatureMessage,TEMPERATURE_QUEUE_LENGHT> queueTemperature; 00081 Queue<BME280PressureMessage,PRESSURE_QUEUE_LENGHT> queuePressure; 00082 Queue<BME280HumidityMessage,HUMIDITY_QUEUE_LENGHT> queueHumidity; 00083 Queue<MPU9250AccelerationMessage,ACCELERATION_QUEUE_LENGHT> queueAcceleration; 00084 Queue<MPU9250GyroscopeMessage,GYROSCOPE_QUEUE_LENGHT> queueGyro; 00085 Queue<MPU9250TeslaMessage,TESLA_QUEUE_LENGHT> queueTesla; 00086 Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT> queueProximity; 00087 Queue<UBloxGPSMessage,GPS_QUEUE_LENGHT> queueGps; 00088 Queue<FlowMeterMessage,FLOWMETER_QUEUE_LENGTH> queueFlowMeter; 00089 Queue<LoRaMeasurementMessage,LORA_MEASUREMENT_QUEUE_LENGHT> queueLoRaMeasurements; 00090 Queue<CommandMessage,COMMAND_QUEUE_LENGHT> queueCommands; 00091 00092 QueueBundle queueBundle; 00093 00094 uBlox* gpsSensor; 00095 MAX44009* max44009; 00096 BME280* bme280; 00097 MPU9250* mpu9250; 00098 SI1143* si1143; 00099 FlowMeter* flowMeter; 00100 00101 ApplicationConfig* config; 00102 00103 /** 00104 * @brief Initializes all Interfaces such as I2C, UART and a Debug Serial via USB 00105 */ 00106 void initInterfaces(); 00107 00108 /** 00109 * @brief Initializes (builds) all Sensors in their specific modes 00110 */ 00111 void initSensors(); 00112 00113 /** 00114 * @brief Initializes (builds) all Tasks so that they are ready to run 00115 */ 00116 void initTasks(); 00117 00118 /** 00119 * @brief Initializes (builds) all Mutexes so that they are ready to be used 00120 */ 00121 void initMutexes(); 00122 00123 /** 00124 * @brief Initializes (builds) the ApplicationConfig which contains information about 00125 * which Task has to be run and how the sensors have to be configured 00126 */ 00127 void initApplicationConfig(); 00128 00129 /** 00130 * @brief Initializes (builds) the QueueBundle 00131 */ 00132 void initQueueBundle(); 00133 00134 /** 00135 * @brief Stops all tasks that are currently running. Used to define a defined state to start the application 00136 * in a new mode or when using a transition between two application modes it is neccessary to stop all task before 00137 * starting them again 00138 */ 00139 void stopAllRunningSensorTasks(); 00140 00141 /** 00142 * @brief Starts all task which are allowed to run by the Application Config 00143 */ 00144 void startRunnableSensorTasks(); 00145 00146 /** 00147 * @brief Configures and builds the sensors according to they SensorMode specific parameters 00148 */ 00149 void configureSensors(); 00150 00151 /** 00152 * @brief Configures and builds the LoRa Device according to its Mode specific parameters 00153 */ 00154 void configureLora(); 00155 00156 }; 00157 00158 #endif /* APPLICATION_H_ */
Generated on Tue Jul 12 2022 21:35:26 by 1.7.2