Elmo Terminal provides functionality to test Lora radio and access SX1272 chip registers delivered with Elmo board. This firmware allows the user to control the LoRa radio parameters (eg. frequency, bandwidth, spreading factor etc.) by entering console commands via serial terminal. Application also contains "Ping-Pong" and data transmission functionalities.

Dependencies:   SX1272lib mbed

Fork of Elmo-Terminal by Michal Leksinski

Commands/HelpCmd.cpp

Committer:
WGorniak
Date:
2015-10-22
Revision:
12:26045241f50f
Parent:
2:8d8295a51f68

File content as of revision 12:26045241f50f:

#include <cstdlib>
#include "HelpCmd.h"
#include "dbg.h"
#include "Settings.h"

#include "CmdList.h"

HelpCmd::HelpCmd(Settings* settings)
    : Cmd()
    , settings_(settings)
{
}

HelpCmd::~HelpCmd()
{
}

string HelpCmd::cmd()
{
    return "h";
}

string HelpCmd::desc()
{
    return "shows help";
}

template <>
void HelpCmd::help<int>()
{
}

template <typename cmds>
void HelpCmd::help()
{
    typedef typename cmds::t T;

    printf(" %s: %s\r\n", T::cmd().c_str(), T::desc().c_str());

    help<typename cmds::tn>(); // tail call recursion - optimized out (-O2)
}

bool HelpCmd::execute(list<string> args)
{
    printf("Terminal commands:\r\n");
    help<CmdList>();
    printf("\r\nButton starts ping-pong.\r\n\n");
    return true;
}

string HelpCmd::getResponse(void)
{
    return "";
}