Library for LoRa communication using MultiTech MDOT.

Dependents:   mDot_test_rx adc_sensor_lora mDotEVBM2X mDot_AT_firmware ... more

Function documentation is in mDot.h

Warning

Using libmDot 2.0.3 and above with an existing application may require a change in the MacEvent handler!
Compile applications with mbed v121 and mbed-rtos v116 libraries.

In AT Command Firmware remove line 803.

CommandTerminal/CommandTerminal.cpp

        delete[] info->RxBuffer;

Likewise, if your application is handling events from the library asynchronously.

Revision:
6:390fc83d588d
Parent:
5:0bfe6a650513
Child:
7:683dba5d576f
--- a/mDot.h	Tue Jul 07 14:32:54 2015 -0500
+++ b/mDot.h	Thu Jul 16 16:41:08 2015 -0500
@@ -1,9 +1,4 @@
-/************************************************
- * MultiTech MTDOT Library
- * Copyright (c) 2015 MultiTech Systems
- *
- * See LICENSE file for license information
- ***********************************************/
+// TODO: add license header
 
 #ifndef MDOT_H
 #define MDOT_H
@@ -47,10 +42,10 @@
         uint8_t getActivityLedState();
 
         void blinkActivityLed(void) {
-            if (_activity_led) {
-                int val = _activity_led->read();
-                _activity_led->write(!val);
-            }
+            if (_activity_led) {
+                int val = _activity_led->read();
+                _activity_led->write(!val);
+            }
         }
 
         mDot(const mDot&);
@@ -67,9 +62,9 @@
         static const uint32_t _baud_rates[];
         uint8_t _activity_led_state;
         Ticker _tick;
-        DigitalOut* _activity_led;
-        bool _activity_led_enable;
-        PinName _activity_led_pin;
+        DigitalOut* _activity_led;
+        bool _activity_led_enable;
+        PinName _activity_led_pin;
         bool _activity_led_external;
         uint16_t _linkFailCount;
 
@@ -116,6 +111,10 @@
             FSB_ALL, FSB_1, FSB_2, FSB_3, FSB_4, FSB_5, FSB_6, FSB_7, FSB_8
         };
 
+        enum JoinByteOrder {
+            LSB, MSB
+        };
+
         typedef struct {
                 uint32_t Up;
                 uint32_t Down;
@@ -201,34 +200,34 @@
         /** Get the current log level for the library
          * @returns current log level
          */
-        uint8_t getLogLevel();
+        uint8_t getLogLevel();
+
+        /** Enable or disable the activity LED.
+         * @param enable true to enable the LED, false to disable
+         */
+        void setActivityLedEnable(const bool& enable);
 
-        /** Enable or disable the activity LED.
-         * @param enable true to enable the LED, false to disable
-         */
-        void setActivityLedEnable(const bool& enable);
-
-        /** Find out if the activity LED is enabled
-         * @returns true if activity LED is enabled, false if disabled
-         */
-        bool getActivityLedEnable();
-
-        /** Use a different pin for the activity LED.
-         * The default is XBEE_RSSI.
-         * @param pin the new pin to use
-         */
-        void setActivityLedPin(const PinName& pin);
-
+        /** Find out if the activity LED is enabled
+         * @returns true if activity LED is enabled, false if disabled
+         */
+        bool getActivityLedEnable();
+
+        /** Use a different pin for the activity LED.
+         * The default is XBEE_RSSI.
+         * @param pin the new pin to use
+         */
+        void setActivityLedPin(const PinName& pin);
+
         /** Use an external DigitalOut object for the activity LED.
          * The pointer must stay valid!
          * @param pin the DigitalOut object to use
          */
         void setActivityLedPin(DigitalOut* pin);
-
-        /** Find out what pin the activity LED is on
-         * @returns the pin the activity LED is using
-         */
-        PinName getActivityLedPin();
+
+        /** Find out what pin the activity LED is on
+         * @returns the pin the activity LED is using
+         */
+        PinName getActivityLedPin();
 
         /** Get list of channel frequencies currently in use
          * @returns vector of channels currently in use
@@ -360,6 +359,16 @@
          */
         std::vector<uint8_t> getNetworkKey();
 
+        /** Set join byte order
+         * @param order 0:LSB 1:MSB
+         */
+        uint32_t setJoinByteOrder(uint8_t order);
+
+        /** Get join byte order
+         * @returns byte order to use in joins 0:LSB 1:MSB
+         */
+        uint8_t getJoinByteOrder();
+
         /** Attempt to join network
          * retries according to configuration set by setJoinRetries()
          * @returns MDOT_OK if success
@@ -580,6 +589,8 @@
          */
         int32_t recv(std::vector<uint8_t>& data);
 
+        void openRxWindow(uint32_t timeout);
+
         /** Ping
          * status will be MDOT_OK if ping succeeded
          * @returns ping_response struct containing status, RSSI, and SNR
@@ -690,6 +701,7 @@
         uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
 
         // MTS_RADIO_DEBUG_COMMANDS
+        void sendContinuous();
         int32_t setDeviceId(const std::vector<uint8_t>& id);
         int32_t setFrequencyBand(const uint8_t& band);
         bool saveProtectedConfig();
@@ -699,6 +711,8 @@
         void eraseFlash();
 
         mdot_stats getStats();
+        void resetStats();
+
 
     private:
         mdot_stats _stats;