Elmo Terminal provides functionality to test Lora radio and access SX1272 chip registers delivered with Elmo board. Also contains example ping-pong application.
Dependencies: SX1272lib mbed-src
main.cpp@3:bb58d4e78e68, 2015-10-01 (annotated)
- Committer:
- WGorniak
- Date:
- Thu Oct 01 14:42:59 2015 +0200
- Revision:
- 3:bb58d4e78e68
- Parent:
- 2:8d8295a51f68
removed sstream (arm microlib compatibility)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WGorniak | 2:8d8295a51f68 | 1 | #include "mbed.h" |
WGorniak | 2:8d8295a51f68 | 2 | #include "sx1272-hal.h" |
WGorniak | 2:8d8295a51f68 | 3 | #include "Terminal.h" |
WGorniak | 2:8d8295a51f68 | 4 | #include "Settings.h" |
WGorniak | 2:8d8295a51f68 | 5 | |
WGorniak | 2:8d8295a51f68 | 6 | #include "stdint.h" |
WGorniak | 2:8d8295a51f68 | 7 | #include "dbg.h" |
WGorniak | 2:8d8295a51f68 | 8 | |
WGorniak | 2:8d8295a51f68 | 9 | #include "PingPongCmd.h" |
WGorniak | 2:8d8295a51f68 | 10 | |
WGorniak | 2:8d8295a51f68 | 11 | |
WGorniak | 2:8d8295a51f68 | 12 | Variable::ValueDescription frequencyValues[] = |
WGorniak | 2:8d8295a51f68 | 13 | {{860000, "kHz"}, {1020000, 0}, {0,0} }; |
WGorniak | 2:8d8295a51f68 | 14 | Variable::ValueDescription powerValues[] = |
WGorniak | 2:8d8295a51f68 | 15 | {{-1, "dBm"}, {20, 0}, {0,0} }; |
WGorniak | 2:8d8295a51f68 | 16 | Variable::ValueDescription bandwidthValues[] = |
WGorniak | 2:8d8295a51f68 | 17 | {{0, "125 kHz"}, {1, "250 kHz"}, {2, "500 kHz"}, {0,0} }; |
WGorniak | 2:8d8295a51f68 | 18 | Variable::ValueDescription dataRateValues[] = |
WGorniak | 2:8d8295a51f68 | 19 | {{6, "64"}, {7, "128"}, {8, "256"}, {9, "512"}, {10, "1024"}, {11, "2048"}, {12, "4096"}, {0,0}}; |
WGorniak | 2:8d8295a51f68 | 20 | Variable::ValueDescription codeRateValues[] = |
WGorniak | 2:8d8295a51f68 | 21 | {{1, "4/5"}, {2, "4/6"}, {3, "4/7"}, {4, "4/8"}, {0,0}}; |
WGorniak | 2:8d8295a51f68 | 22 | Variable::ValueDescription preambleLenValues[] = |
WGorniak | 2:8d8295a51f68 | 23 | {{6, "symbols"}, {65535, 0}, {0,0}}; |
WGorniak | 2:8d8295a51f68 | 24 | Variable::ValueDescription symbTimeoutValues[] = |
WGorniak | 2:8d8295a51f68 | 25 | {{4, "symbols"}, {1023, 0}, {0,0}}; |
WGorniak | 2:8d8295a51f68 | 26 | Variable::ValueDescription paBoostValues[] = |
WGorniak | 2:8d8295a51f68 | 27 | {{0, "RFO pin"}, {1, "PA_BOOST pin"}, {0,0}}; |
WGorniak | 2:8d8295a51f68 | 28 | Variable::ValueDescription TXdelayValues[] = |
WGorniak | 2:8d8295a51f68 | 29 | {{0, "ms"}, {100000, 0}, {0,0} }; |
WGorniak | 2:8d8295a51f68 | 30 | |
WGorniak | 2:8d8295a51f68 | 31 | Variable variables[] = |
WGorniak | 2:8d8295a51f68 | 32 | { Variable("freq", "the frequency", 868000, frequencyValues) |
WGorniak | 2:8d8295a51f68 | 33 | , Variable("power", "the output power", 14, powerValues) |
WGorniak | 2:8d8295a51f68 | 34 | , Variable("bandwidth", "the bandwidth", 1, bandwidthValues) |
WGorniak | 2:8d8295a51f68 | 35 | , Variable("dataRate", "the Datarate / spreading factor", 7, dataRateValues) |
WGorniak | 2:8d8295a51f68 | 36 | , Variable("codeRate", "the coding rate", 1, codeRateValues) |
WGorniak | 2:8d8295a51f68 | 37 | , Variable("preambleLen", "the Preamble length", 8, preambleLenValues) |
WGorniak | 2:8d8295a51f68 | 38 | , Variable("symbTimeout", "the RxSingle timeout value", 5, symbTimeoutValues) |
WGorniak | 2:8d8295a51f68 | 39 | , Variable("paBoost", "forces PA_BOOST output", 0, paBoostValues) |
WGorniak | 2:8d8295a51f68 | 40 | , Variable("delay", "tx delay in ms", 0, TXdelayValues) |
WGorniak | 2:8d8295a51f68 | 41 | , Variable() |
WGorniak | 2:8d8295a51f68 | 42 | }; |
WGorniak | 2:8d8295a51f68 | 43 | |
WGorniak | 2:8d8295a51f68 | 44 | int main() |
WGorniak | 2:8d8295a51f68 | 45 | { |
WGorniak | 2:8d8295a51f68 | 46 | InterruptIn pushButton(USER_BUTTON); |
WGorniak | 2:8d8295a51f68 | 47 | Serial debugPort(SERIAL_TX, SERIAL_RX); |
WGorniak | 2:8d8295a51f68 | 48 | debugPort.baud(9600); |
WGorniak | 2:8d8295a51f68 | 49 | |
WGorniak | 2:8d8295a51f68 | 50 | Settings s(variables); |
WGorniak | 2:8d8295a51f68 | 51 | |
WGorniak | 2:8d8295a51f68 | 52 | Terminal terminal(&s, &debugPort, &pushButton); |
WGorniak | 2:8d8295a51f68 | 53 | debugPort.printf("\r\n\r\nELMO Terminal\r\n"); |
WGorniak | 2:8d8295a51f68 | 54 | terminal.executeCmd("h"); |
WGorniak | 2:8d8295a51f68 | 55 | terminal.start(); |
WGorniak | 2:8d8295a51f68 | 56 | } |