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:
0:f2815503561f
wtf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 0:f2815503561f 1 /**
mitea1 0:f2815503561f 2 * @file MAX44009Config.h
mitea1 0:f2815503561f 3 *
mitea1 0:f2815503561f 4 * @author Adrian
mitea1 0:f2815503561f 5 * @date 25.05.2016
mitea1 0:f2815503561f 6 *
mitea1 0:f2815503561f 7 */
mitea1 0:f2815503561f 8 #include <stdint.h>
mitea1 0:f2815503561f 9 #ifndef APP_MAX44009CONFIG_H_
mitea1 0:f2815503561f 10 #define APP_MAX44009CONFIG_H_
mitea1 0:f2815503561f 11
mitea1 0:f2815503561f 12 #define MAX_44009_CONTINOUS_MODE_ON 0b1
mitea1 0:f2815503561f 13 #define MAX_44009_CONTINOUS_MODE_OFF 0b0
mitea1 0:f2815503561f 14 #define MAX_44009_MANUAL_CONFIG_ON 0b1
mitea1 0:f2815503561f 15 #define MAX_44009_MANUAL_CONFIG_OFF 0b0
mitea1 0:f2815503561f 16
mitea1 0:f2815503561f 17 //Integration Times
mitea1 0:f2815503561f 18 #define MAX_44009_INTEGRATION_TIME_800_MS 0b000
mitea1 0:f2815503561f 19 #define MAX_44009_INTEGRATION_TIME_400_MS 0b001
mitea1 0:f2815503561f 20 #define MAX_44009_INTEGRATION_TIME_200_MS 0b010
mitea1 0:f2815503561f 21 #define MAX_44009_INTEGRATION_TIME_100_MS 0b011
mitea1 0:f2815503561f 22 #define MAX_44009_INTEGRATION_TIME_50_MS 0b100
mitea1 0:f2815503561f 23 #define MAX_44009_INTEGRATION_TIME_25_MS 0b101
mitea1 0:f2815503561f 24 #define MAX_44009_INTEGRATION_TIME_12_5_MS 0b110
mitea1 0:f2815503561f 25 #define MAX_44009_INTEGRATION_TIME_6_25_MS 0b111
mitea1 0:f2815503561f 26
mitea1 0:f2815503561f 27 #define MAX_44009_IRQ_ENABLED 0x1
mitea1 0:f2815503561f 28 #define MAX_44009_THRESHOLD_4096_LUX 0xC0
mitea1 0:f2815503561f 29
mitea1 0:f2815503561f 30 /**
mitea1 0:f2815503561f 31 * MAX44009 Modes
mitea1 0:f2815503561f 32 */
mitea1 0:f2815503561f 33 enum MAX44009_MODE{
mitea1 0:f2815503561f 34 MAX44009_MODE_0,//!< MAX44009_MODE_0
mitea1 0:f2815503561f 35 MAX44009_MODE_1,//!< MAX44009_MODE_1
mitea1 0:f2815503561f 36 MAX44009_MODE_2,//!< MAX44009_MODE_2
mitea1 0:f2815503561f 37 MAX44009_MODE_3,//!< MAX44009_MODE_3
mitea1 0:f2815503561f 38 MAX44009_MODE_4,//!< MAX44009_MODE_4
mitea1 0:f2815503561f 39 MAX44009_MODE_5,//!< MAX44009_MODE_5
mitea1 0:f2815503561f 40 MAX44009_MODE_6,//!< MAX44009_MODE_6
mitea1 0:f2815503561f 41 };
mitea1 0:f2815503561f 42
mitea1 0:f2815503561f 43 /**
mitea1 0:f2815503561f 44 * @class MAX44009Config
mitea1 0:f2815503561f 45 * @brief A configuration container for the MAX44009 Sensor.
mitea1 0:f2815503561f 46 * All its configuration values are stored an held inside
mitea1 0:f2815503561f 47 * this Class. Depending on the MAX44009_MODE using
mitea1 0:f2815503561f 48 * as a parameter for the build() method it sets all the configuration values.
mitea1 0:f2815503561f 49 */
mitea1 0:f2815503561f 50
mitea1 0:f2815503561f 51 class MAX44009Config {
mitea1 0:f2815503561f 52 public:
mitea1 0:f2815503561f 53 MAX44009Config();
mitea1 0:f2815503561f 54 MAX44009Config(MAX44009_MODE);
mitea1 0:f2815503561f 55 virtual ~MAX44009Config();
mitea1 0:f2815503561f 56
mitea1 0:f2815503561f 57 /**
mitea1 0:f2815503561f 58 * @brief Generates a configuration according to the chosen MAX44009_MODE
mitea1 0:f2815503561f 59 * by setting all LoRa Module specific configuration values depending on the chosen MAX44009_MODE
mitea1 0:f2815503561f 60 * @param desiredMode the mode to build the configuration according to
mitea1 0:f2815503561f 61 */
mitea1 0:f2815503561f 62 void build(MAX44009_MODE desiredMode);
mitea1 0:f2815503561f 63
mitea1 0:f2815503561f 64
mitea1 0:f2815503561f 65 /**
mitea1 0:f2815503561f 66 * @brief Gets the integration Time for Lux Measurements defined in the actual
mitea1 0:f2815503561f 67 * MAX44009Config
mitea1 0:f2815503561f 68 * @return
mitea1 0:f2815503561f 69 */
mitea1 0:f2815503561f 70 uint8_t getIntegrationTime();
mitea1 0:f2815503561f 71
mitea1 0:f2815503561f 72 /**
mitea1 0:f2815503561f 73 * @brief Gets the Continuous Mode for Lux Measurements defined in the actual
mitea1 0:f2815503561f 74 * MAX44009Config
mitea1 0:f2815503561f 75 * @return
mitea1 0:f2815503561f 76 */
mitea1 0:f2815503561f 77 uint8_t getContinousMode();
mitea1 0:f2815503561f 78
mitea1 0:f2815503561f 79 /**
mitea1 0:f2815503561f 80 * @brief Gets the Manual Config for the Sensor defined in the actual
mitea1 0:f2815503561f 81 * MAX44009Config
mitea1 0:f2815503561f 82 * @return
mitea1 0:f2815503561f 83 */
mitea1 0:f2815503561f 84 uint8_t getManualConfig();
mitea1 0:f2815503561f 85
mitea1 0:f2815503561f 86 /**
mitea1 0:f2815503561f 87 * @brief Gets the interrupt Enable Value that has to be written to the MAX44009
mitea1 0:f2815503561f 88 * according to the actual MAX44009Config
mitea1 0:f2815503561f 89 * @return
mitea1 0:f2815503561f 90 */
mitea1 0:f2815503561f 91 uint8_t getInterruptEnable();
mitea1 0:f2815503561f 92
mitea1 0:f2815503561f 93 /**
mitea1 0:f2815503561f 94 * @brief Gets the upper Threshold Value that has to be written to the MAX44009
mitea1 0:f2815503561f 95 * according to the actual MAX44009Config
mitea1 0:f2815503561f 96 * @return
mitea1 0:f2815503561f 97 */
mitea1 0:f2815503561f 98 uint8_t getUpperThreshold();
mitea1 0:f2815503561f 99
mitea1 0:f2815503561f 100 /**
mitea1 0:f2815503561f 101 * @brief Gets the lower Threshold Value that has to be written to the MAX44009
mitea1 0:f2815503561f 102 * according to the actual MAX44009Config
mitea1 0:f2815503561f 103 * @return
mitea1 0:f2815503561f 104 */
mitea1 0:f2815503561f 105 uint8_t getLowerThreshold();
mitea1 0:f2815503561f 106
mitea1 0:f2815503561f 107 private:
mitea1 0:f2815503561f 108 uint8_t integrationTime;
mitea1 0:f2815503561f 109 uint8_t continousMode;
mitea1 0:f2815503561f 110 uint8_t manualConfig;
mitea1 0:f2815503561f 111 uint8_t interruptEnable;
mitea1 0:f2815503561f 112 uint8_t upperThreshold;
mitea1 0:f2815503561f 113 uint8_t lowerThreshold;
mitea1 0:f2815503561f 114
mitea1 0:f2815503561f 115 /**
mitea1 0:f2815503561f 116 * @brief Sets the integration time value of the MAX44009Config. The value later will be written
mitea1 0:f2815503561f 117 * inside MAX44009 specific register by MAX44009 itself
mitea1 0:f2815503561f 118 * @param integrationTime integration Time register value
mitea1 0:f2815503561f 119 */
mitea1 0:f2815503561f 120 void setIntegrationTime(uint8_t integrationTime);
mitea1 0:f2815503561f 121
mitea1 0:f2815503561f 122 /**
mitea1 0:f2815503561f 123 * @brief Sets the continuous mode value of the MAX44009Config. The value later will be written
mitea1 0:f2815503561f 124 * inside MAX44009 specific register by MAX44009 itself
mitea1 0:f2815503561f 125 * @param continuousMode continuous mode register value
mitea1 0:f2815503561f 126 */
mitea1 0:f2815503561f 127 void setContinousMode(uint8_t continuousMode);
mitea1 0:f2815503561f 128
mitea1 0:f2815503561f 129 /**
mitea1 0:f2815503561f 130 * @brief Sets the continuous mode value of the MAX44009Config. The value later will be written
mitea1 0:f2815503561f 131 * inside MAX44009 specific register by MAX44009 itself
mitea1 0:f2815503561f 132 * @param continuousMode continuous mode register value
mitea1 0:f2815503561f 133 */
mitea1 0:f2815503561f 134 void setManualConfig(uint8_t manualConfig);
mitea1 0:f2815503561f 135
mitea1 0:f2815503561f 136 /**
mitea1 0:f2815503561f 137 * @brief Sets the interrupt enable value of the MAX44009Config. The value later will be written
mitea1 0:f2815503561f 138 * inside MAX44009 specific register by MAX44009 itself
mitea1 0:f2815503561f 139 * @param interruptEnable interruptEnable register value
mitea1 0:f2815503561f 140 */
mitea1 0:f2815503561f 141 void setInterruptEnable(uint8_t interruptEnable);
mitea1 0:f2815503561f 142
mitea1 0:f2815503561f 143 /**
mitea1 0:f2815503561f 144 * @brief Sets the upper threshold value of the MAX44009Config. The value later will be written
mitea1 0:f2815503561f 145 * inside MAX44009 specific register by MAX44009 itself
mitea1 0:f2815503561f 146 * @param upperThreshold upper threshold register value
mitea1 0:f2815503561f 147 */
mitea1 0:f2815503561f 148 void setInterruptUpperThreshold(uint8_t upperThreshold);
mitea1 0:f2815503561f 149
mitea1 0:f2815503561f 150 /**
mitea1 0:f2815503561f 151 * @brief Sets the lower threshold value of the MAX44009Config. The value later will be written
mitea1 0:f2815503561f 152 * inside MAX44009 specific register by MAX44009 itself
mitea1 0:f2815503561f 153 * @param upperThreshold upper threshold register value
mitea1 0:f2815503561f 154 */
mitea1 0:f2815503561f 155 void setInterruptLowerThreshold(uint8_t lowerThreshold);
mitea1 0:f2815503561f 156 };
mitea1 0:f2815503561f 157
mitea1 0:f2815503561f 158 #endif /* APP_MAX44009CONFIG_H_ */