straight key mode added
This commit is contained in:
parent
aa6b12470c
commit
b37c39bc36
4 changed files with 22 additions and 9 deletions
|
@ -51,6 +51,22 @@ void Keyer::run()
|
|||
{
|
||||
auto timestamp = get_absolute_time();
|
||||
|
||||
// If we are in Straight key mode …
|
||||
if (m_mode == Mode::Straight) {
|
||||
if (left_paddle_pressed()) {
|
||||
gpio_put(LED_PIN, 1);
|
||||
gpio_put(CW_OUT_PIN, 1);
|
||||
m_buzzer.on(SIDETONE_FREQ);
|
||||
} else {
|
||||
gpio_put(LED_PIN, 0);
|
||||
gpio_put(CW_OUT_PIN, 0);
|
||||
m_buzzer.off();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are in IambicA or IambicB-Mode …
|
||||
switch (m_state) {
|
||||
case State::Wait:
|
||||
if (left_paddle_pressed()) {
|
||||
|
@ -60,7 +76,7 @@ void Keyer::run()
|
|||
m_keyNextIambicB = false;
|
||||
m_state = State::Dah;
|
||||
} else {
|
||||
if (m_mode == Mode::IAMBIC_B && m_keyNextIambicB) {
|
||||
if (m_mode == Mode::IambicB && m_keyNextIambicB) {
|
||||
if (m_previousState == State::Dit)
|
||||
m_state = State::Dah;
|
||||
else
|
||||
|
|
|
@ -26,7 +26,7 @@ class Keyer final
|
|||
};
|
||||
|
||||
uint8_t m_wpm {18};
|
||||
Mode m_mode {Mode::IAMBIC_B};
|
||||
Mode m_mode {Mode::IambicB};
|
||||
|
||||
absolute_time_t m_keying_until {0};
|
||||
absolute_time_t m_pausing_until {0};
|
||||
|
|
|
@ -4,14 +4,11 @@
|
|||
|
||||
const uint16_t MAGIC_NUMBER = 2;
|
||||
|
||||
enum class Mode : uint8_t {
|
||||
IAMBIC_A = 0,
|
||||
IAMBIC_B,
|
||||
};
|
||||
enum class Mode : uint8_t { IambicA = 0, IambicB, Straight };
|
||||
|
||||
struct Settings {
|
||||
uint16_t magic_number {MAGIC_NUMBER}; // Bytes: 2
|
||||
Mode mode {Mode::IAMBIC_B}; // Bytes: 1
|
||||
Mode mode {Mode::IambicB}; // Bytes: 1
|
||||
uint8_t wpm {18}; // Bytes: 1
|
||||
uint8_t dummy[FLASH_PAGE_SIZE - 4] {0}; // Sum : 4
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue