straight key mode added

This commit is contained in:
Martin Brodbeck 2024-02-20 15:24:51 +01:00
parent aa6b12470c
commit b37c39bc36
4 changed files with 22 additions and 9 deletions

View file

@ -8,11 +8,11 @@ Features (planned/done):
- [x] Iambic Paddle
- [x] Keying modes: Iambic A, Iambic B
- [ ] Straight key
- [x] Straight key
- [x] Sidetone (buzzer)
- [x] CW out (straight key input on TRX)
- [ ] Setting speed with rotary knob
- [ ] WinKeyer emulation
- [ ] Setting speed with rotary knob (left stop = speed setting from memory)
- [ ] LCD Display showing at least:
- Current speed
- Iambic mode

View file

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

View file

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

View file

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