Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-Custom MTS-Serial
Fork of mDot_AT_firmware_CUSTOM by
To change channel plans replace AS923 with AU915, EU868, KR920 or US915 on line 15
#define CHANNEL_PLAN CP_AS923
main.cpp@15:36db31c18231, 2016-08-31 (annotated)
- Committer:
- Jason Reiss
- Date:
- Wed Aug 31 11:57:27 2016 -0500
- Revision:
- 15:36db31c18231
- Parent:
- 12:98445fa50cd3
- Child:
- 17:17963e6bd07d
Use DYNAMIC or FIXED channel plan instead of US915 or EU868
Add US915 and EU868 examples
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
9:ff62b20f7000 | 1 | #include "mbed.h" |
Mike Fiore |
9:ff62b20f7000 | 2 | #include "mDot.h" |
Mike Fiore |
9:ff62b20f7000 | 3 | #include "CommandTerminal.h" |
Mike Fiore |
9:ff62b20f7000 | 4 | #include "ATSerial.h" |
Mike Fiore |
9:ff62b20f7000 | 5 | #include "ATSerialFlowControl.h" |
Jason Reiss |
15:36db31c18231 | 6 | #include "CustomChannelPlan_EU868.h" |
Mike Fiore |
9:ff62b20f7000 | 7 | |
Mike Fiore |
9:ff62b20f7000 | 8 | #define SERIAL_BUFFER_SIZE 512 |
Mike Fiore |
9:ff62b20f7000 | 9 | |
Mike Fiore |
9:ff62b20f7000 | 10 | mts::ATSerial debug(USBTX, USBRX); |
Mike Fiore |
9:ff62b20f7000 | 11 | |
jreiss | 12:98445fa50cd3 | 12 | #ifndef UNIT_TEST |
jreiss | 12:98445fa50cd3 | 13 | |
Mike Fiore |
9:ff62b20f7000 | 14 | int main() |
Mike Fiore |
9:ff62b20f7000 | 15 | { |
Mike Fiore |
9:ff62b20f7000 | 16 | debug.baud(115200); |
Mike Fiore |
9:ff62b20f7000 | 17 | |
Mike Fiore |
9:ff62b20f7000 | 18 | mDot* dot = mDot::getInstance(); |
Mike Fiore |
9:ff62b20f7000 | 19 | |
Jason Reiss |
15:36db31c18231 | 20 | lora::CustomChannelPlan_EU868* plan = new lora::CustomChannelPlan_EU868(*dot->getRadio(), *dot->getSettings()); |
jreiss | 12:98445fa50cd3 | 21 | dot->setChannelPlan(plan); |
jreiss | 12:98445fa50cd3 | 22 | |
Mike Fiore |
9:ff62b20f7000 | 23 | // Seed the RNG |
Mike Fiore |
9:ff62b20f7000 | 24 | srand(dot->getRadioRandom()); |
Mike Fiore |
9:ff62b20f7000 | 25 | |
Mike Fiore |
9:ff62b20f7000 | 26 | mts::ATSerial* serial; |
Mike Fiore |
9:ff62b20f7000 | 27 | |
Mike Fiore |
9:ff62b20f7000 | 28 | if (dot->getFlowControl()) |
jreiss | 12:98445fa50cd3 | 29 | #if defined(TARGET_MTS_MDOT_F411RE) |
Mike Fiore |
9:ff62b20f7000 | 30 | serial = new mts::ATSerialFlowControl(XBEE_DOUT, XBEE_DIN, XBEE_RTS, XBEE_CTS, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); |
jreiss | 12:98445fa50cd3 | 31 | #else |
jreiss | 12:98445fa50cd3 | 32 | serial = new mts::ATSerialFlowControl(UART1_TX, UART1_RX, UART1_RTS, UART1_CTS, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); |
jreiss | 12:98445fa50cd3 | 33 | #endif |
Mike Fiore |
9:ff62b20f7000 | 34 | else |
jreiss | 12:98445fa50cd3 | 35 | #if defined(TARGET_MTS_MDOT_F411RE) |
Mike Fiore |
9:ff62b20f7000 | 36 | serial = new mts::ATSerial(XBEE_DOUT, XBEE_DIN, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); |
jreiss | 12:98445fa50cd3 | 37 | #else |
jreiss | 12:98445fa50cd3 | 38 | serial = new mts::ATSerial(UART1_TX, UART1_RX, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); |
jreiss | 12:98445fa50cd3 | 39 | #endif |
Mike Fiore |
9:ff62b20f7000 | 40 | |
Mike Fiore |
9:ff62b20f7000 | 41 | debug.baud(dot->getDebugBaud()); |
Mike Fiore |
9:ff62b20f7000 | 42 | serial->baud(dot->getBaud()); |
Mike Fiore |
9:ff62b20f7000 | 43 | |
jreiss | 12:98445fa50cd3 | 44 | CommandTerminal term(*serial); |
jreiss | 12:98445fa50cd3 | 45 | CommandTerminal::_dot = dot; |
jreiss | 12:98445fa50cd3 | 46 | |
jreiss | 12:98445fa50cd3 | 47 | term.init(); |
jreiss | 12:98445fa50cd3 | 48 | |
jreiss | 12:98445fa50cd3 | 49 | |
Mike Fiore |
9:ff62b20f7000 | 50 | |
Mike Fiore |
9:ff62b20f7000 | 51 | term.start(); |
Mike Fiore |
9:ff62b20f7000 | 52 | } |
jreiss | 12:98445fa50cd3 | 53 | |
jreiss | 12:98445fa50cd3 | 54 | #endif // UNIT_TEST |
jreiss | 12:98445fa50cd3 | 55 |