AT command firmware for MultiTech Dot devices.
Fork of mDot_AT_firmware by
Dot Library Not Included!
Because these example programs can be used for both mDot and xDot devices, the LoRa stack is not included. The libmDot library should be imported if building for mDot devices. The libxDot library should be imported if building for xDot devices. The AT firmware was last tested with mbed-os-5.4.7. Using a version past mbed-os-5.4.7 will cause the build to fail. The library used with the AT firmware has to match the mbed-os version.
Dot Library Version 3 Updates
Dot Library versions 3.x.x require a channel plan to be injected into the stack. The Dot-Examples and Dot-AT-Firmware do this by defining a macro called "CHANNEL_PLAN" that controls the channel plan that will be used in the examples. Available channel plans will be in the Dot Library repository in the plans folder.
Revision 20 and earlier of Dot-Examples and revision 15 and earlier of Dot-AT-Firmware should be used with Dot Library versions prior to 3.0.0.
Fota Library
Th Fota Library must be added to compile for mDot 3.1.0 with Fota support. Latest dev libraries and 3.2.0 release will include Fota with libmDot/libxDot.
AT Firmware Description
This AT Firmware is what ships on mDot and xDot devices. It provides an AT command interface for using the mDot or xDot for LoRa communication.
AT command documentation can be found on Multitech.com.
The firmware changelog can be found here.
The library changelog can be found here.
Dot Libraries
Dot Library Limitations
The commit messages in libmDot-mbed5 and libmDot-dev-mbed5 specify the version of the Dot library the commit contains and the version of mbed-os it was compiled against. We recommend building your application with the version of mbed-os specified in the commit message of the version of the Dot library you're using. This will ensure that you don't run into any runtime issues caused by differences in the mbed-os versions.
Stable and development libraries are available for both mDot and xDot platforms. The library chosen must match the target platform. Compiling for the mDot platform with the xDot library or vice versa will not succeed.
mDot Library
Development library for mDot.
Stable library for mDot.
xDot Library
Development library for xDot.
Stable library for xDot.
ATSerial.h@27:5fafd3b26ac3, 2020-09-11 (annotated)
- Committer:
- Jason Reiss
- Date:
- Fri Sep 11 13:16:33 2020 -0500
- Revision:
- 27:5fafd3b26ac3
- Parent:
- 9:ff62b20f7000
- Child:
- 28:c222ca8383f4
Update to Dot 3.3.6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
9:ff62b20f7000 | 1 | #ifndef ATSERIAL_H |
Mike Fiore |
9:ff62b20f7000 | 2 | #define ATSERIAL_H |
Mike Fiore |
9:ff62b20f7000 | 3 | |
Mike Fiore |
9:ff62b20f7000 | 4 | #include "MTSSerial.h" |
Mike Fiore |
9:ff62b20f7000 | 5 | #include "MTSBufferedIO.h" |
Mike Fiore |
9:ff62b20f7000 | 6 | |
Mike Fiore |
9:ff62b20f7000 | 7 | namespace mts |
Mike Fiore |
9:ff62b20f7000 | 8 | { |
Mike Fiore |
9:ff62b20f7000 | 9 | |
Mike Fiore |
9:ff62b20f7000 | 10 | /** This class derives from MTSBufferedIO and provides a buffered wrapper to the |
Mike Fiore |
9:ff62b20f7000 | 11 | * standard mbed Serial class. Since it depends only on the mbed Serial class for |
Mike Fiore |
9:ff62b20f7000 | 12 | * accessing serial data, this class is inherently portable accross different mbed |
Mike Fiore |
9:ff62b20f7000 | 13 | * platforms. |
Mike Fiore |
9:ff62b20f7000 | 14 | */ |
Jason Reiss |
27:5fafd3b26ac3 | 15 | class ATSerial : public MTSBufferedIO |
Mike Fiore |
9:ff62b20f7000 | 16 | { |
Mike Fiore |
9:ff62b20f7000 | 17 | public: |
Mike Fiore |
9:ff62b20f7000 | 18 | /** Creates a new ATSerial object that can be used to talk to an mbed serial port |
Mike Fiore |
9:ff62b20f7000 | 19 | * through internal SW buffers. |
Mike Fiore |
9:ff62b20f7000 | 20 | * |
Mike Fiore |
9:ff62b20f7000 | 21 | * @param TXD the transmit data pin on the desired mbed Serial interface. |
Mike Fiore |
9:ff62b20f7000 | 22 | * @param RXD the receive data pin on the desired mbed Serial interface. |
Mike Fiore |
9:ff62b20f7000 | 23 | * @param txBufferSize the size in bytes of the internal SW transmit buffer. The |
Mike Fiore |
9:ff62b20f7000 | 24 | * default is 256 bytes. |
Mike Fiore |
9:ff62b20f7000 | 25 | * @param rxBufferSize the size in bytes of the internal SW receive buffer. The |
Mike Fiore |
9:ff62b20f7000 | 26 | * default is 256 bytes. |
Mike Fiore |
9:ff62b20f7000 | 27 | */ |
Mike Fiore |
9:ff62b20f7000 | 28 | ATSerial(PinName TXD, PinName RXD, int txBufferSize = 256, int rxBufferSize = 256); |
Mike Fiore |
9:ff62b20f7000 | 29 | |
Mike Fiore |
9:ff62b20f7000 | 30 | /** Destructs an ATSerial object and frees all related resources, including |
Mike Fiore |
9:ff62b20f7000 | 31 | * internal buffers. |
Mike Fiore |
9:ff62b20f7000 | 32 | */ |
Mike Fiore |
9:ff62b20f7000 | 33 | virtual ~ATSerial(); |
Mike Fiore |
9:ff62b20f7000 | 34 | |
Mike Fiore |
9:ff62b20f7000 | 35 | /** |
Mike Fiore |
9:ff62b20f7000 | 36 | * Attach the internal serial object to provided pins |
Mike Fiore |
9:ff62b20f7000 | 37 | * @param TXD the transmit data pin on the desired mbed Serial interface. |
Mike Fiore |
9:ff62b20f7000 | 38 | * @param RXD the receive data pin on the desired mbed Serial interface. |
Mike Fiore |
9:ff62b20f7000 | 39 | */ |
Mike Fiore |
9:ff62b20f7000 | 40 | void reattach(PinName TXD, PinName RXD); |
Mike Fiore |
9:ff62b20f7000 | 41 | |
Mike Fiore |
9:ff62b20f7000 | 42 | /** This method is used to the set the baud rate of the serial port. |
Mike Fiore |
9:ff62b20f7000 | 43 | * |
Mike Fiore |
9:ff62b20f7000 | 44 | * @param baudrate the baudrate in bps as an int. The default is 9600 bps. |
Mike Fiore |
9:ff62b20f7000 | 45 | */ |
Mike Fiore |
9:ff62b20f7000 | 46 | void baud(int baudrate); |
Mike Fiore |
9:ff62b20f7000 | 47 | |
Mike Fiore |
9:ff62b20f7000 | 48 | /** This method sets the transmission format used by the serial port. |
Mike Fiore |
9:ff62b20f7000 | 49 | * |
Mike Fiore |
9:ff62b20f7000 | 50 | * @param bits the number of bits in a word (5-8; default = 8) |
Mike Fiore |
9:ff62b20f7000 | 51 | * @param parity the parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even, |
Mike Fiore |
9:ff62b20f7000 | 52 | * SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None) |
Mike Fiore |
9:ff62b20f7000 | 53 | * @param stop the number of stop bits (1 or 2; default = 1) |
Mike Fiore |
9:ff62b20f7000 | 54 | */ |
Mike Fiore |
9:ff62b20f7000 | 55 | void format(int bits=8, SerialBase::Parity parity=mbed::SerialBase::None, int stop_bits=1); |
Mike Fiore |
9:ff62b20f7000 | 56 | |
Mike Fiore |
9:ff62b20f7000 | 57 | /** Generate a break condition on the serial line |
Mike Fiore |
9:ff62b20f7000 | 58 | */ |
Mike Fiore |
9:ff62b20f7000 | 59 | void sendBreak(); |
Mike Fiore |
9:ff62b20f7000 | 60 | |
Mike Fiore |
9:ff62b20f7000 | 61 | /** Check for escape sequence detected on serial input |
Mike Fiore |
9:ff62b20f7000 | 62 | * @return true if escape sequence was seen |
Mike Fiore |
9:ff62b20f7000 | 63 | */ |
Mike Fiore |
9:ff62b20f7000 | 64 | bool escaped(); |
Mike Fiore |
9:ff62b20f7000 | 65 | |
Mike Fiore |
9:ff62b20f7000 | 66 | void escapeChar(char esc); |
Mike Fiore |
9:ff62b20f7000 | 67 | |
Mike Fiore |
9:ff62b20f7000 | 68 | char escapeChar(); |
Mike Fiore |
9:ff62b20f7000 | 69 | |
Mike Fiore |
9:ff62b20f7000 | 70 | void clearEscaped(); |
Mike Fiore |
9:ff62b20f7000 | 71 | |
Jason Reiss |
27:5fafd3b26ac3 | 72 | /** Attach and detach rx irq handler to existing serial instance |
Jason Reiss |
27:5fafd3b26ac3 | 73 | */ |
Jason Reiss |
27:5fafd3b26ac3 | 74 | void attach(); |
Jason Reiss |
27:5fafd3b26ac3 | 75 | void detach(); |
Mike Fiore |
9:ff62b20f7000 | 76 | |
Mike Fiore |
9:ff62b20f7000 | 77 | protected: |
Mike Fiore |
9:ff62b20f7000 | 78 | |
Mike Fiore |
9:ff62b20f7000 | 79 | RawSerial* _serial; // Internal mbed Serial object |
Mike Fiore |
9:ff62b20f7000 | 80 | int _baudrate; |
Mike Fiore |
9:ff62b20f7000 | 81 | int _bits; |
Mike Fiore |
9:ff62b20f7000 | 82 | SerialBase::Parity _parity; |
Mike Fiore |
9:ff62b20f7000 | 83 | int _stop_bits; |
Mike Fiore |
9:ff62b20f7000 | 84 | Timer timer; |
Mike Fiore |
9:ff62b20f7000 | 85 | int _last_time; |
Mike Fiore |
9:ff62b20f7000 | 86 | int _esc_cnt; |
Mike Fiore |
9:ff62b20f7000 | 87 | char _esc_ch; |
Mike Fiore |
9:ff62b20f7000 | 88 | bool _escaped; |
Mike Fiore |
9:ff62b20f7000 | 89 | |
Mike Fiore |
9:ff62b20f7000 | 90 | virtual void handleWrite(); // Method for handling data to be written |
Mike Fiore |
9:ff62b20f7000 | 91 | virtual void handleRead(); // Method for handling data to be read |
Mike Fiore |
9:ff62b20f7000 | 92 | |
Mike Fiore |
9:ff62b20f7000 | 93 | |
Mike Fiore |
9:ff62b20f7000 | 94 | }; |
Mike Fiore |
9:ff62b20f7000 | 95 | |
Mike Fiore |
9:ff62b20f7000 | 96 | } |
Mike Fiore |
9:ff62b20f7000 | 97 | |
Mike Fiore |
9:ff62b20f7000 | 98 | #endif /* ATSERIAL_H */ |