new feature: stopping keyer
This commit is contained in:
parent
be9ac6b074
commit
251c365095
3 changed files with 23 additions and 2 deletions
|
@ -149,8 +149,21 @@ void Keyer::run()
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
case State::Abort:
|
||||
gpio_put(LED_PIN, 0);
|
||||
m_Sidetone.off();
|
||||
m_keyNextIambicB = false;
|
||||
m_currentlyPausing = false;
|
||||
m_currentlyKeying = false;
|
||||
m_previousState = State::Abort;
|
||||
state = State::Wait;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Keyer::stop()
|
||||
{
|
||||
state = State::Abort;
|
||||
}
|
|
@ -15,6 +15,7 @@ public:
|
|||
Dit,
|
||||
Dah,
|
||||
InterCharSpace,
|
||||
Abort,
|
||||
};
|
||||
Keyer() = delete;
|
||||
Keyer(uint8_t wpm, Mode mode);
|
||||
|
@ -23,6 +24,7 @@ public:
|
|||
void setSpeed(uint8_t wpm);
|
||||
|
||||
void run();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
State state{State::Wait};
|
||||
|
|
|
@ -23,6 +23,7 @@ enum class KeyerQueueCommand
|
|||
Run,
|
||||
Stop,
|
||||
Config,
|
||||
Wait,
|
||||
};
|
||||
struct KeyerQueueData
|
||||
{
|
||||
|
@ -69,11 +70,16 @@ void core1_main()
|
|||
keyer.run();
|
||||
break;
|
||||
case KeyerQueueCommand::Stop:
|
||||
keyer.stop();
|
||||
data.cmd = KeyerQueueCommand::Wait;
|
||||
break;
|
||||
case KeyerQueueCommand::Config:
|
||||
// set speed and wpm
|
||||
keyer.setSpeed(data.wpm);
|
||||
keyer.setMode(data.mode);
|
||||
data.cmd = KeyerQueueCommand::Run;
|
||||
break;
|
||||
case KeyerQueueCommand::Wait:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue