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

Revision:
0:f2815503561f
Child:
4:2674bd4168f8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/TaskLight.h	Wed Jul 06 20:40:36 2016 +0000
@@ -0,0 +1,115 @@
+/**
+ * @file TaskLight.h
+ *
+ * @author Adrian
+ * @date 27.05.2016
+ *
+ */
+
+#include <Thread.h>
+#include <Queue.h>
+#include <Mutex.h>
+#include "MAX44009.h"
+#include "MAX44009Message.h"
+#include "main.h"
+
+#ifndef TASKLIGHT_H_
+#define TASKLIGHT_H_
+
+/**
+ * @class TaskLight
+ * @brief This TaskLight Class handles the light measurement using the MAX44009.
+ * Starting the task using the start() starts the measurement.
+ * It can be used alongside with other measurement Tasks inside the mbed::rtos
+ * environment. The Task Class basically wraps mbeds Thread functionality.
+ */
+class TaskLight{
+public:
+	TaskLight(MAX44009*,Mutex*, Queue<MAX44009Message,LIGHT_QUEUE_LENGHT>*);
+	TaskLight(MAX44009*,Mutex*,Queue<MAX44009Message,LIGHT_QUEUE_LENGHT>*,
+			osPriority, uint32_t, unsigned char*);
+	virtual ~TaskLight();
+
+	/**
+	 * Starts the task by building and its measurement
+	 * @return
+	 */
+	osStatus start();
+
+	/**
+	 * Stops the task. Should only be used after start() was used
+	 * @return
+	 */
+	osStatus stop();
+
+
+	/**
+	 * Gets the actual state of the Task either RUNNING or SLEEPING
+	 * @return
+	 */
+	TASK_STATE getState();
+
+private:
+	rtos::Thread* thread;
+	rtos::Queue<MAX44009Message,LIGHT_QUEUE_LENGHT>* queue;
+	rtos::Mutex* mutexI2C ;
+	osPriority priority;
+	uint32_t stack_size;
+	unsigned char *stack_pointer;
+
+	TASK_STATE state;
+
+	MAX44009* max44009;
+
+	/**
+	 * @brief A Callback function thats called by the mbed::Thread of this TaskClass
+	 * @param
+	 */
+	static void callBack(void const *);
+
+	/**
+	 * @brief A thread safe method that measures the light. After measuring the light
+	 * it stores the value inside a MAX44009Message
+	 */
+	void measureLight();
+
+
+	/**
+	 * @brief Sets the message Queue of the Task where the measured values will be stored
+	 * after the measurement
+	 * @param queueLight the queue where the MAX44009Message will be stored
+	 */
+	void setQueue(Queue<MAX44009Message,LIGHT_QUEUE_LENGHT>* queueLight);
+
+	/**
+	 * @brief Sets the mutex thats used for a thread safe measurement
+	 * @param mutexI2C the I2C mutex
+	 */
+	void setMutex(Mutex* mutexI2C);
+
+	/**
+	 * @brief Sets the priority of the Task
+	 * @param priority priority of the Task
+	 */
+	void setPriority(osPriority priority);
+
+	/**
+	 * @brief Sets the size of the Task
+	 * @param stackSize the stack size in Bytes
+	 */
+	void setStackSize(uint32_t stackSize);
+
+	/**
+	 * @brief Sets the stack pointer of for the task stack
+	 * @param stackPointer
+	 */
+	void setStackPointer(unsigned char* stackPointer);
+
+	/**
+	 * @brief Sets the actual state of the Task.
+	 * @param taskState either RUNNING or SLEEPING
+	 */
+	void setState(TASK_STATE taskState);
+
+};
+#endif /* TASKLIGHT_H_ */