This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
rc2007-soccer/source/Concept/Framework/modules/interpreter/command_handler.c

46 lines
1,021 B
C
Raw Normal View History

2007-02-22 23:37:00 +00:00
#include "command_handler.h"
//-----------------------------------------------------------------------------
void Command_Handler::Update()
{
Keyboard* ourKeyboard = parent->GetModule<Keyboard>(IO_KEYBOARD_MAIN);
uint8 curInput = ourKeyboard->GetInput();
while(curInput != 0xEE && curInput != 0xFF)
{
if(curInput == 10)
{
ExecuteCommand();
}
else if(curInput == 11)
{
if(this->currentCommandLength > 0)
{
this->currentCommandLength--;
this->buffer[currentCommandLength] = NULL;
}
}
else if(curInput >= 0 && curInput <= 9)
{
if(this->currentCommandLength < COMMAND_BUFFER_SIZE)
{
this->buffer[this->currentCommandLength] = '0' + curInput;
this->currentCommandLength++;
}
}
curInput = ourKeyboard->GetInput();
}
}
//-----------------------------------------------------------------------------
void Command_Handler::ExecuteCommand()
{
if(this->buffer[0] == '5')
{
this->displayDistanceSensors = true;
}
}