From cdc6f7998afd043a9e93fa2a4e30f872f0ae91bc Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Sun, 18 Feb 2024 10:21:54 +0100 Subject: [PATCH] cw out added --- src/keyer.cpp | 6 ++++++ src/raspi_keyer.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/keyer.cpp b/src/keyer.cpp index 785b805..07e8b6b 100644 --- a/src/keyer.cpp +++ b/src/keyer.cpp @@ -8,6 +8,7 @@ extern const uint LED_PIN; extern const uint LEFT_PADDLE_PIN; extern const uint RIGHT_PADDLE_PIN; +extern const uint CW_OUT_PIN; const uint SIDETONE_FREQ = 622; @@ -69,6 +70,7 @@ void Keyer::run() m_currentlyKeying = true; m_keying_until = make_timeout_time_us(m_elementDuration); gpio_put(LED_PIN, 1); + gpio_put(CW_OUT_PIN, 1); m_Sidetone.on(SIDETONE_FREQ); } else { // If right paddle üressed -> note for Iambic B @@ -80,6 +82,7 @@ void Keyer::run() if (absolute_time_diff_us(timestamp, m_keying_until) <= 0) { m_currentlyKeying = false; gpio_put(LED_PIN, 0); + gpio_put(CW_OUT_PIN, 0); m_Sidetone.off(); m_previousState = State::Dit; m_state = State::DitPause; @@ -91,6 +94,7 @@ void Keyer::run() m_currentlyKeying = true; m_keying_until = make_timeout_time_us(m_elementDuration * 3); gpio_put(LED_PIN, 1); + gpio_put(CW_OUT_PIN, 1); m_Sidetone.on(SIDETONE_FREQ); } else { // If left paddle pressed -> Note for Iambic B @@ -102,6 +106,7 @@ void Keyer::run() if (absolute_time_diff_us(timestamp, m_keying_until) <= 0) { m_currentlyKeying = false; gpio_put(LED_PIN, 0); + gpio_put(CW_OUT_PIN, 0); m_Sidetone.off(); m_previousState = State::Dah; m_state = State::DahPause; @@ -150,6 +155,7 @@ void Keyer::run() break; case State::Abort: gpio_put(LED_PIN, 0); + gpio_put(CW_OUT_PIN, 0); m_Sidetone.off(); m_keyNextIambicB = false; m_currentlyPausing = false; diff --git a/src/raspi_keyer.cpp b/src/raspi_keyer.cpp index 6ecd4c1..d672787 100644 --- a/src/raspi_keyer.cpp +++ b/src/raspi_keyer.cpp @@ -16,6 +16,7 @@ extern const uint LED_PIN = PICO_DEFAULT_LED_PIN; extern const uint LEFT_PADDLE_PIN = 14; extern const uint RIGHT_PADDLE_PIN = 15; extern const uint BUZZER_PIN = 18; +extern const uint CW_OUT_PIN = 17; // Stuff for communicating between cores enum class KeyerQueueCommand { @@ -46,8 +47,9 @@ void setup() gpio_init(RIGHT_PADDLE_PIN); gpio_set_dir(RIGHT_PADDLE_PIN, GPIO_IN); gpio_pull_up(RIGHT_PADDLE_PIN); - - // sleep_ms(1000); + gpio_init(CW_OUT_PIN); + gpio_set_dir(CW_OUT_PIN, GPIO_OUT); + gpio_put(CW_OUT_PIN, 0); } /* Let's do all the keying stuff in the second core, so there are no timing problems. */