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.cpp
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
mitea1 6:90655031d4f7 8 #include "Task.h"
mitea1 6:90655031d4f7 9
mitea1 6:90655031d4f7 10 Task::Task() {
mitea1 6:90655031d4f7 11 // TODO Auto-generated constructor stub
mitea1 6:90655031d4f7 12
mitea1 6:90655031d4f7 13 }
mitea1 6:90655031d4f7 14
mitea1 6:90655031d4f7 15 Task::~Task() {
mitea1 6:90655031d4f7 16 // TODO Auto-generated destructor stub
mitea1 6:90655031d4f7 17 }
mitea1 6:90655031d4f7 18
mitea1 6:90655031d4f7 19 osStatus Task::start(){
mitea1 6:90655031d4f7 20 setState(RUNNING);
mitea1 6:90655031d4f7 21 this->thread = new rtos::Thread(callBack,this);
mitea1 6:90655031d4f7 22 }
mitea1 6:90655031d4f7 23
mitea1 6:90655031d4f7 24 osStatus Task::stop(){
mitea1 6:90655031d4f7 25 thread->terminate();
mitea1 6:90655031d4f7 26 setState(SLEEPING);
mitea1 6:90655031d4f7 27 delete this->thread;
mitea1 6:90655031d4f7 28 }
mitea1 6:90655031d4f7 29
mitea1 6:90655031d4f7 30 void Task::callBack(void const* data){
mitea1 6:90655031d4f7 31 // WOODHAMMER METHOD of Casting!
mitea1 6:90655031d4f7 32 const Task* constInstance = static_cast<const Task* >(data);
mitea1 6:90655031d4f7 33 Task* instance = const_cast<Task*>(constInstance);
mitea1 6:90655031d4f7 34
mitea1 6:90655031d4f7 35 instance->measure();
mitea1 6:90655031d4f7 36 }
mitea1 6:90655031d4f7 37
mitea1 6:90655031d4f7 38 void Task::attachIdleHook(void (*fptr) (void)){
mitea1 6:90655031d4f7 39 this->thread->attach_idle_hook(fptr);
mitea1 6:90655031d4f7 40 }
mitea1 6:90655031d4f7 41
mitea1 6:90655031d4f7 42 void Task::setMutex(Mutex* mutex){
mitea1 6:90655031d4f7 43 this->mutexInterface = mutex;
mitea1 6:90655031d4f7 44 }
mitea1 6:90655031d4f7 45
mitea1 6:90655031d4f7 46 void Task::setPriority(osPriority priority){
mitea1 6:90655031d4f7 47 this->priority = priority;
mitea1 6:90655031d4f7 48 }
mitea1 6:90655031d4f7 49
mitea1 6:90655031d4f7 50 void Task::setStackSize(uint32_t stacksize){
mitea1 6:90655031d4f7 51 this->stack_size = stacksize;
mitea1 6:90655031d4f7 52 }
mitea1 6:90655031d4f7 53
mitea1 6:90655031d4f7 54 void Task::setStackPointer(unsigned char* stackPointer){
mitea1 6:90655031d4f7 55 this->stack_pointer = stackPointer;
mitea1 6:90655031d4f7 56 }
mitea1 6:90655031d4f7 57
mitea1 6:90655031d4f7 58 void Task::setState(TASK_STATE state){
mitea1 6:90655031d4f7 59 this->state = state;
mitea1 6:90655031d4f7 60 }
mitea1 6:90655031d4f7 61
mitea1 6:90655031d4f7 62 TASK_STATE Task::getState(){
mitea1 6:90655031d4f7 63 return state;
mitea1 6:90655031d4f7 64 }
mitea1 6:90655031d4f7 65