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: case State::Wait:
if (left_paddle_pressed()) if (left_paddle_pressed())
state = State::LeftPaddlePressed; state = State::Dit;
break; break;
case State::LeftPaddlePressed: case State::Dit:
printf("."); printf(".");
if (left_paddle_pressed()) if (left_paddle_pressed())
@ -31,12 +31,24 @@ void Keyer::run()
else else
state = State::Wait; state = State::Wait;
break; 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: case State::InterCharSpace:
printf("(.)"); printf("(.)");
if (left_paddle_pressed()) if (left_paddle_pressed())
state = State::LeftPaddlePressed; state = State::Dit;
else else
state = State::Wait; state = State::Wait;
break; break;

View file

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