cw out added

This commit is contained in:
Martin Brodbeck 2024-02-18 10:21:54 +01:00
parent 9a004f8b94
commit cdc6f7998a
2 changed files with 10 additions and 2 deletions

View file

@ -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;

View file

@ -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. */