more experiments

This commit is contained in:
Martin Brodbeck 2024-02-11 16:26:55 +01:00
parent 5bfe72553f
commit e6c02baf95
2 changed files with 17 additions and 4 deletions

View file

@ -21,9 +21,9 @@ void Keyer::run()
{
case State::Wait:
if (left_paddle_pressed())
state = State::LeftPaddlePressed;
state = State::Dit;
break;
case State::LeftPaddlePressed:
case State::Dit:
printf(".");
if (left_paddle_pressed())
@ -31,12 +31,24 @@ void Keyer::run()
else
state = State::Wait;
break;
case State::Dah:
printf("-");
++numElements;
if (numElements == 3)
{
numElements = 0;
if (left_paddle_pressed())
state = State::InterCharSpace;
else
state = State::Wait;
}
break;
case State::InterCharSpace:
printf("(.)");
if (left_paddle_pressed())
state = State::LeftPaddlePressed;
state = State::Dit;
else
state = State::Wait;
break;

View file

@ -7,7 +7,8 @@ public:
enum class State
{
Wait,
LeftPaddlePressed,
Dit,
Dah,
InterCharSpace,
};