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:
7:87cbeafdba06
wtf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 7:87cbeafdba06 1 /**
mitea1 7:87cbeafdba06 2 * @file TaskCommandHandler.h
mitea1 7:87cbeafdba06 3 *
mitea1 7:87cbeafdba06 4 * @author Adrian
mitea1 7:87cbeafdba06 5 * @date 11.09.2016
mitea1 7:87cbeafdba06 6 *
mitea1 7:87cbeafdba06 7 */
mitea1 7:87cbeafdba06 8
mitea1 7:87cbeafdba06 9 #ifndef TASKCOMMANDHANDLER_H_
mitea1 7:87cbeafdba06 10 #define TASKCOMMANDHANDLER_H_
mitea1 7:87cbeafdba06 11
mitea1 7:87cbeafdba06 12 #include <Thread.h>
mitea1 7:87cbeafdba06 13 #include <Queue.h>
mitea1 7:87cbeafdba06 14 #include <Mutex.h>
mitea1 7:87cbeafdba06 15 #include "LoRa.h"
mitea1 7:87cbeafdba06 16 #include "MAX44009Message.h"
mitea1 7:87cbeafdba06 17 #include "CommandMessage.h"
mitea1 7:87cbeafdba06 18 #include "main.h"
mitea1 7:87cbeafdba06 19
mitea1 7:87cbeafdba06 20 /**
mitea1 7:87cbeafdba06 21 * @class TaskCommandHandler
mitea1 7:87cbeafdba06 22 * @brief This TaskCommandHandler Class handles all the received Commands from LoRa
mitea1 7:87cbeafdba06 23 */
mitea1 7:87cbeafdba06 24 class TaskCommandHandler {
mitea1 7:87cbeafdba06 25 public:
mitea1 7:87cbeafdba06 26
mitea1 7:87cbeafdba06 27 TaskCommandHandler(Queue<CommandMessage,COMMAND_QUEUE_LENGHT>*,
mitea1 7:87cbeafdba06 28 osPriority, uint32_t, unsigned char*);
mitea1 7:87cbeafdba06 29 virtual ~TaskCommandHandler();
mitea1 7:87cbeafdba06 30 /**
mitea1 7:87cbeafdba06 31 * @brief Starts the task by building it and connecting a callback function to
mitea1 7:87cbeafdba06 32 * the mbed::Thread
mitea1 7:87cbeafdba06 33 * @return
mitea1 7:87cbeafdba06 34 */
mitea1 7:87cbeafdba06 35 osStatus start();
mitea1 7:87cbeafdba06 36
mitea1 7:87cbeafdba06 37 /**
mitea1 7:87cbeafdba06 38 * @brief Stops the task. Should only be used after start() was used
mitea1 7:87cbeafdba06 39 * @return
mitea1 7:87cbeafdba06 40 */
mitea1 7:87cbeafdba06 41 osStatus stop();
mitea1 7:87cbeafdba06 42
mitea1 7:87cbeafdba06 43
mitea1 7:87cbeafdba06 44 /**
mitea1 7:87cbeafdba06 45 * @brief Gets the actual state of the Task either RUNNING or SLEEPING
mitea1 7:87cbeafdba06 46 * @return
mitea1 7:87cbeafdba06 47 */
mitea1 7:87cbeafdba06 48 TASK_STATE getState();
mitea1 7:87cbeafdba06 49
mitea1 7:87cbeafdba06 50
mitea1 7:87cbeafdba06 51 /**
mitea1 7:87cbeafdba06 52 * @brief Set a serial interface thats used for debugging the datastream which
mitea1 7:87cbeafdba06 53 * will be sent via LoRa and to show data handling relevant information
mitea1 7:87cbeafdba06 54 * @param debugSerial the Serial interface used to show information
mitea1 7:87cbeafdba06 55 */
mitea1 7:87cbeafdba06 56 void setDebugSerial(RawSerial* debugSerial);
mitea1 7:87cbeafdba06 57
mitea1 7:87cbeafdba06 58 private:
mitea1 7:87cbeafdba06 59 Thread* thread;
mitea1 7:87cbeafdba06 60 RawSerial* debugSerial;
mitea1 7:87cbeafdba06 61 rtos::Queue<CommandMessage,COMMAND_QUEUE_LENGHT>* queue;
mitea1 7:87cbeafdba06 62
mitea1 7:87cbeafdba06 63 osPriority priority;
mitea1 7:87cbeafdba06 64 uint32_t stack_size;
mitea1 7:87cbeafdba06 65 unsigned char *stack_pointer;
mitea1 7:87cbeafdba06 66
mitea1 7:87cbeafdba06 67 TASK_STATE state;
mitea1 7:87cbeafdba06 68
mitea1 7:87cbeafdba06 69 osEvent commandReceiveEvent;
mitea1 7:87cbeafdba06 70
mitea1 7:87cbeafdba06 71
mitea1 7:87cbeafdba06 72 /**
mitea1 7:87cbeafdba06 73 * @brief A Callback function thats called by the mbed::Thread of this TaskClass
mitea1 7:87cbeafdba06 74 * @param
mitea1 7:87cbeafdba06 75 */
mitea1 7:87cbeafdba06 76 static void callBack(void const *);
mitea1 7:87cbeafdba06 77
mitea1 7:87cbeafdba06 78 /**
mitea1 7:87cbeafdba06 79 * @brief Attaches the idle_hook for this task
mitea1 7:87cbeafdba06 80 * @param
mitea1 7:87cbeafdba06 81 */
mitea1 7:87cbeafdba06 82 void attachIdleHook(void (*fptr) (void));
mitea1 7:87cbeafdba06 83
mitea1 7:87cbeafdba06 84 /**
mitea1 7:87cbeafdba06 85 * @brief A method thats handling the data which was acquired and stored into
mitea1 7:87cbeafdba06 86 * Message Queues
mitea1 7:87cbeafdba06 87 */
mitea1 7:87cbeafdba06 88 void handleCommands();
mitea1 7:87cbeafdba06 89
mitea1 7:87cbeafdba06 90 /**
mitea1 7:87cbeafdba06 91 * @brief Checks all queues for available data and gets it.
mitea1 7:87cbeafdba06 92 */
mitea1 7:87cbeafdba06 93 void getCommandMessages();
mitea1 7:87cbeafdba06 94
mitea1 7:87cbeafdba06 95 /**
mitea1 7:87cbeafdba06 96 * @brief Processes received commands from command Queue
mitea1 7:87cbeafdba06 97 */
mitea1 7:87cbeafdba06 98 void processCommands();
mitea1 7:87cbeafdba06 99
mitea1 7:87cbeafdba06 100
mitea1 7:87cbeafdba06 101 /**
mitea1 7:87cbeafdba06 102 * @brief Sets the message Queue of the Task where the received commands are stored
mitea1 7:87cbeafdba06 103 * after the reception via LoRa
mitea1 7:87cbeafdba06 104 * @param queueCommand the queue where the CommandMessage will be stored
mitea1 7:87cbeafdba06 105 */
mitea1 7:87cbeafdba06 106 void setQueue(Queue<CommandMessage,COMMAND_QUEUE_LENGHT>* queueCommand);
mitea1 7:87cbeafdba06 107
mitea1 7:87cbeafdba06 108 /**
mitea1 7:87cbeafdba06 109 * @brief Sets the priority of the Task
mitea1 7:87cbeafdba06 110 * @param priority priority of the Task
mitea1 7:87cbeafdba06 111 */
mitea1 7:87cbeafdba06 112 void setPriority(osPriority priority);
mitea1 7:87cbeafdba06 113
mitea1 7:87cbeafdba06 114 /**
mitea1 7:87cbeafdba06 115 * @brief Sets the size of the Task
mitea1 7:87cbeafdba06 116 * @param stackSize the stack size in Bytes
mitea1 7:87cbeafdba06 117 */
mitea1 7:87cbeafdba06 118 void setStackSize(uint32_t stackSize);
mitea1 7:87cbeafdba06 119
mitea1 7:87cbeafdba06 120 /**
mitea1 7:87cbeafdba06 121 * @brief Sets the stack pointer of for the task stack
mitea1 7:87cbeafdba06 122 * @param stackPointer
mitea1 7:87cbeafdba06 123 */
mitea1 7:87cbeafdba06 124 void setStackPointer(unsigned char* stackPointer);
mitea1 7:87cbeafdba06 125
mitea1 7:87cbeafdba06 126 /**
mitea1 7:87cbeafdba06 127 * @brief Sets the actual state of the Task.
mitea1 7:87cbeafdba06 128 * @param taskState either RUNNING or SLEEPING
mitea1 7:87cbeafdba06 129 */
mitea1 7:87cbeafdba06 130 void setState(TASK_STATE taskState);
mitea1 7:87cbeafdba06 131
mitea1 7:87cbeafdba06 132 };
mitea1 7:87cbeafdba06 133
mitea1 7:87cbeafdba06 134 #endif /* TASKCOMMANDHANDLER_H_ */