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:
Sat Sep 10 11:23:35 2016 +0000
Revision:
6:90655031d4f7
Base Task Class added and inheritance from Task Class implemented for other TaskClasses

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 6:90655031d4f7 1 /*
mitea1 6:90655031d4f7 2 * Task.h
mitea1 6:90655031d4f7 3 *
mitea1 6:90655031d4f7 4 * Created on: Sep 9, 2016
mitea1 6:90655031d4f7 5 * Author: Adrian
mitea1 6:90655031d4f7 6 */
mitea1 6:90655031d4f7 7 #include "main.h"
mitea1 6:90655031d4f7 8
mitea1 6:90655031d4f7 9 #ifndef TASK_H_
mitea1 6:90655031d4f7 10 #define TASK_H_
mitea1 6:90655031d4f7 11
mitea1 6:90655031d4f7 12 class Task {
mitea1 6:90655031d4f7 13 public:
mitea1 6:90655031d4f7 14 Task();
mitea1 6:90655031d4f7 15 virtual ~Task();
mitea1 6:90655031d4f7 16
mitea1 6:90655031d4f7 17 /**
mitea1 6:90655031d4f7 18 * Starts the task by building and its measurement
mitea1 6:90655031d4f7 19 * @return
mitea1 6:90655031d4f7 20 */
mitea1 6:90655031d4f7 21 osStatus start();
mitea1 6:90655031d4f7 22
mitea1 6:90655031d4f7 23 /**
mitea1 6:90655031d4f7 24 * Stops the task. Should only be used after start() was used
mitea1 6:90655031d4f7 25 * @return
mitea1 6:90655031d4f7 26 */
mitea1 6:90655031d4f7 27 osStatus stop();
mitea1 6:90655031d4f7 28
mitea1 6:90655031d4f7 29
mitea1 6:90655031d4f7 30 /**
mitea1 6:90655031d4f7 31 * Gets the actual state of the Task either RUNNING or SLEEPING
mitea1 6:90655031d4f7 32 * @return
mitea1 6:90655031d4f7 33 */
mitea1 6:90655031d4f7 34 TASK_STATE getState();
mitea1 6:90655031d4f7 35
mitea1 6:90655031d4f7 36 protected:
mitea1 6:90655031d4f7 37 rtos::Thread* thread;
mitea1 6:90655031d4f7 38 rtos::Mutex* mutexInterface ;
mitea1 6:90655031d4f7 39 osPriority priority;
mitea1 6:90655031d4f7 40 uint32_t stack_size;
mitea1 6:90655031d4f7 41 unsigned char *stack_pointer;
mitea1 6:90655031d4f7 42
mitea1 6:90655031d4f7 43 TASK_STATE state;
mitea1 6:90655031d4f7 44
mitea1 6:90655031d4f7 45 /**
mitea1 6:90655031d4f7 46 * @brief A Callback function thats called by the mbed::Thread of this TaskClass
mitea1 6:90655031d4f7 47 * @param
mitea1 6:90655031d4f7 48 */
mitea1 6:90655031d4f7 49 static void callBack(void const *);
mitea1 6:90655031d4f7 50
mitea1 6:90655031d4f7 51 /**
mitea1 6:90655031d4f7 52 * @brief Attaches the idle_hook for this task
mitea1 6:90655031d4f7 53 * @param
mitea1 6:90655031d4f7 54 */
mitea1 6:90655031d4f7 55 void attachIdleHook(void (*fptr) (void));
mitea1 6:90655031d4f7 56
mitea1 6:90655031d4f7 57 /**
mitea1 6:90655031d4f7 58 * @brief A thread safe method that measures the acceleration. After measuring the acceleration
mitea1 6:90655031d4f7 59 * of each axis it stores the value inside a MPU9250AccelerationMessage
mitea1 6:90655031d4f7 60 */
mitea1 6:90655031d4f7 61 virtual void measure() = 0;
mitea1 6:90655031d4f7 62
mitea1 6:90655031d4f7 63
mitea1 6:90655031d4f7 64 /**
mitea1 6:90655031d4f7 65 * @brief Sets the mutex thats used for a thread safe measurement
mitea1 6:90655031d4f7 66 * @param mutexI2C the I2C mutex
mitea1 6:90655031d4f7 67 */
mitea1 6:90655031d4f7 68 void setMutex(Mutex* mutexI2C);
mitea1 6:90655031d4f7 69
mitea1 6:90655031d4f7 70 /**
mitea1 6:90655031d4f7 71 * @brief Sets the priority of the Task
mitea1 6:90655031d4f7 72 * @param priority priority of the Task
mitea1 6:90655031d4f7 73 */
mitea1 6:90655031d4f7 74 void setPriority(osPriority priority);
mitea1 6:90655031d4f7 75
mitea1 6:90655031d4f7 76 /**
mitea1 6:90655031d4f7 77 * @brief Sets the size of the Task
mitea1 6:90655031d4f7 78 * @param stackSize the stack size in Bytes
mitea1 6:90655031d4f7 79 */
mitea1 6:90655031d4f7 80 void setStackSize(uint32_t stackSize);
mitea1 6:90655031d4f7 81
mitea1 6:90655031d4f7 82 /**
mitea1 6:90655031d4f7 83 * @brief Sets the stack pointer of for the task stack
mitea1 6:90655031d4f7 84 * @param stackPointer
mitea1 6:90655031d4f7 85 */
mitea1 6:90655031d4f7 86 void setStackPointer(unsigned char* stackPointer);
mitea1 6:90655031d4f7 87
mitea1 6:90655031d4f7 88
mitea1 6:90655031d4f7 89 /**
mitea1 6:90655031d4f7 90 * @brief Sets the actual state of the Task
mitea1 6:90655031d4f7 91 * @param taskState either RUNNING or SLEEPING
mitea1 6:90655031d4f7 92 */
mitea1 6:90655031d4f7 93 void setState(TASK_STATE taskState);
mitea1 6:90655031d4f7 94 };
mitea1 6:90655031d4f7 95
mitea1 6:90655031d4f7 96 #endif /* TASK_H_ */