prepare for sending messages
This commit is contained in:
parent
4a3dc6bd63
commit
c57f9251c2
2 changed files with 17 additions and 7 deletions
|
@ -10,7 +10,7 @@ extern const uint LEFT_PADDLE_PIN;
|
|||
extern const uint RIGHT_PADDLE_PIN;
|
||||
extern const uint BUZZER_PIN;
|
||||
extern const uint CW_OUT_PIN;
|
||||
//extern const uint AUDIO_OUT_PIN;
|
||||
// extern const uint AUDIO_OUT_PIN;
|
||||
|
||||
const uint SIDETONE_FREQ = 622;
|
||||
|
||||
|
@ -51,6 +51,11 @@ void Keyer::run()
|
|||
{
|
||||
auto timestamp = get_absolute_time();
|
||||
|
||||
// If there is something to send …
|
||||
if (!m_messageQueue.empty()) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
// If we are in Straight key mode …
|
||||
if (m_mode == Mode::Straight) {
|
||||
if (left_paddle_pressed()) {
|
||||
|
@ -93,7 +98,7 @@ void Keyer::run()
|
|||
gpio_put(LED_PIN, 1);
|
||||
gpio_put(CW_OUT_PIN, 1);
|
||||
m_buzzer.on(SIDETONE_FREQ);
|
||||
//m_audioOut.on(SIDETONE_FREQ);
|
||||
// m_audioOut.on(SIDETONE_FREQ);
|
||||
} else {
|
||||
// If right paddle üressed -> note for Iambic B
|
||||
if (right_paddle_pressed() && !m_keyNextIambicB) {
|
||||
|
@ -105,7 +110,7 @@ void Keyer::run()
|
|||
gpio_put(LED_PIN, 0);
|
||||
gpio_put(CW_OUT_PIN, 0);
|
||||
m_buzzer.off();
|
||||
//m_audioOut.off();
|
||||
// m_audioOut.off();
|
||||
m_previousState = State::Dit;
|
||||
m_state = State::DitPause;
|
||||
}
|
||||
|
@ -118,7 +123,7 @@ void Keyer::run()
|
|||
gpio_put(LED_PIN, 1);
|
||||
gpio_put(CW_OUT_PIN, 1);
|
||||
m_buzzer.on(SIDETONE_FREQ);
|
||||
//m_audioOut.on(SIDETONE_FREQ);
|
||||
// m_audioOut.on(SIDETONE_FREQ);
|
||||
} else {
|
||||
// If left paddle pressed -> Note for Iambic B
|
||||
if (left_paddle_pressed() && !m_keyNextIambicB) {
|
||||
|
@ -130,7 +135,7 @@ void Keyer::run()
|
|||
gpio_put(LED_PIN, 0);
|
||||
gpio_put(CW_OUT_PIN, 0);
|
||||
m_buzzer.off();
|
||||
//m_audioOut.off();
|
||||
// m_audioOut.off();
|
||||
m_previousState = State::Dah;
|
||||
m_state = State::DahPause;
|
||||
}
|
||||
|
@ -180,7 +185,7 @@ void Keyer::run()
|
|||
gpio_put(LED_PIN, 0);
|
||||
gpio_put(CW_OUT_PIN, 0);
|
||||
m_buzzer.off();
|
||||
//m_audioOut.off();
|
||||
// m_audioOut.off();
|
||||
m_keyNextIambicB = false;
|
||||
m_currentlyPausing = false;
|
||||
m_currentlyKeying = false;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#include "settings.h"
|
||||
#include "sidetone.h"
|
||||
|
||||
|
@ -32,7 +35,7 @@ class Keyer final
|
|||
absolute_time_t m_pausing_until {0};
|
||||
|
||||
Sidetone m_buzzer;
|
||||
//Sidetone m_audioOut;
|
||||
// Sidetone m_audioOut;
|
||||
|
||||
State m_state {State::Wait};
|
||||
State m_previousState {State::Wait};
|
||||
|
@ -40,4 +43,6 @@ class Keyer final
|
|||
bool m_currentlyKeying {false};
|
||||
bool m_currentlyPausing {false};
|
||||
bool m_keyNextIambicB {false};
|
||||
|
||||
std::queue<std::string> m_messageQueue;
|
||||
};
|
Loading…
Reference in a new issue