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 MPU9250Config.h
mitea1 0:f2815503561f 3 *
mitea1 0:f2815503561f 4 * @author Adrian
mitea1 0:f2815503561f 5 * @date 23.05.2016
mitea1 0:f2815503561f 6 *
mitea1 0:f2815503561f 7 */
mitea1 0:f2815503561f 8
mitea1 0:f2815503561f 9 #include <stdint.h>
mitea1 0:f2815503561f 10
mitea1 0:f2815503561f 11 #ifndef APP_MPU9250CONFIG_H_
mitea1 0:f2815503561f 12 #define APP_MPU9250CONFIG_H_
mitea1 0:f2815503561f 13
mitea1 0:f2815503561f 14 #define MPU9250_GYRO_FULL_SCALE_250DPS 0b00
mitea1 0:f2815503561f 15 #define MPU9250_GYRO_FULL_SCALE_500DPS 0b01
mitea1 0:f2815503561f 16 #define MPU9250_GYRO_FULL_SCALE_1000DPS 0b10
mitea1 0:f2815503561f 17 #define MPU9250_GYRO_FULL_SCALE_2000DPS 0b11
mitea1 0:f2815503561f 18
mitea1 0:f2815503561f 19 #define MPU9250_FULL_SCALE_2G 0b00
mitea1 0:f2815503561f 20 #define MPU9250_FULL_SCALE_4G 0b01
mitea1 0:f2815503561f 21 #define MPU9250_FULL_SCALE_8G 0b10
mitea1 0:f2815503561f 22 #define MPU9250_FULL_SCALE_16G 0b11
mitea1 0:f2815503561f 23
mitea1 0:f2815503561f 24 #define MPU9250_MAG_16_BIT 0b1
mitea1 0:f2815503561f 25 #define MPU9250_MAG_14_BIT 0b0
mitea1 0:f2815503561f 26
mitea1 0:f2815503561f 27 #define MPU9250_MAG_SINGLE_MEASUREMENT 0b0001
mitea1 0:f2815503561f 28 #define MPU9250_MAG_CONTINUOUS_MEASUREMENT_1 0b0010
mitea1 0:f2815503561f 29 #define MPU9250_MAG_CONTINUOUS_MEASUREMENT_2 0b0110
mitea1 0:f2815503561f 30
mitea1 0:f2815503561f 31 //INT_PIN_CFG register masks
mitea1 0:f2815503561f 32 #define MPU9250_ACTL_MASK 0x80
mitea1 0:f2815503561f 33 #define MPU9250_OPEN_MASK 0x40
mitea1 0:f2815503561f 34 #define MPU9250_LATCH_INT_EN_MASK 0x20
mitea1 0:f2815503561f 35 #define MPU9250_INT_ANYRD_2CLEAR_MASK 0x10
mitea1 0:f2815503561f 36 #define MPU9250_ACTL_FSYNC_MASK 0x08
mitea1 0:f2815503561f 37 #define MPU9250_FSYNC_INT_MODE_EN_MASK 0x04
mitea1 0:f2815503561f 38 #define MPU9250_BYPASS_EN_MASK 0x02
mitea1 0:f2815503561f 39
mitea1 0:f2815503561f 40 //INT_ENABLE register masks
mitea1 0:f2815503561f 41 #define MPU9250_WOM_EN_MASK 0x40
mitea1 0:f2815503561f 42 #define MPU9250_FIFO_OFLOW_EN_MASK 0x10
mitea1 0:f2815503561f 43 #define MPU9250_FSYNC_INT_EN_MASK 0x08
mitea1 0:f2815503561f 44 #define MPU9250_RAW_RDY_EN_MASK 0x01
mitea1 0:f2815503561f 45
mitea1 0:f2815503561f 46 #define MPU9250_WOM_THRESHOLD_1020_MG 0xFF
mitea1 0:f2815503561f 47 #define MPU9250_WOM_THRESHOLD_500_MG 0x7D
mitea1 0:f2815503561f 48 #define MPU9250_WOM_THRESHOLD_250_MG 0xFA
mitea1 0:f2815503561f 49
mitea1 0:f2815503561f 50 /**
mitea1 0:f2815503561f 51 * MPU9250 Modes. Modes define Sensor functionality
mitea1 0:f2815503561f 52 */
mitea1 0:f2815503561f 53 enum MPU9250_MODE{
mitea1 0:f2815503561f 54 MPU9250_MODE_1,//!< MPU9250_MODE_1
mitea1 0:f2815503561f 55 MPU9250_MODE_2,//!< MPU9250_MODE_2
mitea1 0:f2815503561f 56 MPU9250_MODE_3,//!< MPU9250_MODE_3
mitea1 0:f2815503561f 57 MPU9250_MODE_4 //!< MPU9250_MODE_4
mitea1 0:f2815503561f 58 };
mitea1 0:f2815503561f 59
mitea1 0:f2815503561f 60 /**
mitea1 0:f2815503561f 61 * @class MPU9250Config
mitea1 0:f2815503561f 62 * @brief A configuration container for the MPU9250 Sensor.
mitea1 0:f2815503561f 63 * All its configuration values are stored an held inside
mitea1 0:f2815503561f 64 * this Class. Depending on the MPU9250_MODE it sets all the configuration values.
mitea1 0:f2815503561f 65 */
mitea1 0:f2815503561f 66 class MPU9250Config {
mitea1 0:f2815503561f 67 public:
mitea1 0:f2815503561f 68 MPU9250Config();
mitea1 0:f2815503561f 69 virtual ~MPU9250Config();
mitea1 0:f2815503561f 70
mitea1 0:f2815503561f 71 /**
mitea1 0:f2815503561f 72 * @brief Generates a configuration according to the chosen MPU9250_MODE
mitea1 0:f2815503561f 73 * @param desiredMode the mode to build the configuration according to
mitea1 0:f2815503561f 74 */
mitea1 0:f2815503561f 75 void build(MPU9250_MODE desiredMode);
mitea1 0:f2815503561f 76
mitea1 0:f2815503561f 77
mitea1 0:f2815503561f 78 /**
mitea1 0:f2815503561f 79 * @brief Gets the Accelerometer Scale from the actual configuration
mitea1 0:f2815503561f 80 * @return accelerometer scale
mitea1 0:f2815503561f 81 */
mitea1 0:f2815503561f 82 uint8_t getAccelerometerScale();
mitea1 0:f2815503561f 83
mitea1 0:f2815503561f 84 /**
mitea1 0:f2815503561f 85 * @brief Gets the Gyroscope Scale from the actual configuration
mitea1 0:f2815503561f 86 * @return gyroscope scale
mitea1 0:f2815503561f 87 */
mitea1 0:f2815503561f 88 uint8_t getGyroscopeScale();
mitea1 0:f2815503561f 89
mitea1 0:f2815503561f 90 /**
mitea1 0:f2815503561f 91 * @brief Gets the Magnetometer bit resolution from the actual configuration
mitea1 0:f2815503561f 92 * @return magnetometer bit resolution
mitea1 0:f2815503561f 93 */
mitea1 0:f2815503561f 94 uint8_t getMagnetometerBitResolution();
mitea1 0:f2815503561f 95
mitea1 0:f2815503561f 96 /**
mitea1 0:f2815503561f 97 * @brief Gets the Magnetometer measure mode from the actual configuration
mitea1 0:f2815503561f 98 * @return magnetometer bit resolution
mitea1 0:f2815503561f 99 */
mitea1 0:f2815503561f 100 uint8_t getMagnetometerMeasureMode();
mitea1 0:f2815503561f 101
mitea1 0:f2815503561f 102 /**
mitea1 0:f2815503561f 103 * @brief Gets the Acceleration Divider from the actual configuration
mitea1 0:f2815503561f 104 * @return acceleration divider
mitea1 0:f2815503561f 105 */
mitea1 0:f2815503561f 106 float getAccelerationDivider();
mitea1 0:f2815503561f 107
mitea1 0:f2815503561f 108 /**
mitea1 0:f2815503561f 109 * @brief Gets the Gyroscope Divider from the actual configuration
mitea1 0:f2815503561f 110 * @return gyroscope divider
mitea1 0:f2815503561f 111 */
mitea1 0:f2815503561f 112 float getGyroDivider();
mitea1 0:f2815503561f 113
mitea1 0:f2815503561f 114 /**
mitea1 0:f2815503561f 115 * @brief Gets the Tesla Divider from the actual configuration
mitea1 0:f2815503561f 116 * @return
mitea1 0:f2815503561f 117 */
mitea1 0:f2815503561f 118 float getTeslaDivider();
mitea1 0:f2815503561f 119
mitea1 0:f2815503561f 120
mitea1 0:f2815503561f 121 /**
mitea1 0:f2815503561f 122 * @brief Gets the Interrupt Pin configuration from the actual configuration
mitea1 0:f2815503561f 123 * @return interrupt pin configuration
mitea1 0:f2815503561f 124 */
mitea1 0:f2815503561f 125 uint8_t getInterruptPinConfiguration();
mitea1 0:f2815503561f 126
mitea1 0:f2815503561f 127 /**
mitea1 0:f2815503561f 128 * @brief Gets the Interrupt Enable configuration from the actual configuration
mitea1 0:f2815503561f 129 * @return interrupt enable configuration
mitea1 0:f2815503561f 130 */
mitea1 0:f2815503561f 131 uint8_t getInterruptEnableConfiguration();
mitea1 0:f2815503561f 132
mitea1 0:f2815503561f 133 /**
mitea1 0:f2815503561f 134 * @brief Gets the wake on motion threshold value from the actual configuration
mitea1 0:f2815503561f 135 * @return wake on motion threshold value
mitea1 0:f2815503561f 136 */
mitea1 0:f2815503561f 137 uint8_t getWakeOnMotionThreshold();
mitea1 0:f2815503561f 138
mitea1 0:f2815503561f 139 private:
mitea1 0:f2815503561f 140 uint8_t gyroscopeScale;
mitea1 0:f2815503561f 141 uint8_t accelerometerScale;
mitea1 0:f2815503561f 142 uint8_t magnetometerBitResolution;
mitea1 0:f2815503561f 143 uint8_t magnetometerMeasureMode;
mitea1 0:f2815503561f 144
mitea1 0:f2815503561f 145 uint8_t interruptPinConfiguration;
mitea1 0:f2815503561f 146 uint8_t interruptEnableConfiguration;
mitea1 0:f2815503561f 147
mitea1 0:f2815503561f 148 uint8_t wakeOnMotionThreshold;
mitea1 0:f2815503561f 149
mitea1 0:f2815503561f 150
mitea1 0:f2815503561f 151 /**
mitea1 0:f2815503561f 152 * @brief Sets the accelerometer scale of the actual configuration
mitea1 0:f2815503561f 153 * @param accelerometerScale
mitea1 0:f2815503561f 154 */
mitea1 0:f2815503561f 155 void setAccelerometerScale(uint8_t accelerometerScale);
mitea1 0:f2815503561f 156
mitea1 0:f2815503561f 157 /**
mitea1 0:f2815503561f 158 * @brief Sets the gyroscope scale of the actual configuration
mitea1 0:f2815503561f 159 * @param gyroscopeScale
mitea1 0:f2815503561f 160 */
mitea1 0:f2815503561f 161 void setGyroscopeScale(uint8_t gyroscopeScale);
mitea1 0:f2815503561f 162
mitea1 0:f2815503561f 163 /**
mitea1 0:f2815503561f 164 * @brief Sets the magnetometer bit resolution of the actual configuration
mitea1 0:f2815503561f 165 * @param magnetometerBitResolution
mitea1 0:f2815503561f 166 */
mitea1 0:f2815503561f 167 void setMagnetometerBitResolution(uint8_t magnetometerBitResolution);
mitea1 0:f2815503561f 168
mitea1 0:f2815503561f 169 /**
mitea1 0:f2815503561f 170 * @brief Sets the magnetometer measure mode of the actual configuration
mitea1 0:f2815503561f 171 * @param magnetometerMeasureMode
mitea1 0:f2815503561f 172 */
mitea1 0:f2815503561f 173 void setMagnetometerMeasureMode(uint8_t meagnetometerMeasureMode);
mitea1 0:f2815503561f 174
mitea1 0:f2815503561f 175
mitea1 0:f2815503561f 176 /**
mitea1 0:f2815503561f 177 * @brief Sets the interrupt pin configuration of the actual configuration
mitea1 0:f2815503561f 178 * @param interruptPinConfiguration
mitea1 0:f2815503561f 179 */
mitea1 0:f2815503561f 180 void setInterruptPinConfiguration(uint8_t interruptPinConfiguration);
mitea1 0:f2815503561f 181
mitea1 0:f2815503561f 182 /**
mitea1 0:f2815503561f 183 * @brief Sets the interrupt enable configuration of the actual configuration
mitea1 0:f2815503561f 184 * @param interruptEnableConfiguration
mitea1 0:f2815503561f 185 */
mitea1 0:f2815503561f 186 void setInterruptEnableConfiguration(uint8_t interruptEnableConfiguration);
mitea1 0:f2815503561f 187
mitea1 0:f2815503561f 188
mitea1 0:f2815503561f 189 /**
mitea1 0:f2815503561f 190 * @brief Sets the wake on motion threshold of the actual configuration
mitea1 0:f2815503561f 191 * @param wakeOnMotionThreshold
mitea1 0:f2815503561f 192 */
mitea1 0:f2815503561f 193 void setWakeOnMotionThreshold(uint8_t wakeOnMotionThreshold);
mitea1 0:f2815503561f 194 };
mitea1 0:f2815503561f 195
mitea1 0:f2815503561f 196 #endif /* APP_MPU9250CONFIG_H_ */