A DTMF sequence editor and player for HAM radio equipment command & control.

Dependencies:   mbed ExtTextLCD

edit_state.cpp

Committer:
osmeest
Date:
2011-03-07
Revision:
0:1324e7d9d471

File content as of revision 0:1324e7d9d471:

#include "system_states.hpp"
#include "system.hpp"
#include "display_manager.hpp"

void EditState::enterState() {
    DisplayManager *display = system()->display();
    display->hideCursor();
    display->writeStatus("Edit: <*>Cmd");
    updateText();
}

void EditState::handleKey(char key)
{
    if (key == '@') {
        system()->setState(System::Command);
    }
    else if (key == '$') {
        // ignored for the time being
    }
    else {
        handleSymbol(key);
    }
}

void EditState::handleSymbol(char ch) const {
    system()->insertSymbol(ch);
    updateText();
}