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 9:c4e378f4801d 1 /*
mitea1 9:c4e378f4801d 2 * TaskFlowMeter.h
mitea1 9:c4e378f4801d 3 *
mitea1 9:c4e378f4801d 4 * Created on: 23.10.2018
mitea1 9:c4e378f4801d 5 * Author: Adrian
mitea1 9:c4e378f4801d 6 */
mitea1 9:c4e378f4801d 7
mitea1 9:c4e378f4801d 8 #ifndef TASKS_TASKFLOWMETER_H_
mitea1 9:c4e378f4801d 9 #define TASKS_TASKFLOWMETER_H_
mitea1 9:c4e378f4801d 10
mitea1 9:c4e378f4801d 11 #include "FlowMeter.h"
mitea1 9:c4e378f4801d 12 #include "main.h"
mitea1 9:c4e378f4801d 13 #include "FlowMeterMessage.h"
mitea1 9:c4e378f4801d 14
mitea1 9:c4e378f4801d 15 class TaskFlowMeter{
mitea1 9:c4e378f4801d 16 public:
mitea1 9:c4e378f4801d 17 TaskFlowMeter(FlowMeter*, Mutex*, Queue<FlowMeterMessage,FLOWMETER_QUEUE_LENGTH>*);
mitea1 9:c4e378f4801d 18 TaskFlowMeter(FlowMeter*, Mutex*, Queue<FlowMeterMessage,FLOWMETER_QUEUE_LENGTH>*,
mitea1 9:c4e378f4801d 19 osPriority, uint32_t, unsigned char*);
mitea1 9:c4e378f4801d 20 virtual ~TaskFlowMeter();
mitea1 9:c4e378f4801d 21
mitea1 9:c4e378f4801d 22 /**
mitea1 9:c4e378f4801d 23 * Starts the task by building and its measurement
mitea1 9:c4e378f4801d 24 * @return
mitea1 9:c4e378f4801d 25 */
mitea1 9:c4e378f4801d 26 osStatus start();
mitea1 9:c4e378f4801d 27
mitea1 9:c4e378f4801d 28 /**
mitea1 9:c4e378f4801d 29 * Stops the task. Should only be used after start() was used
mitea1 9:c4e378f4801d 30 * @return
mitea1 9:c4e378f4801d 31 */
mitea1 9:c4e378f4801d 32 osStatus stop();
mitea1 9:c4e378f4801d 33
mitea1 9:c4e378f4801d 34
mitea1 9:c4e378f4801d 35 /**
mitea1 9:c4e378f4801d 36 * Gets the actual state of the Task either RUNNING or SLEEPING
mitea1 9:c4e378f4801d 37 * @return
mitea1 9:c4e378f4801d 38 */
mitea1 9:c4e378f4801d 39 TASK_STATE getState();
mitea1 9:c4e378f4801d 40 private:
mitea1 9:c4e378f4801d 41 rtos::Thread* thread;
mitea1 9:c4e378f4801d 42 rtos::Queue<FlowMeterMessage,FLOWMETER_QUEUE_LENGTH>* queue;
mitea1 9:c4e378f4801d 43 rtos::Mutex* mutexFlowMeter ;
mitea1 9:c4e378f4801d 44 osPriority priority;
mitea1 9:c4e378f4801d 45 uint32_t stack_size;
mitea1 9:c4e378f4801d 46 unsigned char *stack_pointer;
mitea1 9:c4e378f4801d 47
mitea1 9:c4e378f4801d 48 TASK_STATE state;
mitea1 9:c4e378f4801d 49
mitea1 9:c4e378f4801d 50 FlowMeter* flowMeter;
mitea1 9:c4e378f4801d 51
mitea1 9:c4e378f4801d 52
mitea1 9:c4e378f4801d 53 /**
mitea1 9:c4e378f4801d 54 * @brief A Callback function thats called by the mbed::Thread of this TaskClass
mitea1 9:c4e378f4801d 55 * @param
mitea1 9:c4e378f4801d 56 */
mitea1 9:c4e378f4801d 57 static void callBack(void const *);
mitea1 9:c4e378f4801d 58
mitea1 9:c4e378f4801d 59 /**
mitea1 9:c4e378f4801d 60 * @brief Attaches the idle_hook for this task
mitea1 9:c4e378f4801d 61 * @param
mitea1 9:c4e378f4801d 62 */
mitea1 9:c4e378f4801d 63 void attachIdleHook(void (*fptr) (void));
mitea1 9:c4e378f4801d 64
mitea1 9:c4e378f4801d 65 /**
mitea1 9:c4e378f4801d 66 * @brief Threadsafe method that measures actual flow
mitea1 9:c4e378f4801d 67 */
mitea1 9:c4e378f4801d 68 void measure();
mitea1 9:c4e378f4801d 69
mitea1 9:c4e378f4801d 70 /**
mitea1 9:c4e378f4801d 71 * @brief Sets the message Queue of the Task where the measured values will be stored
mitea1 9:c4e378f4801d 72 * after the measurement
mitea1 9:c4e378f4801d 73 * @param queueAcceleration the queue where the MPU9250AccelerationMessage will be stored
mitea1 9:c4e378f4801d 74 */
mitea1 9:c4e378f4801d 75 void setQueue(Queue<FlowMeterMessage,FLOWMETER_QUEUE_LENGTH>* queueFlowMeter);
mitea1 9:c4e378f4801d 76
mitea1 9:c4e378f4801d 77 /**
mitea1 9:c4e378f4801d 78 * @brief Sets the mutex thats used for a thread safe measurement
mitea1 9:c4e378f4801d 79 * @param mutexI2C the I2C mutex
mitea1 9:c4e378f4801d 80 */
mitea1 9:c4e378f4801d 81 void setMutex(Mutex* mutexI2C);
mitea1 9:c4e378f4801d 82
mitea1 9:c4e378f4801d 83 /**
mitea1 9:c4e378f4801d 84 * @brief Sets the priority of the Task
mitea1 9:c4e378f4801d 85 * @param priority priority of the Task
mitea1 9:c4e378f4801d 86 */
mitea1 9:c4e378f4801d 87 void setPriority(osPriority priority);
mitea1 9:c4e378f4801d 88
mitea1 9:c4e378f4801d 89 /**
mitea1 9:c4e378f4801d 90 * @brief Sets the size of the Task
mitea1 9:c4e378f4801d 91 * @param stackSize the stack size in Bytes
mitea1 9:c4e378f4801d 92 */
mitea1 9:c4e378f4801d 93 void setStackSize(uint32_t stackSize);
mitea1 9:c4e378f4801d 94
mitea1 9:c4e378f4801d 95 /**
mitea1 9:c4e378f4801d 96 * @brief Sets the stack pointer of for the task stack
mitea1 9:c4e378f4801d 97 * @param stackPointer
mitea1 9:c4e378f4801d 98 */
mitea1 9:c4e378f4801d 99 void setStackPointer(unsigned char* stackPointer);
mitea1 9:c4e378f4801d 100
mitea1 9:c4e378f4801d 101
mitea1 9:c4e378f4801d 102 /**
mitea1 9:c4e378f4801d 103 * @brief Sets the actual state of the Task
mitea1 9:c4e378f4801d 104 * @param taskState either RUNNING or SLEEPING
mitea1 9:c4e378f4801d 105 */
mitea1 9:c4e378f4801d 106 void setState(TASK_STATE taskState);
mitea1 9:c4e378f4801d 107 };
mitea1 9:c4e378f4801d 108
mitea1 9:c4e378f4801d 109 //todo implement all member function don't inherit
mitea1 9:c4e378f4801d 110 #endif /* TASKS_TASKFLOWMETER_H_ */