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

Committer:
WGorniak
Date:
Thu Oct 01 09:40:30 2015 +0200
Revision:
2:8d8295a51f68
Child:
3:bb58d4e78e68
added terminal app

Who changed what in which revision?

UserRevisionLine numberNew 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 #include <sstream>
WGorniak 2:8d8295a51f68 12
WGorniak 2:8d8295a51f68 13
WGorniak 2:8d8295a51f68 14 Variable::ValueDescription frequencyValues[] =
WGorniak 2:8d8295a51f68 15 {{860000, "kHz"}, {1020000, 0}, {0,0} };
WGorniak 2:8d8295a51f68 16 Variable::ValueDescription powerValues[] =
WGorniak 2:8d8295a51f68 17 {{-1, "dBm"}, {20, 0}, {0,0} };
WGorniak 2:8d8295a51f68 18 Variable::ValueDescription bandwidthValues[] =
WGorniak 2:8d8295a51f68 19 {{0, "125 kHz"}, {1, "250 kHz"}, {2, "500 kHz"}, {0,0} };
WGorniak 2:8d8295a51f68 20 Variable::ValueDescription dataRateValues[] =
WGorniak 2:8d8295a51f68 21 {{6, "64"}, {7, "128"}, {8, "256"}, {9, "512"}, {10, "1024"}, {11, "2048"}, {12, "4096"}, {0,0}};
WGorniak 2:8d8295a51f68 22 Variable::ValueDescription codeRateValues[] =
WGorniak 2:8d8295a51f68 23 {{1, "4/5"}, {2, "4/6"}, {3, "4/7"}, {4, "4/8"}, {0,0}};
WGorniak 2:8d8295a51f68 24 Variable::ValueDescription preambleLenValues[] =
WGorniak 2:8d8295a51f68 25 {{6, "symbols"}, {65535, 0}, {0,0}};
WGorniak 2:8d8295a51f68 26 Variable::ValueDescription symbTimeoutValues[] =
WGorniak 2:8d8295a51f68 27 {{4, "symbols"}, {1023, 0}, {0,0}};
WGorniak 2:8d8295a51f68 28 Variable::ValueDescription paBoostValues[] =
WGorniak 2:8d8295a51f68 29 {{0, "RFO pin"}, {1, "PA_BOOST pin"}, {0,0}};
WGorniak 2:8d8295a51f68 30 Variable::ValueDescription TXdelayValues[] =
WGorniak 2:8d8295a51f68 31 {{0, "ms"}, {100000, 0}, {0,0} };
WGorniak 2:8d8295a51f68 32
WGorniak 2:8d8295a51f68 33 Variable variables[] =
WGorniak 2:8d8295a51f68 34 { Variable("freq", "the frequency", 868000, frequencyValues)
WGorniak 2:8d8295a51f68 35 , Variable("power", "the output power", 14, powerValues)
WGorniak 2:8d8295a51f68 36 , Variable("bandwidth", "the bandwidth", 1, bandwidthValues)
WGorniak 2:8d8295a51f68 37 , Variable("dataRate", "the Datarate / spreading factor", 7, dataRateValues)
WGorniak 2:8d8295a51f68 38 , Variable("codeRate", "the coding rate", 1, codeRateValues)
WGorniak 2:8d8295a51f68 39 , Variable("preambleLen", "the Preamble length", 8, preambleLenValues)
WGorniak 2:8d8295a51f68 40 , Variable("symbTimeout", "the RxSingle timeout value", 5, symbTimeoutValues)
WGorniak 2:8d8295a51f68 41 , Variable("paBoost", "forces PA_BOOST output", 0, paBoostValues)
WGorniak 2:8d8295a51f68 42 , Variable("delay", "tx delay in ms", 0, TXdelayValues)
WGorniak 2:8d8295a51f68 43 , Variable()
WGorniak 2:8d8295a51f68 44 };
WGorniak 2:8d8295a51f68 45
WGorniak 2:8d8295a51f68 46 int main()
WGorniak 2:8d8295a51f68 47 {
WGorniak 2:8d8295a51f68 48 InterruptIn pushButton(USER_BUTTON);
WGorniak 2:8d8295a51f68 49 Serial debugPort(SERIAL_TX, SERIAL_RX);
WGorniak 2:8d8295a51f68 50 debugPort.baud(9600);
WGorniak 2:8d8295a51f68 51
WGorniak 2:8d8295a51f68 52 Settings s(variables);
WGorniak 2:8d8295a51f68 53
WGorniak 2:8d8295a51f68 54 Terminal terminal(&s, &debugPort, &pushButton);
WGorniak 2:8d8295a51f68 55 debugPort.printf("\r\n\r\nELMO Terminal\r\n");
WGorniak 2:8d8295a51f68 56 terminal.executeCmd("h");
WGorniak 2:8d8295a51f68 57 terminal.start();
WGorniak 2:8d8295a51f68 58 }