set mode/speed added
This commit is contained in:
parent
60e9da0877
commit
be9ac6b074
2 changed files with 10 additions and 1 deletions
|
@ -40,6 +40,12 @@ Keyer::Keyer(uint8_t wpm, Mode mode) : m_wpm(wpm), m_mode(mode)
|
||||||
m_elementDuration = calcElementDurationUs(m_wpm);
|
m_elementDuration = calcElementDurationUs(m_wpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Keyer::setSpeed(uint8_t wpm)
|
||||||
|
{
|
||||||
|
m_wpm = wpm;
|
||||||
|
m_elementDuration = calcElementDurationUs(wpm);
|
||||||
|
}
|
||||||
|
|
||||||
void Keyer::run()
|
void Keyer::run()
|
||||||
{
|
{
|
||||||
auto timestamp = get_absolute_time();
|
auto timestamp = get_absolute_time();
|
||||||
|
|
|
@ -16,12 +16,15 @@ public:
|
||||||
Dah,
|
Dah,
|
||||||
InterCharSpace,
|
InterCharSpace,
|
||||||
};
|
};
|
||||||
|
Keyer() = delete;
|
||||||
Keyer(uint8_t wpm, Mode mode);
|
Keyer(uint8_t wpm, Mode mode);
|
||||||
|
|
||||||
|
void setMode(Mode mode) { m_mode = mode; }
|
||||||
|
void setSpeed(uint8_t wpm);
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Keyer(){};
|
|
||||||
State state{State::Wait};
|
State state{State::Wait};
|
||||||
State m_previousState{State::Wait};
|
State m_previousState{State::Wait};
|
||||||
uint8_t m_wpm{18};
|
uint8_t m_wpm{18};
|
||||||
|
|
Loading…
Reference in a new issue